/*********************************************************/
void can_send_status(void)
{
- can_msg_t tx_msg;
- tx_msg.id = CAN_VIDLE_STATUS;
- tx_msg.dlc = 5;
- tx_msg.flags = 0;
- tx_msg.data[0] = (fsm_vidle.act_pos >> 8) & 0xFF;
- tx_msg.data[1] = fsm_vidle.act_pos & 0xFF;
- tx_msg.data[2] = (fsm_vidle.can_response >> 8) & 0xFF;
- tx_msg.data[3] = fsm_vidle.can_response & 0xFF;
- tx_msg.data[4] = fsm_vidle.flags;
- /*while*/(can_tx_msg(&tx_msg)); /* CAN erratum workaround */
+ can_msg_t tx_msg;
+ tx_msg.id = CAN_VIDLE_STATUS;
+ tx_msg.dlc = 5;
+ tx_msg.flags = 0;
+ tx_msg.data[0] = (fsm_vidle.act_pos >> 8) & 0xFF;
+ tx_msg.data[1] = fsm_vidle.act_pos & 0xFF;
+ tx_msg.data[2] = (fsm_vidle.can_response >> 8) & 0xFF;
+ tx_msg.data[3] = fsm_vidle.can_response & 0xFF;
+ tx_msg.data[4] = fsm_vidle.flags;
+ /*while*/(can_tx_msg(&tx_msg)); /* CAN erratum workaround */
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//dbg_print_time();
- /* TODO: Precti potak a uloz ho do fsm_vidle.act_pos */
fsm_vidle.act_pos = adc_val[0];
#endif
if(timer_msec >= led_time + 500)
{
- /* static int up;
- if (up == 0)
- fsm_vidle.can_req_position = 0x380;
- if (up == 6)
- fsm_vidle.can_req_position = 0x1e0;
- up = (up+1)%12;
- */ led_time = timer_msec;
+ /* static int up;
+ if (up == 0)
+ fsm_vidle.can_req_position = 0x380;
+ if (up == 6)
+ fsm_vidle.can_req_position = 0x1e0;
+ up = (up+1)%12;
+ */ led_time = timer_msec;
deb_led_change(LEDG);
- send_rs_int(fsm_vidle.act_pos);
- send_rs_str("\n");
+ send_rs_int(fsm_vidle.act_pos);
+ send_rs_str("\n");
}
if(timer_msec >= bumper_time + 100)
if (IO0PIN & (1<<BUMPER_PIN))
{
- tx_msg.data[0] = 1;
- deb_led_on(LEDB);
+ tx_msg.data[0] = 1;
+ deb_led_on(LEDB);
}
else
{
- tx_msg.data[0] = 0;
- deb_led_off(LEDB);
+ tx_msg.data[0] = 0;
+ deb_led_off(LEDB);
}
can_tx_msg(&tx_msg); /* CAN erratum workaround */