PER Firmware
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
#ifndef MAIN_H
2
#define MAIN_H
3
11
#include "
phal_G4/gpio/gpio.h
"
12
13
// VMC is PA3 (ADC1_IN4). VBATT is PA4 (ADC2_IN17). One DMA buffer per ADC.
14
typedef
struct
{
15
uint16_t
vmc
;
16
}
raw_adc1_values_t
;
17
extern
volatile
raw_adc1_values_t
raw_adc1_values
;
18
19
typedef
struct
{
20
uint16_t
vbatt
;
21
}
raw_adc2_values_t
;
22
extern
volatile
raw_adc2_values_t
raw_adc2_values
;
23
24
// Status LEDs
25
#define HEARTBEAT_LED_PORT (GPIOC)
26
#define HEARTBEAT_LED_PIN (7)
27
#define CONNECTION_LED_PORT (GPIOC)
28
#define CONNECTION_LED_PIN (8)
29
#define ERROR_LED_PORT (GPIOC)
30
#define ERROR_LED_PIN (9)
31
32
// TSAL
33
#define TSAL_RED_CTRL_PORT (GPIOC)
34
#define TSAL_RED_CTRL_PIN (3)
35
#define TSAL_GREEN_CTRL_PORT (GPIOA)
36
#define TSAL_GREEN_CTRL_PIN (0)
37
38
// Brake and Buzzer
39
#define BRAKE_LIGHT_PORT (GPIOB)
40
#define BRAKE_LIGHT_PIN (0)
41
#define BUZZER_PORT (GPIOB)
42
#define BUZZER_PIN (1)
43
44
// MAIN SDC Control
45
#define ECU_SDC_CTRL_PORT (GPIOA)
46
#define ECU_SDC_CTRL_PIN (5)
47
48
// SDC MUX (read + control)
49
#define SDC_MUX_PORT (GPIOB)
50
#define SDC_MUX_PIN (9)
51
#define SDC_MUX_S3_PORT (GPIOB)
52
#define SDC_MUX_S3_PIN (7)
53
#define SDC_MUX_S2_PORT (GPIOB)
54
#define SDC_MUX_S2_PIN (6)
55
#define SDC_MUX_S1_PORT (GPIOB)
56
#define SDC_MUX_S1_PIN (5)
57
#define SDC_MUX_S0_PORT (GPIOB)
58
#define SDC_MUX_S0_PIN (4)
59
60
// Digital input status pins
61
#define BMS_STATUS_PORT (GPIOA)
62
#define BMS_STATUS_PIN (7)
63
#define IMD_STATUS_PORT (GPIOA)
64
#define IMD_STATUS_PIN (6)
65
#define NOT_PRECHARGE_COMPLETE_PORT (GPIOC)
66
#define NOT_PRECHARGE_COMPLETE_PIN (4)
67
// PA3 = ADC1_IN4. PA4 = ADC2_IN17 (not an ADC1 channel).
68
#define VMC_PORT (GPIOA)
69
#define VMC_PIN (3)
70
#define VMC_ADC_CHANNEL (4)
71
#define VBATT_PORT (GPIOA)
72
#define VBATT_PIN (4)
73
#define VBATT_ADC_CHANNEL (17)
74
75
#endif
// MAIN_H
raw_adc2_values
volatile raw_adc2_values_t raw_adc2_values
Definition
main.c:77
raw_adc1_values
volatile raw_adc1_values_t raw_adc1_values
Definition
main.c:61
gpio.h
G4 GPIO public API.
raw_adc1_values_t
Definition
main.c:58
raw_adc1_values_t::vmc
uint16_t vmc
Definition
main.h:15
raw_adc2_values_t
Definition
main.c:74
raw_adc2_values_t::vbatt
uint16_t vbatt
Definition
main.h:20
firmware
source
main_module
main.h
Generated by
1.12.0