ryb080i 2.1.0.0
Loading...
Searching...
No Matches
main.c File Reference

RYB080I Click Example. More...

#include "board.h"
#include "log.h"
#include "ryb080i.h"

Macros

#define MESSAGE_CONTENT   "RYB080I Click board - demo example."
 
#define DEVICE_NAME   "RYB080I Click"
 
#define APP_BUFFER_SIZE   600
 
#define PROCESS_BUFFER_SIZE   200
 
#define READ_RESPONSE_TIMEOUT_MS   30000
 
#define FULL_POWER_MODE   "0"
 
#define BT_TERMINAL_TIMEOUT_MS   60000
 
#define BT_TERMINAL_MESSAGE_FREQ_MS   5000
 
#define TERMINATION_CMD   "END"
 
#define TERMINATION_RESPONSE   "END command received, the connection will be terminated in a few seconds."
 
#define TERMINATION_TIMEOUT   "Timeout, closing the connection in a few seconds."
 
#define NEW_LINE_STRING   "\r\n"
 
#define DISCONNECT_ALL_PEERS   "0"
 

Enumerations

enum  ryb080i_app_state_t { RYB080I_POWER_UP = 1 , RYB080I_CONFIG_EXAMPLE , RYB080I_EXAMPLE }
 Example states. More...
 

Functions

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

Detailed Description

RYB080I Click Example.

Description

This example demonstrates the use of RYB080I Click board by processing data from a connected BT device.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger.

Application Task

Application task is split in few stages:

  • RYB080I_POWER_UP: Powers up the device and reads the system information.
  • RYB080I_CONFIG_EXAMPLE: Sets the BT device name and enables the full power mode.
  • RYB080I_EXAMPLE: Performs a BT terminal example by processing all data from connected BT devices and sending back an adequate response messages.

Additional Function

  • static void ryb080i_clear_app_buf ( void )
  • static void ryb080i_log_app_buf ( void )
  • static err_t ryb080i_process ( ryb080i_t *ctx )
  • static err_t ryb080i_read_response ( ryb080i_t *ctx, uint8_t *rsp )
  • static err_t ryb080i_power_up ( ryb080i_t *ctx )
  • static err_t ryb080i_config_example ( ryb080i_t *ctx )
  • static err_t ryb080i_example ( ryb080i_t *ctx )
Note
We have used the Serial Bluetooth Terminal smartphone application for the test. A smartphone and the Click board must be paired to exchange messages.
Author
Stefan Filipovic

Macro Definition Documentation

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   600

◆ BT_TERMINAL_MESSAGE_FREQ_MS

#define BT_TERMINAL_MESSAGE_FREQ_MS   5000

◆ BT_TERMINAL_TIMEOUT_MS

#define BT_TERMINAL_TIMEOUT_MS   60000

◆ DEVICE_NAME

#define DEVICE_NAME   "RYB080I Click"

◆ DISCONNECT_ALL_PEERS

#define DISCONNECT_ALL_PEERS   "0"

◆ FULL_POWER_MODE

#define FULL_POWER_MODE   "0"

◆ MESSAGE_CONTENT

#define MESSAGE_CONTENT   "RYB080I Click board - demo example."

◆ NEW_LINE_STRING

#define NEW_LINE_STRING   "\r\n"

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ READ_RESPONSE_TIMEOUT_MS

#define READ_RESPONSE_TIMEOUT_MS   30000

◆ TERMINATION_CMD

#define TERMINATION_CMD   "END"

◆ TERMINATION_RESPONSE

#define TERMINATION_RESPONSE   "END command received, the connection will be terminated in a few seconds."

◆ TERMINATION_TIMEOUT

#define TERMINATION_TIMEOUT   "Timeout, closing the connection in a few seconds."

Enumeration Type Documentation

◆ ryb080i_app_state_t

Example states.

Predefined enum values for application example state.

Enumerator
RYB080I_POWER_UP 
RYB080I_CONFIG_EXAMPLE 
RYB080I_EXAMPLE 

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 )