acc_exploration_server_stm32.c File Reference
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "main.h"
#include "acc_exploration_server_base.h"
#include "acc_exploration_server_stm32.h"
#include "acc_integration.h"
#include "acc_integration_log.h"

Go to the source code of this file.

Macros

#define MODULE   "exploration_server_stm32"
 
#define LOG_BUFFER_MAX_SIZE   150
 
#define STM32_EXPLORATION_SERVER_MAX_BAUDRATE   2000000
 
#define UART_DMA_BUFFER_SIZE   (8192)
 

Functions

static void uart_wait_for_tx_done (void)
 
static void write_to_client (const void *data, uint32_t size)
 Write data to client (UART) More...
 
static void restart_input (void)
 Restart input of new command. More...
 
static void set_baudrate (uint32_t baudrate)
 
static uint32_t get_tick (void)
 
void acc_exploration_server_stm32_init (const char *hw, char *buffer, size_t buffer_size)
 Init the stm32 exploration server. More...
 
void acc_exploration_server_stm32_main (void)
 Start the stm32 exploration server. More...
 
void HAL_UART_ErrorCallback (UART_HandleTypeDef *huart)
 
void HAL_UART_TxCpltCallback (UART_HandleTypeDef *h_uart)
 
void acc_integration_log (acc_log_level_t level, const char *module, const char *format,...)
 Log function. More...
 
int acconeer_main (int argc, char *argv[])
 Assembly test example. More...
 

Variables

UART_HandleTypeDef EXPLORATION_SERVER_UART_HANDLE
 
static char * command_buffer = NULL
 
static size_t command_buffer_size = 0
 
static volatile bool uart_tx_active = false
 
static uint8_t uart_dma_buffer [(8192)]
 
static char exploration_server_command_buffer [2048]
 
static const exploration_server_interface_t server_if
 Server interface functions. More...
 

Macro Definition Documentation

◆ LOG_BUFFER_MAX_SIZE

#define LOG_BUFFER_MAX_SIZE   150

Definition at line 23 of file acc_exploration_server_stm32.c.

◆ MODULE

#define MODULE   "exploration_server_stm32"

Definition at line 21 of file acc_exploration_server_stm32.c.

◆ STM32_EXPLORATION_SERVER_MAX_BAUDRATE

#define STM32_EXPLORATION_SERVER_MAX_BAUDRATE   2000000

Definition at line 25 of file acc_exploration_server_stm32.c.

◆ UART_DMA_BUFFER_SIZE

#define UART_DMA_BUFFER_SIZE   (8192)

Definition at line 33 of file acc_exploration_server_stm32.c.

Function Documentation

◆ acc_exploration_server_stm32_init()

void acc_exploration_server_stm32_init ( const char *  hw,
char *  buffer,
size_t  buffer_size 
)

Init the stm32 exploration server.

Parameters
[in]hwThe name of the hardware platform
[in]bufferThe buffer used for receiving commands from the client
[in]buffer_sizeThe size of the command buffer

Definition at line 142 of file acc_exploration_server_stm32.c.

◆ acc_exploration_server_stm32_main()

void acc_exploration_server_stm32_main ( void  )

Start the stm32 exploration server.

The embedded exploration server for STM32 can stream UART input data directly into the input buffer.

Setup DMA into buffer with buffer_size.

Definition at line 150 of file acc_exploration_server_stm32.c.

◆ acc_integration_log()

void acc_integration_log ( acc_log_level_t  level,
const char *  module,
const char *  format,
  ... 
)

Log function.

This log function can be used as a complement to for example printf. It adds useful information to the log such as time and log level

Parameters
[in]levelThe severity level for the log
[in]moduleThe name of the SW module from where the log is called
[in]formatThe information to be logged, same format as for printf

Definition at line 220 of file acc_exploration_server_stm32.c.

◆ acconeer_main()

