PER Firmware
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
10
#ifndef MAIN_H
11
#define MAIN_H
12
13
#include <stdint.h>
14
#include "
common/phal_G4/adc/adc.h
"
15
#include "
common/phal_G4/gpio/gpio.h
"
16
17
typedef
volatile
struct
{
18
uint16_t
throttle1
;
19
uint16_t
throttle2
;
20
uint16_t
regen1
;
21
uint16_t
regen2
;
22
uint16_t
brake1_pressure
;
23
uint16_t
brake2_pressure
;
24
}
raw_adc_values_t
;
25
extern
volatile
raw_adc_values_t
raw_adc_values
;
26
27
extern
PHAL_ADC_Handle_t
adc_handle
;
28
29
// On-board Status LEDs
30
#define CONNECTION_LED_PORT (GPIOB)
31
#define CONNECTION_LED_PIN (7)
32
#define HEARTBEAT_LED_PORT (GPIOB)
33
#define HEARTBEAT_LED_PIN (9)
34
#define ERROR_LED_PORT (GPIOD)
35
#define ERROR_LED_PIN (2)
36
37
// External LEDs
38
#define IMD_LED_PORT (GPIOA)
39
#define IMD_LED_PIN (7)
40
#define BMS_LED_PORT (GPIOA)
41
#define BMS_LED_PIN (6)
42
#define PRCHG_LED_PORT (GPIOC)
43
#define PRCHG_LED_PIN (4)
44
#define REGEN_LED_PORT (GPIOC)
45
#define REGEN_LED_PIN (5)
46
47
// Main Button inputs
48
#define UP_BUTTON_PORT (GPIOC)
49
#define UP_BUTTON_PIN (6)
50
#define DOWN_BUTTON_PORT (GPIOC)
51
#define DOWN_BUTTON_PIN (7)
52
#define RIGHT_BUTTON_PORT (GPIOC)
53
#define RIGHT_BUTTON_PIN (8)
54
#define LEFT_BUTTON_PORT (GPIOC)
55
#define LEFT_BUTTON_PIN (9)
56
#define START_BUTTON_PORT (GPIOB)
57
#define START_BUTTON_PIN (14)
58
#define SELECT_BUTTON_PORT (GPIOB)
59
#define SELECT_BUTTON_PIN (15)
60
61
// Steering Wheel Button inputs
62
#define REGEN_TOGGLE_PORT (GPIOA)
63
#define REGEN_TOGGLE_PIN (4)
64
#define MARK_DATA_PORT (GPIOA)
65
#define MARK_DATA_PIN (5)
66
#define EBB_MINUS_PORT (GPIOB)
67
#define EBB_MINUS_PIN (0)
68
#define EBB_PLUS_PORT (GPIOB)
69
#define EBB_PLUS_PIN (1)
70
#define TV1_PLUS_PORT (GPIOB)
71
#define TV1_PLUS_PIN (11)
72
#define TV1_MINUS_PORT (GPIOB)
73
#define TV1_MINUS_PIN (13)
74
75
// Throttle
76
#define THROTTLE1_PORT (GPIOC)
// THROTTLE
77
#define THROTTLE1_PIN (2)
78
#define THROTTLE1_ADC_CHANNEL (8)
79
#define THROTTLE2_PORT (GPIOC)
// THROTTLE_INV
80
#define THROTTLE2_PIN (1)
81
#define THROTTLE2_ADC_CHANNEL (7)
82
83
// Brake
84
#define REGEN1_PORT (GPIOC)
85
#define REGEN1_PIN (3)
86
#define REGEN1_ADC_CHANNEL (9)
87
#define REGEN2_PORT (GPIOA)
88
#define REGEN2_PIN (0)
89
#define REGEN2_ADC_CHANNEL (1)
90
91
// Brake Pressure
92
#define BRAKE1_PRESSURE_PORT (GPIOA)
93
#define BRAKE1_PRESSURE_PIN (1)
94
#define BRAKE1_PRESSURE_ADC_CHANNEL (2)
95
#define BRAKE2_PRESSURE_PORT (GPIOA)
96
#define BRAKE2_PRESSURE_PIN (2)
97
#define BRAKE2_PRESSURE_ADC_CHANNEL (3)
98
99
#endif
// MAIN_H
adc_handle
PHAL_ADC_Handle_t adc_handle
Definition
main.c:74
raw_adc_values
volatile raw_adc_values_t raw_adc_values
Definition
main.c:105
raw_adc_values_t
raw_adc_values_t
Definition
main.h:28
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
raw_adc_values_t
Definition
main.h:17
raw_adc_values_t::brake1_pressure
uint16_t brake1_pressure
Definition
main.h:22
raw_adc_values_t::throttle2
uint16_t throttle2
Definition
main.h:19
raw_adc_values_t::regen1
uint16_t regen1
Definition
main.h:20
raw_adc_values_t::regen2
uint16_t regen2
Definition
main.h:21
raw_adc_values_t::throttle1
uint16_t throttle1
Definition
main.h:18
raw_adc_values_t::brake2_pressure
uint16_t brake2_pressure
Definition
main.h:23
firmware
source
dashboard
main.h
Generated by
1.12.0