Skip to content

Commit fd5a8c7

Browse files
Updated EVT-Core and Namespaces
Updated EVT-Core to the latest version, then renamed the DEV namespace to dev because it fits the new EVT core standard Signed-off-by: Taylor Lineman <git@actuallytaylor.com>
1 parent 0e3d891 commit fd5a8c7

26 files changed

Lines changed: 352 additions & 352 deletions

File tree

include/BMS.hpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
#pragma once
22

3-
#include <cstdint>
4-
5-
#include <EVT/io/CANDevice.hpp>
6-
#include <EVT/io/CANOpenMacros.hpp>
7-
#include <co_core.h>
3+
#include <core/io/CANDevice.hpp>
4+
#include <core/io/CANOpenMacros.hpp>
5+
#include <core/io/pin.hpp>
6+
#include <core/dev/IWDG.hpp>
87

98
#include <BMSCANOpenMacros.hpp>
109
#include <BQSettingStorage.hpp>
11-
#include <EVT/dev/IWDG.hpp>
12-
#include <EVT/io/pin.hpp>
1310
#include <ResetHandler.hpp>
1411
#include <SystemDetect.hpp>
12+
1513
#include <dev/Interlock.hpp>
1614
#include <dev/ThermistorMux.hpp>
1715

18-
namespace IO = EVT::core::IO;
16+
namespace IO = core::io;
1917

2018
namespace BMS {
2119

@@ -85,9 +83,9 @@ class BMS : public CANDevice {
8583
* @param[in] resetHandler Handler for reset messages
8684
* @param[in] iwdg Internal watchdog to ensure the BMS code is running without getting stuck
8785
*/
88-
BMS(BQSettingsStorage& bqSettingsStorage, DEV::BQ76952 bq, DEV::Interlock& interlock,
86+
BMS(BQSettingsStorage& bqSettingsStorage, dev::BQ76952 bq, dev::Interlock& interlock,
8987
IO::GPIO& alarm, SystemDetect& systemDetect, IO::GPIO& bmsOK, IO::GPIO& errorLed,
90-
DEV::ThermistorMux& thermMux, ResetHandler& resetHandler, EVT::core::DEV::IWDG& iwdg);
88+
dev::ThermistorMux& thermMux, ResetHandler& resetHandler, core::dev::IWDG& iwdg);
9189

9290
/**
9391
* The node ID used to identify the device on the CAN network.
@@ -189,7 +187,7 @@ class BMS : public CANDevice {
189187
/**
190188
* Interface to the BQ chip
191189
*/
192-
DEV::BQ76952 bq;
190+
dev::BQ76952 bq;
193191

194192
/**
195193
* The current state of the BMS
@@ -199,7 +197,7 @@ class BMS : public CANDevice {
199197
/**
200198
* The interlock which is used to detect a cable plugged in
201199
*/
202-
DEV::Interlock& interlock;
200+
dev::Interlock& interlock;
203201

204202
/**
205203
* This GPIO is connected to the ALARM pin of the BQ
@@ -235,12 +233,12 @@ class BMS : public CANDevice {
235233
/**
236234
* Multiplexer to handle pack thermistors
237235
*/
238-
DEV::ThermistorMux thermistorMux;
236+
dev::ThermistorMux thermistorMux;
239237

240238
/**
241239
* Internal watchdog to detect STM hang
242240
*/
243-
EVT::core::DEV::IWDG& iwdg;
241+
core::dev::IWDG& iwdg;
244242

245243
/**
246244
* Boolean flag which represents that a state has just changed
@@ -327,7 +325,7 @@ class BMS : public CANDevice {
327325
* by reading the voltage from the BQ chip and is then exposed over
328326
* CANopen.
329327
*/
330-
uint16_t cellVoltage[DEV::BQ76952::NUM_CELLS] = {};
328+
uint16_t cellVoltage[dev::BQ76952::NUM_CELLS] = {};
331329

332330
/**
333331
* Used to store values which the BMS updates.

include/BMSCANOpenMacros.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include <EVT/io/CANOpenMacros.hpp>
3+
#include <core/io/CANOpenMacros.hpp>
44

55
/**
66
* This macro creates a TPDO settings object for an extra node on a single

include/BQSettingStorage.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <cstdint>
44

5-
#include <EVT/dev/storage/M24C32.hpp>
5+
#include <core/dev/storage/M24C32.hpp>
66

77
#include <BQSetting.hpp>
88
#include <dev/BQ76952.hpp>
@@ -37,7 +37,7 @@ class BQSettingsStorage {
3737
* @param eeprom EEPROM instance that stores settings
3838
* @param bq BQ instance to send settings to
3939
*/
40-
BQSettingsStorage(EVT::core::DEV::M24C32& eeprom, DEV::BQ76952& bq);
40+
BQSettingsStorage(core::dev::M24C32& eeprom, dev::BQ76952& bq);
4141

4242
/**
4343
* Get the number of settings stored for the BQ
@@ -94,7 +94,7 @@ class BQSettingsStorage {
9494
*
9595
* @return The EEPROM instance
9696
*/
97-
EVT::core::DEV::M24C32& getEEPROM();
97+
core::dev::M24C32& getEEPROM();
9898

9999
/**
100100
* Reset the transfer setting logic
@@ -126,7 +126,7 @@ class BQSettingsStorage {
126126
* @param[out] isComplete Flag that represents all settings have been transferred
127127
* @return The resulting status of the transfer operation
128128
*/
129-
BMS::DEV::BQ76952::Status transferSetting(bool& isComplete);
129+
dev::BQ76952::Status transferSetting(bool& isComplete);
130130

131131
/**
132132
* Check if the settings are stored and can be used
@@ -158,11 +158,11 @@ class BQSettingsStorage {
158158
/**
159159
* EEPROM for storing the BQ settings.
160160
*/
161-
EVT::core::DEV::M24C32& eeprom;
161+
core::dev::M24C32& eeprom;
162162
/**
163163
* The BQ chip interface
164164
*/
165-
DEV::BQ76952& bq;
165+
dev::BQ76952& bq;
166166
/**
167167
* This is a count of the number of settings that have been written into
168168
* EEPROM. This is used for determining if all the settings have been
@@ -175,7 +175,7 @@ class BQSettingsStorage {
175175
*/
176176
uint16_t numSettingsTransferred = 0;
177177

178-
friend class BMS;
178+
friend class bms;
179179
};
180180

181181
}// namespace BMS

