]>
Commit | Line | Data |
---|---|---|
1 | #include <avr/io.h> | |
2 | #include <stdio.h> | |
3 | ||
4 | #include "chassis.h" | |
5 | ||
6 | #define DEBUG | |
7 | ||
8 | void chassis_init() | |
9 | { | |
10 | DDRB = 0xff; | |
11 | PORTB = 0xff; | |
12 | } | |
13 | ||
14 | void chassis_control(unsigned char action) | |
15 | { | |
16 | #ifdef DEBUG | |
17 | printf("Chassis control 0x%02x\n", action); | |
18 | #endif | |
19 | ||
20 | switch(action) { | |
21 | case CHASSIS_ACTION_POWER_DOWN: | |
22 | PORTB=0xff; | |
23 | break; | |
24 | ||
25 | case CHASSIS_ACTION_POWER_UP: | |
26 | PORTB=0x00; | |
27 | break; | |
28 | ||
29 | case CHASSIS_ACTION_HARD_RESET: | |
30 | PORTB=0x55; | |
31 | break; | |
32 | ||
33 | default: | |
34 | printf("Unimplemented chassis action 0x%02x\n", action); | |
35 | break; | |
36 | } | |
37 | } |