unsigned int getCurrentPosition(void);
void gotoPos(unsigned int position); // !!! depricated
void generatePositions(void);
+void go_to_sleep();
unsigned int getTime(void);
void can_rx(can_msg_t *msg);
recieveCANmessage= 1; //flag to sent CAN data
recieveCANdata= rx_msg.data[3]; // data to send
break;
+
+ case CAN_PWR_ALERT:
+ if ( rx_msg.data[0] == 2 ) go_to_sleep();
+ break;
default:
break;
}
}
+void go_to_sleep()
+{
+ engine_A_en(ENGINE_EN_OFF); // engines off
+ engine_A_pwm(0);
+ engine_B_en(ENGINE_EN_OFF);
+ engine_B_pwm(0);
+
+ can_off();
+
+ deb_led_off(LEDY);
+ deb_led_off(LEDB);
+ deb_led_off(LEDG);
+ deb_led_on(LEDR);
+ PCON = 2; // bye bye
+}
+
+
/**
* returns the number in T0TC