include/ResetHandler.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include <EVT/io/types/CANMessage.hpp>
3+
#include <core/io/types/CANMessage.hpp>
44

55
namespace BMS {
66

@@ -19,7 +19,7 @@ class ResetHandler {
1919
*
2020
* @param msg Message to register
2121
*/
22-
void registerInput(EVT::core::IO::CANMessage msg);
22+
void registerInput(core::io::CANMessage msg);
2323

2424
/**
2525
* Check whether reset messages have been received, indicating that the BMS
@@ -43,7 +43,7 @@ class ResetHandler {
4343
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
4444

4545
/** Array of last MSG_HIST_LEN messages received */
46-
EVT::core::IO::CANMessage msgHistory[MSG_HIST_LEN] = {};
46+
core::io::CANMessage msgHistory[MSG_HIST_LEN] = {};
4747
/** Index of the last registered message */
4848
uint8_t lastRegMsgIndex = 0;
4949
};

include/dev/BQ76952.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#pragma once
22

3-
#include <EVT/io/I2C.hpp>
4-
#include <EVT/io/GPIO.hpp>
3+
#include <core/io/I2C.hpp>
4+
#include <core/io/GPIO.hpp>
55

66
#include <BMSInfo.hpp>
77
#include <BQSetting.hpp>
88

99
#include <co_obj.h>
1010

11-
namespace BMS::DEV {
11+
namespace BMS::dev {
1212

1313
/**
1414
* Represents the functionality of the BQ76952. This is a layer of abstraction
@@ -51,7 +51,7 @@ class BQ76952 {
5151
* @param[in] i2cAddress The address of the BQ76952 to use
5252
* @param[in] resetPin GPIO instance to reset the BQ
5353
*/
54-
BQ76952(EVT::core::IO::I2C& i2c, uint8_t i2cAddress, EVT::core::IO::GPIO& resetPin);
54+
BQ76952(core::io::I2C& i2c, uint8_t i2cAddress, core::io::GPIO& resetPin);
5555

5656
/**
5757
* Write out the given setting
@@ -285,11 +285,11 @@ class BQ76952 {
285285
static constexpr uint16_t BQ_ID = 0x7695;
286286

287287
/** I2C bus to communicate over */
288-
EVT::core::IO::I2C& i2c;
288+
core::io::I2C& i2c;
289289
/** The address of the BQ on the I2C bus */
290290
uint8_t i2cAddress;
291291
/** Reset pin of the BQ */
292-
EVT::core::IO::GPIO& resetPin;
292+
core::io::GPIO& resetPin;
293293
};
294294

295-
}// namespace BMS::DEV
295+
}// namespace BMS::dev

