Skip to content

Commit 8384581

Browse files
Joshua-Augensteincolescott
authored andcommitted
Add BMS_FAULT and CHARGER_CONTROL pins
1 parent b28e926 commit 8384581

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

bms/src/BmsConfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ extern Serial* serial;
1313
// This allows for all files to access the can bus output
1414
extern CAN* canBus;
1515

16+
//Global pointer to DigitalOut objects for BMS_FAULT and CHARGER_CONTROL pins
17+
//
18+
//This allows for all files to access BMS_FAULT and CHARGER_CONTROL pins
19+
extern DigitalOut* bms_flt;
20+
extern DigitalOut* charger_ctrl;
1621

1722
//
1823
// BMS Master Configuration

bms/src/BmsThread.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ class BMSThread {
4343

4444
void throwBmsFault() {
4545
m_discharging = false;
46-
//palClearLine(LINE_BMS_FLT);
47-
//palSetLine(LINE_CHARGER_CONTROL);
46+
bms_flt->write(0);
47+
charger_ctrl->write(1);
48+
4849
}
4950
void threadWorker() {
5051
uint16_t* allVoltages = new uint16_t[BMS_BANK_COUNT * BMS_BANK_CELL_COUNT];

bms/src/Main.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
Serial* serial;
3434
CAN* canBus;
35+
DigitalOut* bms_flt;
36+
DigitalOut* charger_ctrl;
3537

3638
void initIO();
3739

@@ -75,22 +77,24 @@ void initIO() {
7577

7678
canBus = new CAN(BMS_PIN_CAN_RX, BMS_PIN_CAN_TX, BMS_CAN_FREQUENCY);
7779

80+
bms_flt = new DigitalOut(BMS_PIN_BMS_FLT);
81+
82+
charger_ctrl = new DigitalOut(BMS_PIN_CHARGER_CONTROL);
83+
7884
// Set modes for IO
7985
/*
80-
palSetLineMode(LINE_BMS_FLT, PAL_MODE_OUTPUT_PUSHPULL);
8186
palSetLineMode(LINE_BMS_FLT_LAT, PAL_MODE_INPUT);
8287
palSetLineMode(LINE_IMD_STATUS, PAL_MODE_INPUT);
8388
palSetLineMode(LINE_IMD_FLT_LAT, PAL_MODE_INPUT);
84-
palSetLineMode(LINE_CHARGER_CONTROL, PAL_MODE_OUTPUT_PUSHPULL);
8589
palSetLineMode(LINE_SIG_CURRENT, PAL_MODE_INPUT_ANALOG);
8690
*/
8791

8892
// Reset BMS fault line
89-
//palSetLine(LINE_BMS_FLT);
90-
// palClearLine(LINE_BMS_FLT);
93+
bms_flt->write(1);
94+
bms_flt->write(0);
9195

9296
// Enable charging
93-
//palClearLine(LINE_CHARGER_CONTROL);
97+
charger_ctrl->write(0);
9498

9599
// Set modes for SPI
96100
/*

0 commit comments

Comments
 (0)