bletiny 2.0.0.0
main.c File Reference

BLE TINY Click Example. More...

#include "board.h"
#include "log.h"
#include "bletiny.h"
#include "conversions.h"

Macros

#define PROCESS_BUFFER_SIZE   200
 Application receiver buffer size.
 
#define EXAMPLE_CMD_LEN   6
 

Enumerations

enum  bletiny_example_type_t { BLETINY_APP_CTRL , BLETINY_I2C_EXAMPLE , BLETINY_SPI_EXAMPLE }
 Application example type. More...
 
enum  bletiny_example_state_t { BLETINY_CONFIGURE_MASTER , BLETINY_CONFIGURE_SLAVE , BLETINY_EXAMPLE }
 Application example state. More...
 

Functions

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

Detailed Description

BLE TINY Click Example.

Description

This example reads and processes data from BLE TINY clicks. Application waits for connection with Click board with phone. Then checks its Coadless FW version and checks connected device. Then waits for command to be stored in it's memory on 0 slot. After that depending on the command stored it executes that type of example.

The demo application is composed of two sections :

Application Init

Initializes driver and resets device and seds Disconnect and Reset IO commands. Then it waits for the connection to device. When connected it sends commands to check Coadless FW, connected device, its BLE address and signal quality of connection. In the end it waits for command from its memory. After valid command is stored in memory on 0 slot it contines to Application Task.

Application Task

Executes one of thre application task selected in Application Init:I2C, SPI, APP. I2C example uses EEPROM Click board to write and read data of its memory. SPI example uses EEPROM 2 Click board to write and read data of its memory. APP example just reads UART data and logs it to UART Terminal.

Additional Function

  • static void bletiny_clear_app_buf ( void )
  • static err_t bletiny_process ( void )
  • static void bletiny_error_check( err_t error_flag );
  • static void bletiny_log_app_buf ( void );
  • static err_t bletiny_rsp_check ( void );
  • static void bletiny_example_init ( void );
  • static void bletiny_application_example ( void );
  • static void bletiny_i2c_example ( void );
  • static void bletiny_spi_example ( void );
Note
For this application you need to install Dialog's mobile application SmartConsole. This application I2C example is created using EEPROM Click board, and for SPI example EEPROM 2 Click board is used.
Author
Luka Filipovic

Macro Definition Documentation

◆ EXAMPLE_CMD_LEN

#define EXAMPLE_CMD_LEN   6

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

Application receiver buffer size.

Specified size of application receiver buffer.

Enumeration Type Documentation

◆ bletiny_example_state_t

Application example state.

Specified application example state.

Enumerator
BLETINY_CONFIGURE_MASTER 
BLETINY_CONFIGURE_SLAVE 
BLETINY_EXAMPLE 

◆ bletiny_example_type_t

Application example type.

Specified application example type.

Enumerator
BLETINY_APP_CTRL 
BLETINY_I2C_EXAMPLE 
BLETINY_SPI_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 )