include/dev/Interlock.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

3-
#include <EVT/io/GPIO.hpp>
3+
#include <core/io/GPIO.hpp>
44

5-
namespace BMS::DEV {
5+
namespace BMS::dev {
66

77
/**
88
* Represents the interlock which detects if the battery is has a cable
@@ -16,7 +16,7 @@ class Interlock {
1616
*
1717
* @pre The GPIO is set as an input
1818
*/
19-
explicit Interlock(EVT::core::IO::GPIO& gpio);
19+
explicit Interlock(core::io::GPIO& gpio);
2020

2121
/**
2222
* See if a cable is detected in the interlock
@@ -25,10 +25,10 @@ class Interlock {
2525

2626
private:
2727
/** Active high state of the detect GPIO */
28-
static constexpr EVT::core::IO::GPIO::State ACTIVE_STATE = EVT::core::IO::GPIO::State::HIGH;
28+
static constexpr core::io::GPIO::State ACTIVE_STATE = core::io::GPIO::State::HIGH;
2929

3030
/** GPIO which is used to read the detect state */
31-
EVT::core::IO::GPIO& gpio;
31+
core::io::GPIO& gpio;
3232
};
3333

34-
}// namespace BMS::DEV
34+
}// namespace BMS::dev

include/dev/ThermistorMux.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#pragma once
22

3-
#include <EVT/dev/Thermistor.hpp>
4-
#include <EVT/io/GPIO.hpp>
5-
#include <EVT/utils/time.hpp>
3+
#include <core/dev/Thermistor.hpp>
4+
#include <core/io/GPIO.hpp>
5+
#include <core/utils//time.hpp>
66

7-
namespace IO = EVT::core::IO;
8-
namespace time = EVT::core::time;
7+
namespace IO = core::io;
8+
namespace time = core::time;
99

