iSensor-SPI-Buffer  1.15
Firmware for the iSensor-SPI-Buffer board to enable full throughput buffered data capture on Analog Devices IMUs
main.h
Go to the documentation of this file.
1 
11 /* Define to prevent recursive inclusion -------------------------------------*/
12 #ifndef __MAIN_H
13 #define __MAIN_H
14 
15 /* Header includes require for prototypes */
16 #include "stm32f3xx_hal.h"
17 
18 /* Public function prototypes */
19 
20 /* @cond DOXYGEN_IGNORE */
21 void Main_Error_Handler();
22 /* @endcond */
23 
25 typedef enum
26 {
27  false = 0,
28  true = 1
29 }bool;
30 
32 #define STATE_CHECK_FLAGS 0
33 
35 #define STATE_CHECK_PPS 1
36 
38 #define STATE_READ_ADC 2
39 
41 #define STATE_CHECK_USB 3
42 
44 #define STATE_CHECK_STREAM 4
45 
47 #define STATE_STEP_SCRIPT 5
48 
49 /* Public variables exported from module */
50 extern DMA_HandleTypeDef g_dma_spi1_rx;
51 extern DMA_HandleTypeDef g_dma_spi1_tx;
52 extern DMA_HandleTypeDef g_dma_spi2_tx;
53 extern SPI_HandleTypeDef g_spi1;
54 extern SPI_HandleTypeDef g_spi2;
55 
56 #endif /* __MAIN_H */
Flash_Fault_Log_Init
void Flash_Fault_Log_Init()
Initialize flash error logging.
Definition: flash.c:221
STATE_CHECK_PPS
#define STATE_CHECK_PPS
Definition: main.h:35
IMU_SPI_Init
void IMU_SPI_Init()
SPI1 Initialization Function (master SPI port to IMU)
Definition: imu.c:38
reg.h
Header file for iSensor-SPI-Buffer register interfacing module.
Script_Check_Stream
void Script_Check_Stream()
Check the stream status.
Definition: script.c:151
SystemClock_Config
static void SystemClock_Config()
System Clock Configuration.
Definition: main.c:328
Timer_Init
void Timer_Init()
Initialize all timers for operation.
Definition: timer.c:47
g_dma_spi2_tx
DMA_HandleTypeDef g_dma_spi2_tx
Definition: main.c:43
dfu.h
Header file for iSensor-SPI-Buffer runtime firmware upgrade module.
g_dma_spi1_tx
DMA_HandleTypeDef g_dma_spi1_tx
Definition: main.c:40
g_dma_spi1_rx
DMA_HandleTypeDef g_dma_spi1_rx
Definition: main.c:37
watchdog.h
Header file for iSensor-SPI-Buffer watchdog timer module.
DMA_Init
static void DMA_Init()
Init all DMA channels in use and configure DMA interrupts.
Definition: main.c:256
DIO_Validate_Input_Config
void DIO_Validate_Input_Config()
Validates the DIO_INPUT_CONFIG value.
Definition: dio.c:152
Reg_Buf_Dequeue_To_Outputs
void Reg_Buf_Dequeue_To_Outputs()
Dequeues an entry from the buffer and loads it to the primary output registers.
Definition: reg.c:158
user_spi.h
Header file for iSensor-SPI-Buffer user SPI (slave SPI) module.
bool
bool
Definition: main.h:26
g_spi1
SPI_HandleTypeDef g_spi1
Definition: main.c:46
g_user_burst_start
volatile uint32_t g_user_burst_start
Definition: user_spi.c:20
sd_card.h
Header file for iSensor-SPI-Buffer SD card interfacing and script execution module.
dio.h
Header file for iSensor-SPI-Buffer DIO interfacing module.
g_update_flags
volatile uint32_t g_update_flags
Definition: reg.c:32
USB_Rx_Handler
void USB_Rx_Handler()
Handler for received USB data.
Definition: usb.c:77
adc.h
Header file for iSensor-SPI-Buffer ADC module (for temp sensor and Vdd monitoring)
STATE_CHECK_FLAGS
#define STATE_CHECK_FLAGS
Definition: main.h:32
Flash_Log_Fault
void Flash_Log_Fault(uint32_t faultCode)
Stores an error code to flash memory.
Definition: flash.c:173
Watchdog_Feed
void Watchdog_Feed()
Feeds the watchdog timer. Should be called periodically from main loop.
Definition: watchdog.c:25
ADC_Update
void ADC_Update()
Read and scale ADC values then load to output registers.
Definition: adc.c:106
DFU_Check_Flags
void DFU_Check_Flags()
Checks if a reboot into the DFU bootloader is needed.
Definition: dfu.c:33
Watchdog_Check_Status
void Watchdog_Check_Status()
Check if system reset from independent watch dog timeout and sets the appropriate STATUS flag.
Definition: watchdog.c:35
g_dma_spi2_tx
DMA_HandleTypeDef g_dma_spi2_tx
Definition: main.c:43
MX_GPIO_Init
static void MX_GPIO_Init()
GPIO Initialization Function.
Definition: main.c:382
imu.h
Implementation for iSensor-SPI-Buffer IMU interfacing module.
SD_Card_Init
void SD_Card_Init()
Init SD card hardware interface and FATFs driver.
Definition: sd_card.c:98
timer.h
Header file for iSensor-SPI-Buffer timer module.
User_Interrupt_Update
void User_Interrupt_Update()
Updates the user interrupt (data ready) signal status.
Definition: user_interrupt.c:25
STATE_CHECK_STREAM
#define STATE_CHECK_STREAM
Definition: main.h:44
Flash_Check_Logged_Fault
void Flash_Check_Logged_Fault()
Checks for error codes which may have been logged to flash, and sets the status register bit.
Definition: flash.c:142
g_spi2
SPI_HandleTypeDef g_spi2
Definition: main.c:49
Data_Capture_Disable
void Data_Capture_Disable()
disables autonomous data capture by disabling DR ISR.
Definition: data_capture.c:53
usb.h
Header file for iSensor-SPI-Buffer USB command line register interface.
Reg_Init
void Reg_Init()
Initialize the register module by loading all saves values from flash.
Definition: reg.c:125
User_SPI_Update_Config
void User_SPI_Update_Config(uint32_t CheckUnlock)
Updates the slave SPI (SPI2) config based on the USER_SPI_CONFIG register.
Definition: user_spi.c:163
led.h
Header file for iSensor-SPI-Buffer LED control module.
buffer.h
Header file for iSensor-SPI-Buffer buffer data structure module.
Watchdog_Enable
void Watchdog_Enable(uint32_t timeout_ms)
Enables watch dog reset functionality.
Definition: watchdog.c:60
Main_Error_Handler
void Main_Error_Handler()
This function is executed in case of error occurrence.
Definition: main.c:233
DIO_Update_Output_Config
void DIO_Update_Output_Config()
Validates DIO_OUTPUT_CONFIG settings and applies to GPIO.
Definition: dio.c:291
user_interrupt.h
Header file for iSensor-SPI-Buffer user interrupt (data ready) config and generation functions.
state
static uint32_t state
Definition: main.c:52
g_dma_spi1_tx
DMA_HandleTypeDef g_dma_spi1_tx
Definition: main.c:40
g_dma_spi1_rx
DMA_HandleTypeDef g_dma_spi1_rx
Definition: main.c:37
main.h
Header file for iSensor-SPI-Buffer main.
Reg_Process_Command
void Reg_Process_Command()
Processes a command register write. This function is called from main loop.
Definition: reg.c:322
SD_Card_Script_Autorun
void SD_Card_Script_Autorun()
Run SD card script automatic execution process.
Definition: sd_card.c:118
g_spi2
SPI_HandleTypeDef g_spi2
Definition: main.c:49
ADC_Init
void ADC_Init()
ADC1 Initialization Function.
Definition: adc.c:40
Data_Capture_Enable
void Data_Capture_Enable()
Enables autonomous data capture by enabling DR ISR in NVIC.
Definition: data_capture.c:27
Timer_Check_PPS_Unlock
void Timer_Check_PPS_Unlock()
Check if the PPS signal is unlocked (greater than 1100ms since last PPS strobe)
Definition: timer.c:64
data_capture.h
Header file for iSensor-SPI-Buffer autonomous IMU data acquisition module.
STATE_READ_ADC
#define STATE_READ_ADC
Definition: main.h:38
STATE_STEP_SCRIPT
#define STATE_STEP_SCRIPT
Definition: main.h:47
IMU_Update_SPI_Config
void IMU_Update_SPI_Config()
Processes any changes to IMU_SPI_CONFIG reg and applies.
Definition: imu.c:294
STATE_CHECK_USB
#define STATE_CHECK_USB
Definition: main.h:41
g_spi1
SPI_HandleTypeDef g_spi1
Definition: main.c:46
script.h
Header file for iSensor-SPI-Buffer script module (loaded from SD card)
main
int main()
The application entry point.
Definition: main.c:59
SD_Card_Script_Step
void SD_Card_Script_Step()
Step the script execution process.
Definition: sd_card.c:234
DIO_Update_Input_Config
void DIO_Update_Input_Config()
Validates and updates the data ready input configuration based on DIO_INPUT_CONFIG.
Definition: dio.c:186
Buffer_Reset
void Buffer_Reset()
Clears the buffer data structure.
Definition: buffer.c:186
USB_Reset
void USB_Reset()
Toggle USB PU to force a re-enumeration on the host side.
Definition: usb.c:47
ERROR_INIT
#define ERROR_INIT
Definition: flash.h:39
flash.h
Header file for iSensor-SPI-Buffer flash memory interfacing functions.