GetCanConfig

This commit is contained in:
Matthew Kennedy 2023-03-15 18:07:31 -07:00
parent 5cc1199d49
commit 00cc305d02
7 changed files with 23 additions and 7 deletions

View File

@ -222,7 +222,7 @@ THD_FUNCTION(BootloaderThread, arg)
(void)arg;
// turn on CAN
canStart(&CAND1, &canConfig500);
canStart(&CAND1, &GetCanConfig());
WaitForBootloaderCmd();

View File

@ -2,7 +2,7 @@
// board-specific stuff shared between bootloader and firmware
const CANConfig canConfig500 =
static const CANConfig canConfig500 =
{
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
/*
@ -10,3 +10,7 @@ const CANConfig canConfig500 =
*/
CAN_BTR_SJW(0) | CAN_BTR_BRP(5) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
};
const CANConfig& GetCanConfig() {
return canConfig500;
}

View File

@ -2,7 +2,7 @@
// board-specific stuff shared between bootloader and firmware
const CANConfig canConfig500 =
static const CANConfig canConfig500 =
{
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
/*
@ -10,3 +10,7 @@ const CANConfig canConfig500 =
*/
CAN_BTR_SJW(0) | CAN_BTR_BRP(2) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
};
const CANConfig& GetCanConfig() {
return canConfig500;
}

View File

@ -2,7 +2,7 @@
// board-specific stuff shared between bootloader and firmware
const CANConfig canConfig500 =
static const CANConfig canConfig500 =
{
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
/*
@ -10,3 +10,7 @@ const CANConfig canConfig500 =
*/
CAN_BTR_SJW(0) | CAN_BTR_BRP(4 - 1) | CAN_BTR_TS1(13 - 1) | CAN_BTR_TS2(2 - 1),
};
const CANConfig& GetCanConfig() {
return canConfig500;
}

View File

@ -2,7 +2,7 @@
// board-specific stuff shared between bootloader and firmware
const CANConfig canConfig500 =
static const CANConfig canConfig500 =
{
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
/*
@ -10,3 +10,7 @@ const CANConfig canConfig500 =
*/
CAN_BTR_SJW(0) | CAN_BTR_BRP(2) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
};
const CANConfig& GetCanConfig() {
return canConfig500;
}

View File

@ -1,4 +1,4 @@
#include "ch.h"
#include "hal.h"
extern const CANConfig canConfig500;
const CANConfig& GetCanConfig();

View File

@ -128,7 +128,7 @@ void InitCan()
{
configuration = GetConfiguration();
canStart(&CAND1, &canConfig500);
canStart(&CAND1, &GetCanConfig());
chThdCreateStatic(waCanTxThread, sizeof(waCanTxThread), NORMALPRIO, CanTxThread, nullptr);
chThdCreateStatic(waCanRxThread, sizeof(waCanRxThread), NORMALPRIO - 4, CanRxThread, nullptr);
}