int acconeer_main ( int  argc,
char *  argv[] 
)

Assembly test example.

Surface velocity example application.

Tank level reference application.

Smart presence reference application.

Breathing example application.

Service subsweeps example.

Service multple configurations example.

Low power service example.

Service example.

Processing subtract adaptive background example.

Processing static presence example.

Processing peak interpolation example.

Processing noncoherent mean example.

Processing coherent mean example.

Processing amplitude example.

Detector presence example with multiple configurations.

Low power detector presence example.

Detector presence example.

Distance detector low power example.

Detector distance example.

Control helper example.

Returns
Returns EXIT_SUCCESS if successful, otherwise EXIT_FAILURE

Test if measure on wake up is enable Do a measurement if the the detector is ready (configured and calibrated)

Definition at line 245 of file acc_exploration_server_stm32.c.

◆ get_tick()

static uint32_t get_tick ( void  )
static

Definition at line 123 of file acc_exploration_server_stm32.c.

◆ HAL_UART_ErrorCallback()

void HAL_UART_ErrorCallback ( UART_HandleTypeDef *  huart)

Definition at line 198 of file acc_exploration_server_stm32.c.

◆ HAL_UART_TxCpltCallback()

void HAL_UART_TxCpltCallback ( UART_HandleTypeDef *  h_uart)

Definition at line 211 of file acc_exploration_server_stm32.c.

◆ restart_input()

static void restart_input ( void  )
static

Restart input of new command.

Stop previous reception Clear buffer Re-start receive after a line has been received.

Definition at line 92 of file acc_exploration_server_stm32.c.

◆ set_baudrate()

static void set_baudrate ( uint32_t  baudrate)
static

Definition at line 106 of file acc_exploration_server_stm32.c.

◆ uart_wait_for_tx_done()

static void uart_wait_for_tx_done ( void  )
static

Definition at line 41 of file acc_exploration_server_stm32.c.

◆ write_to_client()

static void write_to_client ( const void *  data,
uint32_t  size 
)
static

Write data to client (UART)

Parameters
[in]datapointer to data
[in]sizedata size in bytes
Returns
true if successful

Definition at line 68 of file acc_exploration_server_stm32.c.

Variable Documentation

◆ command_buffer

char* command_buffer = NULL
static

Definition at line 29 of file acc_exploration_server_stm32.c.

◆ command_buffer_size

size_t command_buffer_size = 0
static

Definition at line 30 of file acc_exploration_server_stm32.c.

◆ exploration_server_command_buffer

char exploration_server_command_buffer[2048]
static

Definition at line 38 of file acc_exploration_server_stm32.c.

◆ EXPLORATION_SERVER_UART_HANDLE

UART_HandleTypeDef EXPLORATION_SERVER_UART_HANDLE

◆ server_if

const exploration_server_interface_t server_if
static
Initial value:
= {
.write = write_to_client,
.restart_input = restart_input,
.set_baudrate = set_baudrate,
.max_baudrate = 2000000 ,
.get_tick = get_tick,
.ticks_per_second = 1000,
}

Server interface functions.

Definition at line 132 of file acc_exploration_server_stm32.c.

◆ uart_dma_buffer

uint8_t uart_dma_buffer[(8192)]
static

Definition at line 36 of file acc_exploration_server_stm32.c.

◆ uart_tx_active

volatile bool uart_tx_active = false
static

Definition at line 35 of file acc_exploration_server_stm32.c.

set_baudrate
static void set_baudrate(uint32_t baudrate)
Definition: acc_exploration_server_stm32.c:106
get_tick
static uint32_t get_tick(void)
Definition: acc_exploration_server_stm32.c:123
restart_input
static void restart_input(void)
Restart input of new command.
Definition: acc_exploration_server_stm32.c:92
write_to_client
static void write_to_client(const void *data, uint32_t size)
Write data to client (UART)
Definition: acc_exploration_server_stm32.c:68