From a8e2e56037c3a7e05d9d2c4caaefe13cc193c3c5 Mon Sep 17 00:00:00 2001 From: Blake Jackson Date: Thu, 23 Jan 2025 20:38:55 -0500 Subject: [PATCH] 24A Driver IO (#268) --- Core/Inc/steeringio.h | 16 ++++++---------- Core/Src/steeringio.c | 34 ++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Core/Inc/steeringio.h b/Core/Inc/steeringio.h index d2bb709..5e0f49c 100644 --- a/Core/Inc/steeringio.h +++ b/Core/Inc/steeringio.h @@ -6,16 +6,12 @@ #define STEERING_CANID_IO 0x680 typedef enum { - NONE, - NONE2, - NERO_BUTTON_LEFT, - NERO_BUTTON_UP, - NERO_BUTTON_RIGHT, - NERO_HOME, - NERO_BUTTON_SELECT, - NERO_BUTTON_DOWN, - STEERING_PADDLE_LEFT, - STEERING_PADDLE_RIGHT, + BUTTON_LEFT, + BUTTON_RIGHT, + BUTTON_ESC, + BUTTON_UP, + BUTTON_DOWN, + BUTTON_ENTER, MAX_STEERING_BUTTONS } steeringio_button_t; diff --git a/Core/Src/steeringio.c b/Core/Src/steeringio.c index 3775ef5..8df3874 100644 --- a/Core/Src/steeringio.c +++ b/Core/Src/steeringio.c @@ -26,28 +26,30 @@ void steeringio_update(can_msg_t msg) uint8_t button_id = msg.data[0]; switch (button_id) { - case NERO_BUTTON_UP: - printf("Up button pressed \n"); - decrement_nero_index(); - break; - case NERO_BUTTON_DOWN: - printf("Down button pressed \n"); - increment_nero_index(); - break; - case NERO_BUTTON_LEFT: + case BUTTON_LEFT: + printf("Left button pressed \n"); left_button_cb(); break; - case NERO_BUTTON_RIGHT: + case BUTTON_RIGHT: + printf("Right button pressed \n"); right_button_cb(); break; - case NERO_BUTTON_SELECT: - printf("Select button pressed \n"); - select_nero_index(); - break; - case NERO_HOME: - printf("Home button pressed \n"); + case BUTTON_ESC: + printf("Esc button pressed \n"); set_home_mode(); break; + case BUTTON_UP: + printf("Up button pressed \n"); + increment_nero_index(); + break; + case BUTTON_DOWN: + printf("Down button pressed \n"); + decrement_nero_index(); + break; + case BUTTON_ENTER: + printf("Enter button pressed \n"); + select_nero_index(); + break; default: break; }