Firmware Routines AOS Firmware - OUWECAD/MOWE GitHub Wiki
Table of Contents
AOS
Peripheral Drivers
aos_pd_adc.c
aos_pd_dma.c
aos_pd_gpio.c
aos_pd_usart.c
aos_pd_tim.c
aos_pd_stm32f0xx_it.c
Module Drivers
Inter-array Communication
Command Line Parser
AOS
aos.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| AOS_init | void |
void |
AOS Initialization | global | Needs improvement |
| AOS_run | void |
void |
AOS Core | global | Ready |
| SystemClock_Config | void |
void |
System Clock Configuration | global | Ready |
| assert_failed | uint8_t* file,uint32_t line |
void |
Reports the name of the source file and the source line number where the assert_param error has occurred | global | Not used |
Peripheral Drivers
aos_pd_adc.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| MX_ADC_Init | void |
void |
ADC init | global | Ready |
| HAL_ADC_MspInit | ADC_HandleTypeDef* hadc |
void |
ADC GPIO & clock init | global | Ready |
| HAL_ADC_MspDeInit | ADC_HandleTypeDef* hadc |
void |
ADC GPIO & clock deinit | global | Ready |
aos_pd_dma.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| MX_DMA_Init | void |
void |
DMA init and enable DMA clock | global | Ready |
| MX_DMA_PORT_FE_Init | void |
void |
Port - Front-end DMA init | local | Ready |
| MX_DMA_PORT_FE_Setup | UART_HandleTypeDef* huart |
void |
Port - Front-end DMA setup | global | Ready |
| MX_DMA_PORT_MEM1_Init | void |
void |
Port - Memory 1 DMA init | global | Ready |
| MX_DMA_PORT_MEM1_Setup | UART_HandleTypeDef* huart,uint8_t num,uint8_t start |
void |
Port - Memory 1 DMA setup | global | Ready |
| MX_DMA_PORT_MEM2_Init | void |
void |
Port - Memory 2 DMA init | global | Ready |
| MX_DMA_PORT_MEM2_Setup | UART_HandleTypeDef* huart,uint8_t num,uint8_t start |
void |
Port - Memory 2 DMA setup | global | Ready |
| MX_DMA_PORT_MEM3_Init | void |
void |
Port - Memory 3 DMA init | global | Ready |
| MX_DMA_PORT_MEM3_Setup | UART_HandleTypeDef* huart,uint8_t num,uint8_t start |
void |
Port - Memory 3 DMA setup | global | Ready |
| MX_DMA_PORT_MEM4_Init | void |
void |
Port - Memory 4 DMA init | global | Ready |
| MX_DMA_PORT_MEM4_Setup | UART_HandleTypeDef* huart,uint8_t num,uint8_t start |
void |
Port - Memory 4 DMA setup | global | Ready |
| MX_DMA_PORT_MEM5_Init | void |
void |
Port - Memory 5 DMA init | global | Ready |
| MX_DMA_PORT_MEM5_Setup | UART_HandleTypeDef* huart,uint8_t num,uint8_t start |
void |
Port - Memory 5 DMA setup | global | Ready |
| MX_DMA_PORT_MEM6_Init | void |
void |
Port - Memory 6 DMA init | global | Ready |
| MX_DMA_PORT_MEM6_Setup | UART_HandleTypeDef* huart,uint8_t num,uint8_t start |
void |
Port - Memory 6 DMA setup | global | Ready |
| MX_DMA_MEM_FE_Init | void |
void |
Memory - Front-end DMA init | local | Not implemented |
| MX_DMA_PORT_PORT_LINK1_Init | void |
void |
Port - Port DMA init - Link 1 | global | Ready |
| MX_DMA_PORT_PORT_LINK1_Setup | UART_HandleTypeDef* huartSrc,UART_HandleTypeDef* huartDst |
void |
Port - Port DMA setup - Link 1 | global | Ready |
| MX_DMA_PORT_PORT_LINK2_Init | void |
void |
Port - Port DMA init - Link 2 | global | Ready |
| MX_DMA_PORT_PORT_LINK2_Setup | UART_HandleTypeDef* huartSrc,UART_HandleTypeDef* huartDst |
void |
Port - Port DMA setup - Link 2 | global | Ready |
| MX_DMA_PORT_PORT_LINK3_Init | void |
void |
Port - Port DMA init - Link 3 | global | Ready |
| MX_DMA_PORT_PORT_LINK3_Setup | UART_HandleTypeDef* huartSrc,UART_HandleTypeDef* huartDst |
void |
Port - Port DMA setup - Link 3 | global | Ready |
| MX_DMA_PORT_PORT_LINK4_Init | void |
void |
Port - Port DMA init - Link 4 | global | Ready |
| MX_DMA_PORT_PORT_LINK4_Setup | UART_HandleTypeDef* huartSrc,UART_HandleTypeDef* huartDst |
void |
Port - Port DMA setup - Link 4 | global | Ready |
| MX_DMA_PORT_PORT_LINK5_Init | void |
void |
Port - Port DMA init - Link 5 | global | Ready |
| MX_DMA_PORT_PORT_LINK5_Setup | UART_HandleTypeDef* huartSrc,UART_HandleTypeDef* huartDst |
void |
Port - Port DMA setup - Link 5 | global | Ready |
| MX_DMA_PORT_PORT_LINK6_Init | void |
void |
Port - Port DMA init - Link 6 | global | Ready |
| MX_DMA_PORT_PORT_LINK6_Setup | UART_HandleTypeDef* huartSrc,UART_HandleTypeDef* huartDst |
void |
Port - Port DMA setup - Link 6 | global | Ready |
| disableDMAport | uint8_t port |
void |
Disable DMA stream on one of the module ports | global | Ready |
| disableDMAISR | uint8_t port |
void |
Disable DMA UART interrupts | global | Ready |
| startDMAport | uint8_t port,uint8_t size |
void |
Start a DMA stream on one of the module ports | global | Ready |
aos_pd_gpio.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| MX_GPIO_Init | void |
void |
GPIO init and enable GPIO clock | global | Ready |
| IND_LED_Init | void |
void |
Configure indicator LED | local | Ready |
| IND_LED_Init | void |
void |
Configure front-end LED | local | Ready |
aos_pd_usart.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| MX_UART_Init | void |
void |
USARTs init | global | Ready |
| MX_USART1_UART_Init | void |
void |
USART1 init | global | Ready |
| MX_USART2_UART_Init | void |
void |
USART2 init | global | Ready |
| MX_USART3_UART_Init | void |
void |
USART3 init | global | Ready |
| MX_USART4_UART_Init | void |
void |
USART4 init | global | Ready |
| MX_USART5_UART_Init | void |
void |
USART5 init | global | Ready |
| MX_USART6_UART_Init | void |
void |
USART6 init | global | Ready |
| MX_USART7_UART_Init | void |
void |
USART7 init | global | Ready |
| MX_USART8_UART_Init | void |
void |
USART8 init | global | Ready |
| HAL_UART_MspInit | UART_HandleTypeDef* huart |
void |
Configure USARTs GPIO, NVIC and clock | global | Ready |
aos_pd_tim.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| MX_TIM3_Init | void |
void |
TIM3 init function - Front-end LED PWM 16-bit | global | Ready |
| MX_TIM2_Init | void |
void |
TIM2 init function - Periodic event timebase 32-bit | global | Ready |
| MX_TIM7_Init | void |
void |
TIM7 init function - 1 usec timebase 16-bit | global | Ready |
| HAL_TIM_Base_MspInit | TIM_HandleTypeDef* htim_base |
void |
Configure Timers GPIO, NVIC and clock | global | Ready |
| HAL_TIM_PWM_MspInit | TIM_HandleTypeDef* htim_pwm |
void |
Configure Timers PWM GPIO, NVIC and clock | global | Ready |
| HAL_TIM_Base_MspDeInit | TIM_HandleTypeDef* htim_base |
void |
Deinit Timers GPIO, NVIC and clock | global | Ready |
| HAL_TIM_PWM_MspDeInit | TIM_HandleTypeDef* htim_pwm |
void |
Deinit Timers PWM GPIO, NVIC and clock | global | Ready |
| startMicroDelay | uint16_t Delay |
void |
Load and start micro-second delay counter | global | Ready |
| startPerEvent | uint32_t rateFactor |
void |
Load and start periodic event counter | global | Ready |
aos_pd_stm32f0xx_it.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| HAL_MspInit | void |
void |
Initializes the Global MSP | global | Ready |
| SysTick_Handler | void |
void |
This function handles System tick timer | global | Ready |
| nblkTimoutRoutine | void |
void |
Non-blocking timeout processing | local | Ready |
| DMA1_Ch1_IRQHandler | void |
void |
This function handles DMA1 channel 1 interrupt | global | Ready |
| DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler | void |
void |
This function handles DMA1 channel 2 to 3 and DMA2 channel 1 to 2 interrupts | global | Ready |
| DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler | void |
void |
This function handles DMA1 channel 4 to 7 and DMA2 channel 3 to 5 interrupts | global | Ready |
| TIM7_IRQHandler | void |
void |
This function handles TIM7 global interrupt. (1 usec timebase) | global | Ready |
| TIM2_IRQHandler | void |
void |
This function handles TIM2 global interrupt. (periodic event timebase) | global | Ready |
| TIM3_IRQHandler | void |
void |
This function handles TIM3 global interrupt. (Front-end LED PWM) | Ready | |
| USART1_IRQHandler | void |
void |
This function handles USART1 global interrupt (combined with EXTI line 25 interrupt) | global | Ready |
| USART2_IRQHandler | void |
void |
This function handles USART2 global interrupt (combined with EXTI line 26 interrupt) | global | Ready |
| USART3_8_IRQHandler | void |
void |
This function handles USART3 to USART8 global interrupts (combined with EXTI line 28 interrupt) | global | Ready |
| HAL_UART_RxCpltCallback | UART_HandleTypeDef *huart |
void |
Rx Transfer completed callback | global | Ready |
Module Drivers
aos_md_dbase.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| getID | char* alias |
uint16_t ID |
Retrieve module ID from its alias | global | Ready |
| checkMyName | void |
void |
Check my own Name and ID | global | Ready |
| checkNumOfReceivers | void |
void |
Check number of receivers in the array | global | Ready |
aos_md_fe.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| samplePD | void |
uint16_t value |
Read one sample from the photo diode | global | Ready |
| pingOK | uint16_t originID |
void |
This module was pinged | global | Ready |
| pingAllDisp | void |
void |
Display ping results from all receiver modules | global | Ready |
| samOK | uint16_t originID |
void |
This module was sampled | global | Ready |
| sampleAllDisp | void |
void |
Display collected samples from all receiver modules | global | Ready |
| readOK | uint16_t originID,uint8_t led |
void |
This module was read | global | Ready |
| readAllDisp | void |
void |
Display read values from all receiver modules | global | Ready |
| startPWM_FE | uint16_t period','uint16_t width |
void |
Load and start FE PWM | global | Ready |
| stream | void |
void |
Stream front-end data in/out the module for read/write commands | global | Needs testing & optimization |
| streamToFE | uint8_t port |
void |
Local stream from port to front-end | global | Ready |
| writeToFE | uint8_t port |
void |
Local write from port to front-end | global | Ready |
| stream_FE_Port | uint8_t src |
uint8_t result |
FE-to-Port/Port-to-FE streaming | global | Needs testing & optimization |
| stream_Port_Port | uint8_t src,uint8_t dst |
uint8_t result |
Port-to-Port streaming | global | Ready |
Inter-array Communication
aos_iac_routing.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| sendPacket | uint8_t port,const char* text |
void |
Sending text via an array port (a single packet of 10 bytes) | global | Ready |
| send | uint8_t port, const char* text |
void |
Sending text via an array port (any size) | global | Ready |
| readPort | uint8_t port,uint16_t size |
void |
Read one of the array ports | global | Ready |
| getUart | uint8_t port |
UART_HandleTypeDef* huart |
Get the UART for a given port | global | Ready |
| getPort | UART_HandleTypeDef *huart |
UART_HandleTypeDef* huart |
Get the port for a given UART | global | Ready |
| mesSend | uint16_t src,uint16_t dst |
void |
Sending a message to another module | global | Ready |
| mesDispatch | void |
void |
Dispatch pending messages | global | Ready |
| parseMessage | uint8_t port |
void |
Parse messages from other modules | global | Needs optimization |
| pushMessage | uint8_t n_args,... |
void |
Push a message inside the dispatch message stack | global | Ready |
| findRoute | uint16_t sourceID,uint16_t desID |
uint8_t outPort |
Find the shortest route to a module using Dijkstra's algorithm | Ready | |
| minArr | uint16_t* arr,uint16_t* Q |
uint16_t ID |
Find the index of the minimum module in dist that is still unvisited | local | Ready |
| QnotEmpty | uint16_t* Q |
uint8_t result |
Check if Q is empty (all modules have been visited) | local | Ready |
| broadcast | uint16_t originID |
void |
Handling broadcast requests | global | Needs improvement |
Command Line Parser
aos_clp.c
| Routine | Input | Output | Description | Scope | Status |
|---|---|---|---|---|---|
| checkUser | void |
void |
Check if connected to user | global | Needs improvement |
| comInfo | void |
int result |
command : Array information | local | Needs improvement |
| comStatus | char* moduleName |
int result |
command : Module status | local | Ready |
| comHelp | void |
int result |
command : Available commands | local | Ready |
| comName | char* oldName,char* newName |
int result |
command : Name a module (alias) | local | Ready |
| comPing | char* moduleName |
int result |
command : Ping a module | local | Ready |
| comSample | char* moduleName |
int result |
command : Read one sample | local | Ready |
| comStream | char* moduleName,char* srcPort,char* dstPort |
int result |
command : Stream between two modules or between two ports in the same module | local | Needs testing and optimization |
| comRead | char* moduleName,char* par2,char* par3,char* par4 |
int result |
command : Read data from receiver | local | Ready |
| comWrite | char* moduleName,char* par2,char* par3,char* par4 |
int result |
command : Write data to transmitter | local | Needs testing |
| comOnOff | char* moduleName,uint8_t state |
int result |
command : Turn on/off a transmitter | local | Ready |
| comPulse | char* moduleName,char* par2 |
int result |
command : Pulse a transmitter in ms | local | Ready |
| comPWM | char* moduleName,char* par2,char* par3 |
int result |
command : Output a PWM signal on a transmitter in us | local | Ready |
| comStop | char* moduleName,char* par2 |
int result |
command : Stop reading/writing from/to a module | local | Needs testing and improvement |
| comPause | char* moduleName |
int result |
command : Pause reading/writing from/to a module | local | Needs testing and improvement |
| comResume | char* moduleName |
int result |
command : Resume reading/writing from/to a module | local | Needs testing and improvement |
| comFilter | char* par1,char* par2 |
int result |
command : Turn on/off the background noise filter | local | Not implemented |
| comSetZeroLevel | char* moduleName,char* value |
int result |
command : Set the zeros voltage level | local | Ready |
| comSetOneLevel | char* moduleName,char* value |
int result |
command : Set the ones voltage level | local | Ready |
| comLink | char par[8][10] |
int result |
command : Link multiple modules together | local | Not implemented |
| comUnlink | char* moduleRX,char* moduleTX |
int result |
command : Unlink two modules from each other | local | Not implemented |
| comGroup | char par[][10] |
int result |
command : Group multiple modules together | local | Not implemented |
| comRoute | char* sourceID,char* desID |
int result |
command : Calculate the shortest route between two modules using Dijkstra's algorithm | local | Ready |
| comReset | char* moduleName |
int result |
command : Reset a module | local | Ready |
| comRunBootloader | char* moduleName |
int result |
command : Force the module into bootloader mode | local | Needs to work with other modules and all modules |
| comSetPdMode | char* moduleName,char* value |
int result |
command : Set receiver photodiode mode for digital/analog | local | Ready |
| comSetLedMode | char* moduleName,char* par2,char* par3,char* par4 |
int result |
command : Set transmitter LED mode for digital/analog and binary/Ascii | local | Ready |
| comComFormat | char* value |
int result |
command : Set commands format (short/long) | local | Ready |
| receiveCommand | void |
void |
Receive user commands | global | Needs improvement |
| pushCommand | uint8_t port |
void |
Push the received command in the FIFO buffer | local | Ready |
| parseCommand | void |
int result |
Parse user commands | global | Ready |
| togglePrevCom | void |
void |
Toggle between last five commands | local | Ready |
| checkModuleName | char* name |
void |
Check module name or alias | local | Needs optimization |
| isNumeric | char* str |
int result |
Check if text value is numeric (integer or float) | global | Ready |
| welcomeMessage | void |
void |
Display a welcome message for the user | local | Ready |
| streamWarning | void |
char result |
Display a stream warning message for the user and record user input | local | Ready |
| sphereWarning | void |
char result |
Display a warning message for the user and record user input when streaming a sphere | local | Ready |
| moduleStatus | void |
void |
Display a description of current module status (Ports, DMAs) | local | Ready |