waveform4 2.0.0.0
main.c File Reference

Waveform4 Click example. More...

#include "board.h"
#include "log.h"
#include "waveform4.h"

Macros

#define GAIN_STEP   0.05
 
#define FREQ_STEP   100
 

Functions

void waveform4_display_commands (void)
 Waveform 4 display commands function.
 
err_t waveform4_parse_command (uint8_t command)
 Waveform 4 parse command function.
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Variables

uint32_t freq = WAVEFORM4_DEFAULT_FREQUENCY
 
float gain = WAVEFORM4_DEFAULT_GAIN
 
uint8_t channel = WAVEFORM4_CHANNEL_1
 
uint8_t wave = WAVEFORM4_WAVE_SINE
 

Detailed Description

Waveform4 Click example.

Description

This example demonstrates the use of Waveform 4 click board.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which resets the registers and sets the sine wave output with default gain and default frequency for all channels. After that it displays the list of supported commands on the USB UART.

Application Task

Depending on the command character received from USB UART it changes the signal frequency, gain or wave of the selected channel.

Author
Stefan Filipovic

Macro Definition Documentation

◆ FREQ_STEP

#define FREQ_STEP   100

◆ GAIN_STEP

#define GAIN_STEP   0.05

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )

◆ waveform4_display_commands()

void waveform4_display_commands ( void )

Waveform 4 display commands function.

This function displays the list of supported commands on the USB UART.

Returns
None.
Note
None.

◆ waveform4_parse_command()

err_t waveform4_parse_command ( uint8_t command)

Waveform 4 parse command function.

This function checks if the input command is supported and executes it.

Parameters
[in]command: Command input, for more details refer to waveform4_display_commands function.
Returns
  • 0 - Success,
  • -1 - Wrong command or command is not executed properly.
See #err_t definition for detailed explanation.
Note
None.

Variable Documentation

◆ channel

uint8_t channel = WAVEFORM4_CHANNEL_1

◆ freq

uint32_t freq = WAVEFORM4_DEFAULT_FREQUENCY

◆ gain

float gain = WAVEFORM4_DEFAULT_GAIN

◆ wave

uint8_t wave = WAVEFORM4_WAVE_SINE