-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
61 lines (53 loc) · 1.74 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <Arduino.h>
//Define this to be the serial port the Tesla BMS modules are connected to.
//On the Due you need to use a USART port (Serial1, Serial2, Serial3) and update the call to serialSpecialInit if not Serial1
#define SERIAL Serial2
#define REG_DEV_STATUS 0
#define REG_GPAI 1
#define REG_VCELL1 3
#define REG_VCELL2 5
#define REG_VCELL3 7
#define REG_VCELL4 9
#define REG_VCELL5 0xB
#define REG_VCELL6 0xD
#define REG_TEMPERATURE1 0xF
#define REG_TEMPERATURE2 0x11
#define REG_ALERT_STATUS 0x20
#define REG_FAULT_STATUS 0x21
#define REG_COV_FAULT 0x22
#define REG_CUV_FAULT 0x23
#define REG_ADC_CTRL 0x30
#define REG_IO_CTRL 0x31
#define REG_BAL_CTRL 0x32
#define REG_BAL_TIME 0x33
#define REG_ADC_CONV 0x34
#define REG_ADDR_CTRL 0x3B
#define MAX_MODULE_ADDR 0x3E
#define EEPROM_VERSION 0x10 //update any time EEPROM struct below is changed.
#define EEPROM_PAGE 0
#define DIN1 6
#define DIN2 7
#define DIN3 4
#define DIN4 5
#define DOUT4_H 10
#define DOUT4_L 9
#define DOUT3_H 36
#define DOUT3_L 35
#define DOUT2_H 45
#define DOUT2_L 46
#define DOUT1_H 47
#define DOUT1_L 48
typedef struct {
uint8_t version;
uint8_t checksum;
uint32_t canSpeed;
uint8_t batteryID; //which battery ID should this board associate as on the CAN bus
uint8_t logLevel;
float OverVSetpoint;
float UnderVSetpoint;
float OverTSetpoint;
float UnderTSetpoint;
float balanceVoltage;
float balanceHyst;
} EEPROMSettings;