10-
namespace BMS::DEV {
10+
namespace BMS::dev {
1111

1212
/**
1313
* Multiplexer connected to thermistors
@@ -34,7 +34,7 @@ class ThermistorMux {
3434
/** Array of MUX select pins */
3535
IO::GPIO* muxSelectArr[3];
3636
/** Thermistor instance to read the temperatures with */
37-
EVT::core::DEV::Thermistor therm;
37+
core::dev::Thermistor therm;
3838

3939
/**
4040
* Conversion equation from ADC counts to temperature in Celsius
@@ -54,4 +54,4 @@ class ThermistorMux {
5454
}
5555
};
5656

57-
}// namespace BMS::DEV
57+
}// namespace BMS::dev

libs/EVT-core

Submodule EVT-core updated 212 files

src/BMS.cpp

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
#include <BMS.hpp>
22

3-
#include <EVT/utils/log.hpp>
4-
#include <EVT/utils/time.hpp>
3+
#include <core/utils/log.hpp>
4+
#include <core/utils/time.hpp>
55
#include <cstring>
66

7-
namespace time = EVT::core::time;
8-
namespace log = EVT::core::log;
7+
#include <core/dev/IWDG.hpp>
8+
9+
namespace time = core::time;
10+
namespace log = core::log;
911

1012
namespace BMS {
1113

12-
BMS::BMS(BQSettingsStorage& bqSettingsStorage, DEV::BQ76952 bq,
13-
DEV::Interlock& interlock, IO::GPIO& alarm, SystemDetect& systemDetect,
14-
IO::GPIO& bmsOK, IO::GPIO& errorLed, DEV::ThermistorMux& thermMux,
15-
ResetHandler& resetHandler, EVT::core::DEV::IWDG& iwdg) : bqSettingsStorage(bqSettingsStorage),
14+
BMS::BMS(BQSettingsStorage& bqSettingsStorage, dev::BQ76952 bq,
15+
dev::Interlock& interlock, IO::GPIO& alarm, SystemDetect& systemDetect,
16+
IO::GPIO& bmsOK, IO::GPIO& errorLed, dev::ThermistorMux& thermMux,
17+
ResetHandler& resetHandler, core::dev::IWDG& iwdg) : bqSettingsStorage(bqSettingsStorage),
1618
bq(bq), state(State::START), interlock(interlock),
1719
alarm(alarm), systemDetect(systemDetect), resetHandler(resetHandler),
1820
bmsOK(bmsOK), errorLed(errorLed), thermistorMux(thermMux),
@@ -146,7 +148,7 @@ void BMS::startState() {
146148
.temp1 = 0,
147149
.temp2 = 0,
148150
};
149-
memset(thermistorTemperature, 0, DEV::BQ76952::NUM_CELLS * sizeof(uint16_t));
151+
memset(thermistorTemperature, 0, dev::BQ76952::NUM_CELLS * sizeof(uint16_t));
150152
memset(bqStatusArr, 0, sizeof(uint8_t) * 3);
151153
errorRegister = 0;
152154
lastCheckedThermNum = -1;
@@ -165,8 +167,8 @@ void BMS::startState() {
165167
}
166168

167169
// Check to see if communication is possible with the BQ chip
168-
DEV::BQ76952::Status status = bq.communicationStatus();
169-
if (status != DEV::BQ76952::Status::OK) {
170+
dev::BQ76952::Status status = bq.communicationStatus();
171+
if (status != dev::BQ76952::Status::OK) {
170172

171173
// Increment the number of errors that have taken place
172174
numBqAttemptsMade++;
@@ -249,7 +251,7 @@ void BMS::transferSettingsState() {
249251

250252
bool isComplete = false;
251253
auto result = bqSettingsStorage.transferSetting(isComplete);
252-
if (result != DEV::BQ76952::Status::OK) {
254+
if (result != dev::BQ76952::Status::OK) {
253255
numBqAttemptsMade++;
254256

255257
// If the number of errors are over the max
@@ -398,25 +400,25 @@ void BMS::updateBQData() {
398400
}
399401
}
400402

401-
DEV::BQ76952::Status result = bq.getCellVoltage(cellVoltage, totalVoltage, voltageInfo);
403+
dev::BQ76952::Status result = bq.getCellVoltage(cellVoltage, totalVoltage, voltageInfo);
402404

403-
if (result == DEV::BQ76952::Status::OK) {
405+
if (result == dev::BQ76952::Status::OK) {
404406
result = bq.getTotalVoltage(batteryVoltage);
405407
}
406408

407-
if (result == DEV::BQ76952::Status::OK) {
409+
if (result == dev::BQ76952::Status::OK) {
408410
result = bq.getCurrent(current);
409411
}
410412

411-
if (result == DEV::BQ76952::Status::OK) {
413+
if (result == dev::BQ76952::Status::OK) {
412414
result = bq.getTemps(bqTempInfo);
413415
}
414416

415-
if (result == DEV::BQ76952::Status::OK) {
417+
if (result == dev::BQ76952::Status::OK) {
416418
result = bq.getBQStatus(bqStatusArr);
417419
}
418420

419-
if (result != DEV::BQ76952::Status::OK) {
421+
if (result != dev::BQ76952::Status::OK) {
420422
numBqAttemptsMade++;
421423

422424
// If the number of errors are over the max
@@ -482,7 +484,7 @@ void BMS::clearVoltageReadings() {
482484
voltageInfo = {0, 0, 0, 0};
483485

484486
// Zero out all cell voltages
485-
memset(cellVoltage, 0, DEV::BQ76952::NUM_CELLS * sizeof(uint16_t));
487+
memset(cellVoltage, 0, dev::BQ76952::NUM_CELLS * sizeof(uint16_t));
486488
}
487489

488490
}// namespace BMS

src/BQSetting.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <BQSetting.hpp>
22

3-
#include <EVT/utils/log.hpp>
3+
#include <core/utils/log.hpp>
44

5-
namespace log = EVT::core::log;
5+
namespace log = core::log;
66

77
namespace BMS {
88

0 commit comments

Comments
 (0)