+#include <avr/io.h>
+#include <stdio.h>
+
+#include "chassis.h"
+
+#define DEBUG
+
+void chassis_init()
+{
+ DDRB = 0xff;
+ PORTB = 0xff;
+}
+
+void chassis_control(unsigned char action)
+{
+#ifdef DEBUG
+ printf("Chassis control 0x%02x\n", action);
+#endif
+
+ switch(action) {
+ case CHASSIS_ACTION_POWER_DOWN:
+ PORTB=0xff;
+ break;
+
+ case CHASSIS_ACTION_POWER_UP:
+ PORTB=0x00;
+ break;
+
+ case CHASSIS_ACTION_HARD_RESET:
+ PORTB=0x55;
+ break;
+
+ default:
+ printf("Unimplemented chassis action 0x%02x\n", action);
+ break;
+ }
+}