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