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 "
phal_G4/adc/adc.h
"
15
#include "
phal_G4/gpio/gpio.h
"
16
17
typedef
volatile
struct
{
18
uint16_t
throttle1
;
19
uint16_t
throttle2
;
20
uint16_t
brake1_pressure
;
21
uint16_t
brake2_pressure
;
22
}
raw_adc_values_t
;
23
extern
volatile
raw_adc_values_t
raw_adc_values
;
24
25
extern
PHAL_ADC_Handle_t
adc_handle
;
26
27
// On-board Status LEDs
28
#define HEARTBEAT_LED_PORT (GPIOC)
29
#define HEARTBEAT_LED_PIN (7)
30
#define ERROR_LED_PORT (GPIOC)
31
#define ERROR_LED_PIN (8)
32
#define CONNECTION_LED_PORT (GPIOC)
33
#define CONNECTION_LED_PIN (9)
34
35
// External LEDs
36
#define IMD_LED_PORT (GPIOB)
37
#define IMD_LED_PIN (14)
38
#define BMS_LED_PORT (GPIOB)
39
#define BMS_LED_PIN (15)
40
#define PRCHG_LED_PORT (GPIOC)
41
#define PRCHG_LED_PIN (6)
42
43
// Dashboard SDC / Health Control (IS_DASH_GOOD_3V3)
44
#define IS_DASH_GOOD_PORT (GPIOB)
45
#define IS_DASH_GOOD_PIN (11)
46
47
// Main Button inputs
48
#define UP_BUTTON_PORT (GPIOA)
49
#define UP_BUTTON_PIN (3)
50
#define DOWN_BUTTON_PORT (GPIOA)
51
#define DOWN_BUTTON_PIN (4)
52
#define LEFT_BUTTON_PORT (GPIOA)
53
#define LEFT_BUTTON_PIN (5)
54
#define RIGHT_BUTTON_PORT (GPIOB)
55
#define RIGHT_BUTTON_PIN (0)
56
#define SELECT_BUTTON_PORT (GPIOB)
57
#define SELECT_BUTTON_PIN (1)
58
#define START_BUTTON_PORT (GPIOB)
59
#define START_BUTTON_PIN (2)
60
61
// Steering Wheel Button inputs (2027 schematic: Button_1..6_DEBOUNCED)
62
#define BUTTON_1_PORT (GPIOC)
63
#define BUTTON_1_PIN (10)
64
#define BUTTON_2_PORT (GPIOC)
65
#define BUTTON_2_PIN (11)
66
#define BUTTON_3_PORT (GPIOC)
67
#define BUTTON_3_PIN (12)
68
#define BUTTON_4_PORT (GPIOB)
69
#define BUTTON_4_PIN (6)
70
#define BUTTON_5_PORT (GPIOB)
71
#define BUTTON_5_PIN (7)
72
#define BUTTON_6_PORT (GPIOB)
73
#define BUTTON_6_PIN (9)
74
75
// Steering Wheel Button logical aliases
76
#define REGEN_TOGGLE_PORT BUTTON_1_PORT
77
#define REGEN_TOGGLE_PIN BUTTON_1_PIN
78
#define MARK_DATA_PORT BUTTON_2_PORT
79
#define MARK_DATA_PIN BUTTON_2_PIN
80
#define EBB_MINUS_PORT BUTTON_3_PORT
81
#define EBB_MINUS_PIN BUTTON_3_PIN
82
#define EBB_PLUS_PORT BUTTON_4_PORT
83
#define EBB_PLUS_PIN BUTTON_4_PIN
84
#define LAP_SET_PORT BUTTON_5_PORT
85
#define LAP_SET_PIN BUTTON_5_PIN
86
#define TV1_MINUS_PORT BUTTON_6_PORT
87
#define TV1_MINUS_PIN BUTTON_6_PIN
88
89
// Throttle
90
#define THROTTLE1_PORT (GPIOC)
// THRTL_MCU
91
#define THROTTLE1_PIN (0)
92
#define THROTTLE1_ADC_CHANNEL (6)
93
#define THROTTLE2_PORT (GPIOC)
// THRTL_INV_MCU
94
#define THROTTLE2_PIN (1)
95
#define THROTTLE2_ADC_CHANNEL (7)
96
97
// Brake Pressure
98
#define BRAKE1_PRESSURE_PORT (GPIOC)
// BRAKE1_MCU
99
#define BRAKE1_PRESSURE_PIN (2)
100
#define BRAKE1_PRESSURE_ADC_CHANNEL (8)
101
#define BRAKE2_PRESSURE_PORT (GPIOC)
// BRAKE2_MCU
102
#define BRAKE2_PRESSURE_PIN (3)
103
#define BRAKE2_PRESSURE_ADC_CHANNEL (9)
104
105
#endif
// MAIN_H
adc_handle
PHAL_ADC_Handle_t adc_handle
Definition
main.c:108
raw_adc_values
volatile raw_adc_values_t raw_adc_values
Definition
main.c:104
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:20
raw_adc_values_t::throttle2
uint16_t throttle2
Definition
main.h:19
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:21
firmware
source
dashboard
main.h
Generated by
1.12.0