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_G4/adc/adc.h
"
13
#include "
common/phal_G4/gpio/gpio.h
"
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
54
typedef
struct
{
55
uint16_t
isense_raw
;
56
uint16_t
vbatt_raw
;
57
}
adc1_dma_buffer_t
;
58
extern
volatile
adc1_dma_buffer_t
adc1_dma_buffer
;
59
60
extern
PHAL_ADC_Handle_t
adc_handle
;
61
62
extern
adbms_bms_t
g_bms
;
63
64
#endif
// MAIN_H
g_bms
adbms_bms_t g_bms
Definition
main.c:112
adc_handle
PHAL_ADC_Handle_t adc_handle
Definition
main.c:74
adc1_dma_buffer
volatile adc1_dma_buffer_t adc1_dma_buffer
Definition
main.c:63
adbms.h
Primary logic and interface for ADBMS battery management system driver.
adc.h
G4 ADC public API. DMA-only, DMA-first conversions.
gpio.h
G4 GPIO public API.
PHAL_ADC_Handle_t
Runtime handle for one ADC instance.
Definition
adc.h:56
adbms_bms_t
Top-level ADBMS driver state, I/O buffers, measurements, and error flags.
Definition
adbms.h:104
adc1_dma_buffer_t
Definition
main.h:54
adc1_dma_buffer_t::vbatt_raw
uint16_t vbatt_raw
Definition
main.h:56
adc1_dma_buffer_t::isense_raw
uint16_t isense_raw
Definition
main.h:55
firmware
source
a_box
main.h
Generated by
1.12.0