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
14#include "adbms.h"
15
16// Status LEDs
17#define HEARTBEAT_LED_PORT (GPIOB)
18#define HEARTBEAT_LED_PIN (5)
19#define ERROR_LED_PORT (GPIOB)
20#define ERROR_LED_PIN (9)
21#define CONNECTION_LED_PORT (GPIOB)
22#define CONNECTION_LED_PIN (4)
23
24// SPI1 for BMS
25#define SPI1_SCK_PORT (GPIOA)
26#define SPI1_MISO_PORT (GPIOA)
27#define SPI1_MOSI_PORT (GPIOA)
28#define SPI1_SCK_PIN (5)
29#define SPI1_MISO_PIN (6)
30#define SPI1_MOSI_PIN (7)
31#define SPI1_CS_PORT (GPIOB)
32#define SPI1_CS_PIN (0)
33
34// ISENSE and VSENSE
35#define ISENSE_GPIO_PORT (GPIOA)
36#define ISENSE_GPIO_PIN (0)
37#define ISENSE_ADC_CHANNEL (1)
38#define VBATT_GPIO_PORT (GPIOA)
39#define VBATT_GPIO_PIN (1)
40#define VBATT_ADC_CHANNEL (2)
41
42// Input status pins
43#define CHARGER_CONNECTED_PORT (GPIOB)
44#define CHARGER_CONNECTED_PIN (2)
45#define NOT_PRECHARGE_COMPLETE_PORT (GPIOB)
46#define NOT_PRECHARGE_COMPLETE_PIN (11)
47#define IMD_STATUS_PORT (GPIOA)
48#define IMD_STATUS_PIN (9)
49
50// BMS SDC Control
51#define BMS_SDC_CTRL_PORT (GPIOA)
52#define BMS_SDC_CTRL_PIN (10)
53
54typedef struct {
55 uint16_t isense_raw;
56 uint16_t vbatt_raw;
59
61
62extern adbms_bms_t g_bms;
63
64#endif // MAIN_H
adbms_bms_t g_bms
Definition main.c:112
PHAL_ADC_Handle_t adc_handle
Definition main.c:74
volatile adc1_dma_buffer_t adc1_dma_buffer
Definition main.c:63
Primary logic and interface for ADBMS battery management system driver.
G4 ADC public API. DMA-only, DMA-first conversions.
G4 GPIO public API.
Runtime handle for one ADC instance.
Definition adc.h:56
Top-level ADBMS driver state, I/O buffers, measurements, and error flags.
Definition adbms.h:104
Definition main.h:54
uint16_t vbatt_raw
Definition main.h:56
uint16_t isense_raw
Definition main.h:55