57 #ifndef FOXBMS__MXM_BATTERY_MANAGEMENT_H_
58 #define FOXBMS__MXM_BATTERY_MANAGEMENT_H_
71 #define COMMAND_BUFFER_LENGTH (6u)
74 #define MXM_5X_RX_BUFFER_LEN 100u
77 #define HELLOALL_START_SEED 0x00u
79 #define DATA_CHECK_BYTE_SEED 0x00u
81 #define ALIVE_COUNTER_SEED 0x00u
94 #define BATTERY_MANAGEMENT_HELLOALL ((BATTERY_MANAGEMENT_COMMAND_t)0x57u)
99 #define BATTERY_MANAGEMENT_ALERTPACKET ((BATTERY_MANAGEMENT_COMMAND_t)0x21u)
104 #define BATTERY_MANAGEMENT_WRITEDEVICE ((BATTERY_MANAGEMENT_COMMAND_t)0x04u)
109 #define BATTERY_MANAGEMENT_WRITEALL ((BATTERY_MANAGEMENT_COMMAND_t)0x02u)
114 #define BATTERY_MANAGEMENT_READDEVICE ((BATTERY_MANAGEMENT_COMMAND_t)0x05u)
119 #define BATTERY_MANAGEMENT_READALL ((BATTERY_MANAGEMENT_COMMAND_t)0x03u)
124 #define BATTERY_MANAGEMENT_READBLOCK ((BATTERY_MANAGEMENT_COMMAND_t)0x06u)
130 #define BATTERY_MANAGEMENT_DOWNHOST ((BATTERY_MANAGEMENT_COMMAND_t)0x09u)
135 #define BATTERY_MANAGEMENT_UPHOST ((BATTERY_MANAGEMENT_COMMAND_t)0x08u)
146 #define BATTERY_MANAGEMENT_TX_LENGTH_READALL ((uint8_t)4u)
347 uint16_t rxBufferLength);
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
#define must_check_return
Allows functions to generate warnings in GCC for unused returns.
Headers for the driver for the MAX17841B ASCI and MAX1785x monitoring chip.
enum MXM_41B_STATE_REQUEST_STATUS MXM_41B_STATE_REQUEST_STATUS_e
Request status of MAX17841B states.
Basic defines for the complete Maxim driver.
enum MXM_DC_BYTE MXM_DC_BYTE_e
MXM_STATEMACHINE_5X_e
States of the Battery Management Protocol state-machine.
@ MXM_STATEMACH_5X_READALL
@ MXM_STATEMACH_5X_WRITEALL
@ MXM_STATEMACH_5X_WRITE_DEVICE
@ MXM_STATEMACH_5X_UNINITIALIZED
@ MXM_STATEMACH_5X_MAXSTATE
@ MXM_STATEMACH_5X_41B_FMEA_CHECK
#define MXM_5X_RX_BUFFER_LEN
MXM_5X_STATE_REQUEST_STATUS_e
Request status of Battery Management Protocol states.
@ MXM_5X_STATE_UNPROCESSED
STD_RETURN_TYPE_e must_check_return MXM_5XUserAccessibleAddressSpaceCheckerSelfCheck(void)
runs a selfcheck for the address space check
struct MXM_5X_INSTANCE MXM_5X_INSTANCE_s
5x statemachine structure
void MXM_5XStateMachine(MXM_41B_INSTANCE_s *pInstance41b, MXM_5X_INSTANCE_s *pInstance5x)
Execute state-machine for Battery Management Protocol.
MXM_5X_SUBSTATES_e
Sub-states of the Battery Management Protocol state-machine.
@ MXM_5X_WRITE_DEVICE_CHECK_CRC
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_CLEAR_RECEIVE_BUFFER
@ MXM_5X_WRITEALL_UART_TRANSACTION
@ MXM_5X_WRITEALL_UART_VERIFY_BUFFER
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_HELLOALL
@ MXM_5X_READALL_UART_TRANSACTION
@ MXM_5X_READALL_CHECK_CRC
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_EN_PREAMBLES
@ MXM_5X_41B_FMEA_REQUEST
@ MXM_5X_INIT_ENABLE_RX_INTERRUPT_FLAGS
@ MXM_5X_WRITE_DEVICE_UART_TRANSACTION
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_CLEAR_RECEIVE_BUFFER_2
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_HELLOALL_VERIFY_MSG_AND_COUNT
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_WAIT_FOR_RX_STATUS_BUSY
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_WAIT_FOR_RX_STATUS_EMPTY
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_CLEAR_TRANSMIT_BUFFER
@ MXM_5X_INIT_ENABLE_KEEP_ALIVE
@ MXM_5X_INIT_WAKE_UP_SATELLITE_DEVICES_DIS_PREAMBLES
uint8_t BATTERY_MANAGEMENT_COMMAND_t
Type for Battery Management Protocol commands.
STD_RETURN_TYPE_e MXM_5XGetRXBuffer(const MXM_5X_INSTANCE_s *const kpkInstance, uint8_t *rxBuffer, uint16_t rxBufferLength)
Copy RX buffer into variable.
STD_RETURN_TYPE_e MXM_5XSetStateRequest(MXM_5X_INSTANCE_s *pInstance5x, MXM_STATEMACHINE_5X_e state, MXM_5X_COMMAND_PAYLOAD_s commandPayload, MXM_5X_STATE_REQUEST_STATUS_e *processed)
Set state request for the Battery Management Statemachine.
STD_RETURN_TYPE_e MXM_5XGetNumberOfSatellitesGood(const MXM_5X_INSTANCE_s *const kpkInstance)
Get the value of MXM_5X_INSTANCE::numberOfSatellitesIsGood.
MXM_DC_BYTE_e MXM_5XGetLastDCByte(const MXM_5X_INSTANCE_s *const kpkInstance)
Returns the last received DC byte.
#define COMMAND_BUFFER_LENGTH
uint8_t MXM_5XGetNumberOfSatellites(const MXM_5X_INSTANCE_s *const kpkInstance)
Get number of satellites.
Header for the configuration for the Maxim monitoring chip.
Headers for the CRC8 calculation for Maxim Integrated Monitoring devices.
Register map of the MAX1785x monitoring IC.
enum MXM_REG_NAME MXM_REG_NAME_e
MAX1785x register names.
Struct for the state-variable of state-machine.
MXM_REG_NAME_e regAddress
5x statemachine structure
uint8_t commandBufferCurrentLength
Length of Command Buffer.
MXM_5X_COMMAND_PAYLOAD_s commandPayload
MXM_5X_SUBSTATES_e substate
MXM_41B_STATE_REQUEST_STATUS_e status41b
MXM_STATEMACHINE_5X_e state
STD_RETURN_TYPE_e numberOfSatellitesIsGood
Command Buffer.
uint8_t lastDCByte
Tracks the last received DC byte.
uint16_t commandBuffer[COMMAND_BUFFER_LENGTH]
uint8_t numberOfSatellites
Number of satellites.
uint16_t rxBuffer[MXM_5X_RX_BUFFER_LEN]
MXM_5X_STATE_REQUEST_STATUS_e * processed