Skip to content

Commit 563681a

Browse files
committed
moved from mealy to moore
1 parent 6368157 commit 563681a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tc1-u4/main.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,25 @@ void main()
172172
{
173173
switch (state) {
174174
case SLEEP:
175+
O_BOOST = LOW;
176+
O_AVR_BUTTON = LOW;
177+
175178
PCON = 0x02; // Stop/PowerDown Mode
176179
_nop_(); // We need at least one NOP after waking up
180+
177181
transition_to_state(IDLE);
178182
break;
179183

180184
case IDLE:
185+
O_AVR_BUTTON = button_state;
186+
181187
if(button_state == LOW){
182-
O_BOOST = HIGH; // powering the booster, avr, 5v rail
183-
O_AVR_BUTTON = LOW; // notify avr about the pressed button
184188
transition_to_state(BOOT);
185189
}
186190
break;
187191

188192
case BOOT:
193+
O_BOOST = HIGH; // powering the booster, avr, 5v rail
189194
O_AVR_BUTTON = button_state;
190195

191196
if (avr_online_state == HIGH){
@@ -202,8 +207,6 @@ void main()
202207
O_AVR_BUTTON = button_state;
203208

204209
if (avr_online_state == LOW) {
205-
O_BOOST = LOW;
206-
O_AVR_BUTTON = LOW;
207210
transition_to_state(SLEEP);
208211
}
209212

0 commit comments

Comments
 (0)