-#define CAN_BUMPER to_boa(0x30)
+#define CAN_ROBOT_SWITCHES to_boa(0x30)
+
// ids of can-peripherials
#define CAN_CHELAE to_per(0x32) /**< BOA->PER @copydetails set_chelae() front view 1st B left, 2nd B right */
#define CAN_ADC_1 to_boa(0x33) /* PER->BOA */
//#define CAN_ERROR to_boa(0x48) // FIXME: (F.J.) rename me, ...
-#define CAN_ROBOT_SWITCHES to_boa(0x47)
#define CAN_VIDLE_STATUS to_boa(0x48)
#define CAN_VIDLE_CMD to_per(0x49)
void handle_bumper()
{
static uint32_t bumper_time = 0;
+ char sw = 0;
if (timer_msec >= bumper_time + 100)
{
bumper_time = timer_msec;
- tx_msg.id = CAN_BUMPER;
- tx_msg.dlc = 1;
- tx_msg.flags = 0;
if (IO0PIN & (1<<BUMPER_PIN))
{
- tx_msg.data[0] = 0;
+ sw &= ~CAN_SWITCH_BUMPER;
deb_led_off(LEDR);
}
else
{
- tx_msg.data[0] = 1;
+ sw |= CAN_SWITCH_BUMPER;
deb_led_on(LEDR);
}
+
+ /* TODO: Put color to the second bit */
+ tx_msg.id = CAN_ROBOT_SWITCHES;
+ tx_msg.dlc = 1;
+ tx_msg.flags = 0;
+ tx_msg.data[0] = sw;
+
can_tx_msg(&tx_msg);
}
}