Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24A Driver IO #268

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading