PER Firmware
Loading...
Searching...
No Matches
main.h
1
10
#ifndef _MAIN_H_
11
#define _MAIN_H_
12
13
#include "common/phal/can.h"
14
15
//STM32F407
16
17
typedef
struct
__attribute__
((packed)) {
18
// Do not modify this struct unless
19
// you modify the ADC DMA config
20
// in main.h to match
21
uint16_t t1;
22
uint16_t t2;
23
uint16_t b1;
24
uint16_t b2;
25
uint16_t brake1_pressure;
26
uint16_t brake2_pressure;
27
}
raw_adc_values_t
;
28
volatile
extern
raw_adc_values_t
raw_adc_values;
29
30
typedef
struct
{
31
uint8_t update_page;
32
uint8_t up_button;
33
uint8_t down_button;
34
uint8_t left_button;
35
uint8_t right_button;
36
uint8_t select_button;
37
uint8_t start_button;
38
}
dashboard_input_state_t
;
39
40
// On-board Status LEDs
41
#define CONNECTION_LED_PORT (GPIOB)
42
#define CONNECTION_LED_PIN (7)
43
#define HEARTBEAT_LED_PORT (GPIOB)
44
#define HEARTBEAT_LED_PIN (9)
45
#define ERROR_LED_PORT (GPIOD)
46
#define ERROR_LED_PIN (2)
47
48
// External LEDs
49
#define IMD_LED_PORT (GPIOA)
50
#define IMD_LED_PIN (7)
51
#define BMS_LED_PORT (GPIOA)
52
#define BMS_LED_PIN (6)
53
#define PRCHG_LED_PORT (GPIOC)
54
#define PRCHG_LED_PIN (4)
55
#define REGEN_LED_PORT (GPIOC)
56
#define REGEN_LED_PIN (0)
57
58
// Status Inputs
59
#define START_BTN_GPIO_Port (GPIOB)
60
#define START_BTN_Pin (14)
61
62
#define BRK1_THR_GPIO_Port (GPIOC)
63
#define BRK1_THR_Pin (3)
64
#define BRK1_THR_ADC_CHNL (9)
65
#define BRK2_THR_GPIO_Port (GPIOA)
66
#define BRK2_THR_Pin (0)
67
#define BRK2_THR_ADC_CHNL (1)
68
69
// CAN
70
#define VCAN_RX_GPIO_Port (GPIOB)
71
#define VCAN_RX_Pin (5)
72
#define VCAN_TX_GPIO_Port (GPIOB)
73
#define VCAN_TX_Pin (6)
74
75
// Throttle
76
#define THTL_1_GPIO_Port (GPIOC)
// THROTTLE
77
#define THTL_1_Pin (2)
78
#define THTL_1_ADC_CHNL (8)
79
#define THTL_2_GPIO_Port (GPIOC)
// THROTTLE_INV
80
#define THTL_2_Pin (1)
81
#define THTL_2_ADC_CHNL (7)
82
83
// Aux Button inputs
84
#define B_UP_GPIO_Port (GPIOC)
85
#define B_UP_Pin (6)
86
#define B_DOWN_GPIO_Port (GPIOC)
87
#define B_DOWN_Pin (7)
88
#define B_RIGHT_GPIO_Port (GPIOC)
89
#define B_RIGHT_Pin (8)
90
#define B_LEFT_GPIO_Port (GPIOC)
91
#define B_LEFT_Pin (9)
92
#define B_SELECT_GPIO_Port (GPIOB)
93
#define B_SELECT_Pin (15)
94
95
// Brake
96
#define BRK_1_GPIO_Port (GPIOC)
97
#define BRK_1_Pin (3)
98
#define BRK_1_ADC_CHNL (9)
99
#define BRK_2_GPIO_Port (GPIOA)
100
#define BRK_2_Pin (0)
101
#define BRK_2_ADC_CHNL (1)
102
103
#define BRAKE1_PRESSURE_PORT (GPIOA)
104
#define BRAKE1_PRESSURE_PIN (1)
105
#define BRAKE1_PRESSURE_ADC_CHANNEL (2)
106
#define BRAKE2_PRESSURE_PORT (GPIOA)
107
#define BRAKE2_PRESSURE_PIN (2)
108
#define BRAKE2_PRESSURE_ADC_CHANNEL (3)
109
110
// LCD
111
#define LCD_UART (USART1)
112
#define LCD_UART_TX_GPIO_Port (GPIOA)
113
#define LCD_UART_TX_Pin (9)
114
#define LCD_UART_RX_GPIO_Port (GPIOA)
115
#define LCD_UART_RX_Pin (10)
116
117
#endif
__attribute__
Definition
main.h:260
dashboard_input_state_t
Definition
main.h:30
raw_adc_values_t
Definition
main.c:61
source
dashboard
main.h
Generated by
1.12.0