opto7 2.1.0.0
main.c File Reference

Opto 7 Click Example. More...

#include "board.h"
#include "log.h"
#include "opto7.h"

Macros

#define EXAMPLE_GPIO   1
 
#define EXAMPLE_UART   2
 
#define DEMO_EXAMPLE   EXAMPLE_GPIO
 
#define TRANSMITTER
 
#define TX_MESSAGE   "Opto 7 Click Example \r\n"
 
#define APP_BUFFER_SIZE   500
 
#define PROCESS_BUFFER_SIZE   200
 

Functions

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

Detailed Description

Opto 7 Click Example.

Description

This example demonstrates the use of Opto 7 click board by processing the incoming data and displaying them on the USB UART.

The demo application is composed of two sections :

Application Init

Initialization of UART LOG and GPIO pin, and UART drivers.

Application Task

This example is made of two parts: GPIO Example - The output pin is toggled every 5 seconds and input pin state is being tracked. UART Example - Device assigned as transmitter is sending message and receiver is reading it and displaying it on USB UART.

Additional Function

  • static void opto7_clear_app_buf ( void )
  • static void opto7_log_app_buf ( void )
  • static err_t opto7_process ( opto7_t *ctx )
Author
Stefan Ilic

Macro Definition Documentation

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   500

◆ DEMO_EXAMPLE

#define DEMO_EXAMPLE   EXAMPLE_GPIO

◆ EXAMPLE_GPIO

#define EXAMPLE_GPIO   1

◆ EXAMPLE_UART

#define EXAMPLE_UART   2

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ TRANSMITTER

#define TRANSMITTER

◆ TX_MESSAGE

#define TX_MESSAGE   "Opto 7 Click Example \r\n"

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 )