Skip to content

Commit

Permalink
MS IO-Box: pick settings from config
Browse files Browse the repository at this point in the history
  • Loading branch information
dron0gus committed Apr 20, 2024
1 parent f0d7cb5 commit 2a9cd13
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions firmware/hw_layer/drivers/gpio/can_gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,15 @@ CanListener* MsIoBox::request(void) {
static MsIoBox instance[BOARD_CAN_GPIO_COUNT];

void initCanGpio() {
if (engineConfiguration->msIoBox0.id == MsIoBoxId::OFF) {
return;
}
// CAN_PIN_0
for (size_t i = 0; i < BOARD_CAN_GPIO_COUNT; i++) {
/* TODO: pick can bus, base CAN ID (and refresh rate) from settings */
if (instance[i].config(0, CAN_IOBOX_BASE1, 20) == 0) {
uint32_t can_id = CAN_IOBOX_BASE1 + 0x20 * (static_cast<uint32_t>(engineConfiguration->msIoBox0.id) - static_cast<uint32_t>(MsIoBoxId::ID200));

/* TODO: pick can bus and refresh rate from settings */
if (instance[i].config(0, can_id, 20) == 0) {
registerCanListener(instance[i]);
}
}
Expand Down

0 comments on commit 2a9cd13

Please sign in to comment.