PER Firmware
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
9#ifndef MAIN_H
10#define MAIN_H
11
12#include "rtos/rtos.h"
13
14// Pinouts
15// LEDs (HB, CAN, ERR)
16#define HEARTBEAT_LED_PORT (GPIOB)
17#define HEARTBEAT_LED_PIN (5)
18#define VCAN_LED_PORT (GPIOB)
19#define VCAN_LED_PIN (7)
20#define MCAN_LED_PORT (GPIOB)
21#define MCAN_LED_PIN (9)
22#define SCAN_LED_PORT (GPIOB)
23#define SCAN_LED_PIN (8)
24#define ERROR_LED_PORT (GPIOB)
25#define ERROR_LED_PIN (6)
26
27// Connection LED (temporary define as VCAN as that bc we dont have a separate connection LED)
28#define CONNECTION_LED_PORT VCAN_LED_PORT
29#define CONNECTION_LED_PIN VCAN_LED_PIN
30
31// SD Card Status LEDs
32#define SD_ACTIVITY_LED_PORT (GPIOB)
33#define SD_ACTIVITY_LED_PIN (0)
34#define SD_ERROR_LED_PORT (GPIOC)
35#define SD_ERROR_LED_PIN (5)
36#define SD_DETECT_LED_PORT (GPIOC)
37#define SD_DETECT_LED_PIN (1)
38#define SD_CD_PORT (GPIOC)
39#define SD_CD_PIN (4)
40
41// W5500 ETH SPI1
42#define ETH_CS_PORT (GPIOA)
43#define ETH_CS_PIN (4)
44#define ETH_SCK_PORT (GPIOA)
45#define ETH_SCK_PIN (5)
46#define ETH_MISO_PORT (GPIOB)
47#define ETH_MISO_PIN (4)
48#define ETH_MOSI_PORT (GPIOA)
49#define ETH_MOSI_PIN (7)
50#define ETH_RST_PORT (GPIOC)
51#define ETH_RST_PIN (3)
52#define ETH_nINT_PORT (GPIOC)
53#define ETH_nINT_PIN (2)
54
55// MISC
56#define PWR_LOSS_PORT (GPIOB)
57#define PWR_LOSS_PIN (1)
58#define LOG_ENABLE_PORT (GPIOB)
59#define LOG_ENABLE_PIN (2)
60
61#define PER 1
62#define GREAT PER
63static_assert(PER == GREAT); // Long live daq loop
64
65#define SD_BLOCKING_TIMEOUT_MS (5000)
66constexpr TickType_t SD_BLOCKING_TIMEOUT_TICKS = pdMS_TO_TICKS(SD_BLOCKING_TIMEOUT_MS);
67
68extern SemaphoreHandle_t spi1_lock;
69extern volatile TaskHandle_t sd_task_handle; // ! handle to be pointed to by SDIO ISR for notifications
70
71extern volatile uint32_t last_can_rx_time_ms;
72
74
75#endif // MAIN_H
constexpr TickType_t SD_BLOCKING_TIMEOUT_TICKS
Definition main.h:66
void HardFault_Handler()
Definition main.c:317
#define SD_BLOCKING_TIMEOUT_MS
Definition main.h:65
volatile uint32_t last_can_rx_time_ms
Definition can_callback.c:18
#define PER
Definition main.h:61
volatile TaskHandle_t sd_task_handle
Definition main.c:109
SemaphoreHandle_t spi1_lock
#define GREAT
Definition main.h:62
Wrapper macros for FreeRTOS constructs (tasks, queues, semaphores) to simplify static memory allocati...