Broadcast button presses to CAN
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
|
||||
#define CAN_ID_AMS_STATUS 0xA
|
||||
#define CAN_ID_MISSION_SELECTED 0x400
|
||||
#define CAN_ID_STW_BUTTONS 0x401
|
||||
#define CAN_ID_STW_PARAM_SET 0x402
|
||||
#define CAN_ID_AS_MISSION_FB 0x410
|
||||
#define CAN_ID_STW_STATUS 0x412
|
||||
@ -51,6 +52,12 @@ void vehicle_broadcast_param(ParamType param, int32_t value) {
|
||||
ftcan_transmit(CAN_ID_STW_PARAM_SET, data, 5);
|
||||
}
|
||||
|
||||
void vehicle_broadcast_buttons(GPIO_PinState *button_states) {
|
||||
uint8_t data = (button_states[0] << 2) | (button_states[1] << 0) |
|
||||
(button_states[2] << 1) | (button_states[3] << 3);
|
||||
ftcan_transmit(CAN_ID_STW_BUTTONS, &data, 1);
|
||||
}
|
||||
|
||||
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {
|
||||
switch (id) {
|
||||
case CAN_ID_AMS_STATUS:
|
||||
|
||||
Reference in New Issue
Block a user