-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlink.c
163 lines (138 loc) · 3.49 KB
/
Blink.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// This file is automatically generated.
#include <avr/io.h>
#include <util/delay_basic.h>
#include <stdbool.h>
struct list {
uint8_t size;
void* values;
};
struct tuple2 {
void* value0;
void* value1;
};
struct tuple6 {
void* value0;
void* value1;
void* value2;
void* value3;
void* value4;
void* value5;
};
static void bootup();
static void input_timer();
static void stream_1(uint8_t arg, void* value);
static void stream_2(uint8_t arg, void* value);
static void stream_3(uint8_t arg, void* value);
static void stream_4(uint8_t arg, void* value);
static void stream_5(uint8_t arg, void* value);
static void stream_6(uint8_t arg, void* value);
static void stream_7(uint8_t arg, void* value);
static void stream_8(uint8_t arg, void* value);
static void bootup() {
bool temp0;
temp0 = 0;
stream_1(0, (void*)(&temp0));
}
static void input_timer() {
uint16_t temp1;
temp1 = TCNT1;
TCNT1 = 0;
stream_2(1, (void*)(&temp1));
}
static void stream_1(uint8_t arg, void* value) {
bool input_0 = *((bool*)value);
uint16_t temp2;
temp2 = 10000;
stream_2(0, (void*)(&temp2));
}
static void stream_2(uint8_t arg, void* value) {
static uint16_t input_0;
static uint16_t input_1;
uint16_t temp3;
uint16_t temp4;
struct tuple2 temp5;
switch (arg) {
case 0:
input_0 = *((uint16_t*)value);
break;
case 1:
input_1 = *((uint16_t*)value);
break;
}
temp3 = input_0;
temp4 = input_1;
temp5.value0 = (void*)&temp3;
temp5.value1 = (void*)&temp4;
stream_3(0, (void*)(&temp5));
}
static void stream_3(uint8_t arg, void* value) {
struct tuple2 input_0 = *((struct tuple2*)value);
static uint16_t temp6 = 0;
static uint16_t temp7 = 0;
static struct tuple2 input_1 = { .value0 = (void*)&temp6, .value1 = (void*)&temp7 };
uint16_t temp8;
uint16_t temp9;
struct tuple2 temp10;
uint16_t temp11;
uint16_t temp12;
struct tuple2 temp13;
struct tuple2 temp14;
temp8 = 0;
temp9 = 0;
temp10.value0 = (void*)&temp8;
temp10.value1 = (void*)&temp9;
temp11 = 1;
temp12 = (*((uint16_t*)input_1.value1) + *((uint16_t*)input_0.value1));
temp13.value0 = (void*)&temp11;
temp13.value1 = (void*)&temp12;
if (((*((uint16_t*)input_1.value1) + *((uint16_t*)input_0.value1)) > *((uint16_t*)input_0.value0))) {
temp14 = temp10;
} else {
temp14 = temp13;
}
*((uint16_t*)input_1.value0) = *((uint16_t*)temp14.value0);
*((uint16_t*)input_1.value1) = *((uint16_t*)temp14.value1);
stream_4(0, (void*)(&input_1));
}
static void stream_4(uint8_t arg, void* value) {
struct tuple2 input_0 = *((struct tuple2*)value);
if (*((uint16_t*)input_0.value0) == 0) {
stream_5(0, (void*)(&input_0));
}
}
static void stream_5(uint8_t arg, void* value) {
struct tuple2 input_0 = *((struct tuple2*)value);
bool temp15;
temp15 = 0;
stream_6(0, (void*)(&temp15));
}
static void stream_6(uint8_t arg, void* value) {
bool input_0 = *((bool*)value);
static uint16_t input_1 = 0;
input_1 = (input_1 + 1);
stream_7(0, (void*)(&input_1));
}
static void stream_7(uint8_t arg, void* value) {
uint16_t input_0 = *((uint16_t*)value);
bool temp16;
temp16 = (input_0) % 2 == 0;
stream_8(0, (void*)(&temp16));
}
static void stream_8(uint8_t arg, void* value) {
bool input_0 = *((bool*)value);
if (input_0) {
PORTB |= (1 << PB5);
} else {
PORTB &= ~(1 << PB5);
}
}
int main(void) {
TCCR1B |= (1 << CS12);
TCCR1B |= (1 << CS10);
DDRB |= (1 << PB5);
bootup();
while (1) {
input_timer();
}
return 0;
}