PER Firmware
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
9#ifndef MAIN_H
10#define MAIN_H
11
12#include "common/phal/gpio.h"
13#include "adbms.h"
14
15// Status LEDs
16#define HEARTBEAT_LED_PORT (GPIOB)
17#define HEARTBEAT_LED_PIN (5)
18#define ERROR_LED_PORT (GPIOB)
19#define ERROR_LED_PIN (9)
20#define CONNECTION_LED_PORT (GPIOB)
21#define CONNECTION_LED_PIN (4)
22
23// SPI1 for BMS
24#define SPI1_SCK_PORT (GPIOA)
25#define SPI1_MISO_PORT (GPIOA)
26#define SPI1_MOSI_PORT (GPIOA)
27#define SPI1_SCK_PIN (5)
28#define SPI1_MISO_PIN (6)
29#define SPI1_MOSI_PIN (7)
30#define SPI1_CS_PORT (GPIOB)
31#define SPI1_CS_PIN (0)
32
33// ISENSE and VSENSE
34#define ISENSE_GPIO_PORT (GPIOA)
35#define ISENSE_GPIO_PIN (0)
36#define ISENSE_ADC_CHANNEL (1)
37#define VBATT_GPIO_PORT (GPIOA)
38#define VBATT_GPIO_PIN (1)
39#define VBATT_ADC_CHANNEL (2)
40
41// Input status pins
42#define CHARGER_CONNECTED_PORT (GPIOB)
43#define CHARGER_CONNECTED_PIN (2)
44#define NOT_PRECHARGE_COMPLETE_PORT (GPIOB)
45#define NOT_PRECHARGE_COMPLETE_PIN (11)
46#define IMD_STATUS_PORT (GPIOA)
47#define IMD_STATUS_PIN (9)
48
49// BMS SDC Control
50#define BMS_SDC_CTRL_PORT (GPIOA)
51#define BMS_SDC_CTRL_PIN (10)
52
53typedef struct {
54 uint16_t isense_raw;
55 uint16_t vbatt_raw;
57extern volatile adc1_dma_buffer_t adc1_dma_buffer;
58
59extern adbms_bms_t g_bms;
60
61#endif // MAIN_H
Primary logic and interface for ADBMS battery management system driver.
Top-level ADBMS driver state, I/O buffers, measurements, and error flags.
Definition adbms.h:104
Definition main.h:53