mirror of https://github.com/rusefi/wideband.git
GetCanConfig
This commit is contained in:
parent
5cc1199d49
commit
00cc305d02
|
@ -222,7 +222,7 @@ THD_FUNCTION(BootloaderThread, arg)
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
// turn on CAN
|
// turn on CAN
|
||||||
canStart(&CAND1, &canConfig500);
|
canStart(&CAND1, &GetCanConfig());
|
||||||
|
|
||||||
WaitForBootloaderCmd();
|
WaitForBootloaderCmd();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// board-specific stuff shared between bootloader and firmware
|
// board-specific stuff shared between bootloader and firmware
|
||||||
|
|
||||||
const CANConfig canConfig500 =
|
static const CANConfig canConfig500 =
|
||||||
{
|
{
|
||||||
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
|
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),
|
CAN_BTR_SJW(0) | CAN_BTR_BRP(5) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CANConfig& GetCanConfig() {
|
||||||
|
return canConfig500;
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// board-specific stuff shared between bootloader and firmware
|
// board-specific stuff shared between bootloader and firmware
|
||||||
|
|
||||||
const CANConfig canConfig500 =
|
static const CANConfig canConfig500 =
|
||||||
{
|
{
|
||||||
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
|
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),
|
CAN_BTR_SJW(0) | CAN_BTR_BRP(2) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CANConfig& GetCanConfig() {
|
||||||
|
return canConfig500;
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// board-specific stuff shared between bootloader and firmware
|
// board-specific stuff shared between bootloader and firmware
|
||||||
|
|
||||||
const CANConfig canConfig500 =
|
static const CANConfig canConfig500 =
|
||||||
{
|
{
|
||||||
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
|
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),
|
CAN_BTR_SJW(0) | CAN_BTR_BRP(4 - 1) | CAN_BTR_TS1(13 - 1) | CAN_BTR_TS2(2 - 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CANConfig& GetCanConfig() {
|
||||||
|
return canConfig500;
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// board-specific stuff shared between bootloader and firmware
|
// board-specific stuff shared between bootloader and firmware
|
||||||
|
|
||||||
const CANConfig canConfig500 =
|
static const CANConfig canConfig500 =
|
||||||
{
|
{
|
||||||
CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP,
|
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),
|
CAN_BTR_SJW(0) | CAN_BTR_BRP(2) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CANConfig& GetCanConfig() {
|
||||||
|
return canConfig500;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
|
||||||
extern const CANConfig canConfig500;
|
const CANConfig& GetCanConfig();
|
||||||
|
|
|
@ -128,7 +128,7 @@ void InitCan()
|
||||||
{
|
{
|
||||||
configuration = GetConfiguration();
|
configuration = GetConfiguration();
|
||||||
|
|
||||||
canStart(&CAND1, &canConfig500);
|
canStart(&CAND1, &GetCanConfig());
|
||||||
chThdCreateStatic(waCanTxThread, sizeof(waCanTxThread), NORMALPRIO, CanTxThread, nullptr);
|
chThdCreateStatic(waCanTxThread, sizeof(waCanTxThread), NORMALPRIO, CanTxThread, nullptr);
|
||||||
chThdCreateStatic(waCanRxThread, sizeof(waCanRxThread), NORMALPRIO - 4, CanRxThread, nullptr);
|
chThdCreateStatic(waCanRxThread, sizeof(waCanRxThread), NORMALPRIO - 4, CanRxThread, nullptr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue