Public Archive. Code in use from 2022 - 2023
Contains the base code for all NERduino applications
Handles board peripherals and onboard sensor processing, in addition to starting local I2C and serial comms
Also contains a centralized CAN Message handler
- Finish testing of AMC6821
- Finish Implementation of AMC6821
- Update Naming of CAN Messages
NERduino object
|
|───private:
| |───ADXL312 object
| |───AMC6821 object
| └───SHT30 object
|
└───public:
|───nerduino() # calls Wire.begin() and Serial.begin(9600)
|───~nerduino()
|───begin() #calls the constructors of each chip (returns false if a chip is not found)
|───getADXLdata(XYZData_t *xyzbuf) # fills an XYZDATA_t buffer
└───...more to be added
CAN Functions (currently not bound to an object)
|
|───sendMessage(uint32_t id, uint8_t len, const uint8_t *buf) # sends a CAN Message w/ params
|───initializeCAN(uint8_t canLine) # initializes the CAN functionality of node
|
|───canHandler_CANMSG_BMSSHUTDOWN(const CAN_message_t &msg) # specific CAN handle commands
|───...
└───canHandler_CANMSG_MC_BMS_INTEGRATION (const CAN_message_t &msg)
The master CAN handler files allow for all CAN messages on all nodes to be processed using the same function and a large switch statement. It also allows for configurable CAN ID's that are saved in each node's EEPROM.
To send a message on the CAN network, use the sendMessage(uint32_t id, uint8_t len, const uint8_t *buf)
function.
To add fuctionality to a certain received CAN ID, simply implement one of the following functions that correspond to each CAN ID, the compiler will know to use the function you created:
void canHandler_CANMSG_BMSACCSTATUS (const CAN_message_t &msg);
void canHandler_CANMSG_BMSCELLDATA (const CAN_message_t &msg);
void canHandler_CANMSG_BMSCURRENTLIMITS (const CAN_message_t &msg);
void canHandler_CANMSG_BMSSHUTDOWN (const CAN_message_t &msg);
void canHandler_CANMSG_BMSDTCSTATUS (const CAN_message_t &msg);
void canHandler_CANMSG_ACCELERATIONCTRLINFO (const CAN_message_t &msg);
void canHandler_CANMSG_MOTORTEMP1 (const CAN_message_t &msg);
void canHandler_CANMSG_MOTORTEMP2 (const CAN_message_t &msg);
void canHandler_CANMSG_MOTORETEMP3 (const CAN_message_t &msg);
void canHandler_CANMSG_MOTORMOTION (const CAN_message_t &msg);
void canHandler_CANMSG_MOTORCURRENT (const CAN_message_t &msg);
void canHandler_CANMSG_MOTORVOLTAGE (const CAN_message_t &msg);
void canHandler_CANMSG_MCVEHICLESTATE (const CAN_message_t &msg);
void canHandler_CANMSG_ERR_MCFAULT (const CAN_message_t &msg);
void canHandler_CANMSG_MOTORTORQUETIMER (const CAN_message_t &msg);
void canHandler_CANMSG_BMSSTATUS2 (const CAN_message_t &msg);
void canHandler_CANMSG_BMSCHARGEDISCHARGE (const CAN_message_t &msg);
void canHandler_CANMSG_MC_BMS_INTEGRATION (const CAN_message_t &msg);
void canHandler_CANMSG_MC_SETPARAMETER (const CAN_message_t &msg);
void canHandler_CANMSG_BMSCHARGINGSTATE (const CAN_message_t &msg);
void canHandler_CANMSG_BMSCURRENTS (const CAN_message_t &msg);
A small, 3 axis accelerometer that we are using to get acceleration data. Currently, the acceleration data is being retrieved through getADXLdata(XYZData_t *xyzbuf)
which retrieves the XYZ register data through the ADXL specific reading and writing code.
XYZData_t
|───.XData.data # Each of these are signed 16 bit integers with axis data
|───.YData.data
└───.ZData.data
A small temperature and humidity sensor we are using to get the humidity and temperature of each node. The data can be accessed through getSHTdata(HumidData_t *humidbuf)
(WIP) which retrieves a buffer of humidity and temperature data through SHT specific read and write commands.
HumidData_t
|───.tempC # Ambient Temp in Celsius float
|───.tempF # Ambient Temp in Fahrenheit float
└───.relHumid # Relative Humidity float
A pulse width modulation chip specifically designed for intelligently controlling fan behavior. In the NERduino, howeveer, all fan-related functions of the chip are ignored, and the chip is solely used for generating a PWM signal. The duty cycle can be set via setDutyCycle(uint8_t dutycycle)
(WIP) which sets the PWM Duty Cycle to a value between 0-255. The functionality of this chip may differ per device due to debug flags.