piezodriver 2.1.0.0
main.c File Reference

Piezo Driver Click example. More...

#include "board.h"
#include "log.h"
#include "piezodriver.h"

Macros

#define W   4*Q
 
#define H   2*Q
 
#define Q   250
 
#define E   Q/2
 
#define S   Q/4
 
#define VOLUME   100
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

Piezo Driver Click example.

Description

This example demonstrates the use of Piezo Driver Click board.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger.

Application Task

Plays the Imperial March melody. Also logs an appropriate message on the USB UART.

Note
The minimal PWM Clock frequency required for this example is the frequency of tone C6 - 1047 Hz. In order to run this example and play all tones correctly, the user will need to decrease the MCU's main clock frequency in MCU Settings for certain architectures in order to get the required PWM clock frequency.
Author
Stefan Ilic

Macro Definition Documentation

◆ E

#define E   Q/2

◆ H

#define H   2*Q

◆ Q

#define Q   250

◆ S

#define S   Q/4

◆ VOLUME

#define VOLUME   100

◆ W

#define W   4*Q

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 )