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
13#include "sd_card.h"
14#include "spmc.h"
15
16// Pinouts
17// LEDs
18#define HEARTBEAT_LED_PORT (GPIOD)
19#define HEARTBEAT_LED_PIN (13)
20#define CONNECTION_LED_PORT (GPIOD)
21#define CONNECTION_LED_PIN (14)
22#define ERROR_LED_PORT (GPIOD)
23#define ERROR_LED_PIN (15)
24
25// SD Card SDIO
26#define SD_ACTIVITY_LED_PORT (GPIOA)
27#define SD_ACTIVITY_LED_PIN (9)
28#define SD_ERROR_LED_PORT (GPIOA)
29#define SD_ERROR_LED_PIN (8)
30#define SD_DETECT_LED_PORT (GPIOA)
31#define SD_DETECT_LED_PIN (10)
32#define SD_CD_PORT (GPIOD)
33#define SD_CD_PIN (4)
34
35// W5500 ETH SPI1
36#define ETH_CS_PORT (GPIOA)
37#define ETH_CS_PIN (4)
38#define ETH_SCK_PORT (GPIOA)
39#define ETH_SCK_PIN (5)
40#define ETH_MISO_PORT (GPIOA)
41#define ETH_MISO_PIN (6)
42#define ETH_MOSI_PORT (GPIOA)
43#define ETH_MOSI_PIN (7)
44#define ETH_RST_PORT (GPIOE)
45#define ETH_RST_PIN (3)
46
47// MISC
48#define PWR_LOSS_PORT (GPIOE)
49#define PWR_LOSS_PIN (15)
50#define LOG_ENABLE_PORT (GPIOC)
51#define LOG_ENABLE_PIN (15)
52
53#define PER 1
54#define GREAT PER
55static_assert(PER == GREAT); // Long live daq loop
56
57#define SD_BLOCKING_TIMEOUT_MS (5000)
58constexpr TickType_t SD_BLOCKING_TIMEOUT_TICKS = pdMS_TO_TICKS(SD_BLOCKING_TIMEOUT_MS);
59
60extern SemaphoreHandle_t spi1_lock;
61extern volatile TaskHandle_t sd_task_handle; // ! handle to be pointed to by SDIO ISR for notifications
62
63void HardFault_Handler();
64
65#endif // MAIN_H
Wrapper macros for FreeRTOS constructs (tasks, queues, semaphores) to simplify static memory allocati...
Logging of received bus messages onto an SD card.
Custom SPMC designed for high throughput handling of CAN message streams.