Skip to content

Commit

Permalink
24A Driver IO (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjackson312006 authored Jan 24, 2025
1 parent eb5a919 commit a8e2e56
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
16 changes: 6 additions & 10 deletions Core/Inc/steeringio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
34 changes: 18 additions & 16 deletions Core/Src/steeringio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit a8e2e56

Please sign in to comment.