aiwb212f 2.1.0.0
main.c File Reference

Ai-WB2-12F Click Example. More...

#include "board.h"
#include "log.h"
#include "aiwb212f.h"

Macros

#define EXAMPLE_TCP_UDP   0
 
#define EXAMPLE_BLE   1
 
#define DEMO_EXAMPLE   EXAMPLE_TCP_UDP
 
#define MESSAGE_CONTENT   "Ai-WB2-12F click board - demo example."
 
#define MESSAGE_LEN   "40"
 
#define REMOTE_IP   "77.46.162.162"
 
#define REMOTE_PORT   "51111"
 
#define WIFI_SSID   "MikroE Public"
 
#define WIFI_PWD   "mikroe.guest"
 
#define LED_RED_GPIO   "5"
 
#define LED_GREEN_GPIO   "6"
 
#define LED_BLUE_GPIO   "7"
 
#define APP_BUFFER_SIZE   200
 
#define PROCESS_BUFFER_SIZE   200
 
#define LED_STATE_ON   "1"
 
#define LED_STATE_OFF   "0"
 
#define WIFI_MODE   "1,0"
 
#define WIFI_CONNECTED   "+EVENT:WIFI_GOT_IP"
 
#define TCP_CLIENT   "4"
 
#define UDP_CLIENT   "2"
 
#define CON_ID   "1"
 
#define KEEP_ALIVE   "1"
 

Functions

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

Detailed Description

Ai-WB2-12F Click Example.

Description

This example demonstrates the use of Ai-WB2-12F click board by processing the incoming data and displaying them on the USB UART.

The demo application is composed of two sections :

Application Init

Initializes the driver, tests the communication, and after that restarts the device, and performs example configuration.

Application Task

Depending on the selected demo example, it sends a TCP/UDP echo server message and receives it or creates BLE Client which receives the messages from the connected device.

Additional Function

  • static void aiwb212f_clear_app_buf ( void )
  • static void aiwb212f_log_app_buf ( void )
  • static err_t aiwb212f_process ( aiwb212f_t *ctx )
  • static void aiwb212f_rsp_check ( void )
  • static void aiwb212f_error_check ( void )
  • static void aiwb212f_configure_for_example ( void )
  • static void aiwb212f_example ( void )
Note
We have used the BLE Scanner Android application for the BLE Example test and you can find it at the link: https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner
Author
Stefan Ilic

Macro Definition Documentation

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   200

◆ CON_ID

#define CON_ID   "1"

◆ DEMO_EXAMPLE

#define DEMO_EXAMPLE   EXAMPLE_TCP_UDP

◆ EXAMPLE_BLE

#define EXAMPLE_BLE   1

◆ EXAMPLE_TCP_UDP

#define EXAMPLE_TCP_UDP   0

◆ KEEP_ALIVE

#define KEEP_ALIVE   "1"

◆ LED_BLUE_GPIO

#define LED_BLUE_GPIO   "7"

◆ LED_GREEN_GPIO

#define LED_GREEN_GPIO   "6"

◆ LED_RED_GPIO

#define LED_RED_GPIO   "5"

◆ LED_STATE_OFF

#define LED_STATE_OFF   "0"

◆ LED_STATE_ON

#define LED_STATE_ON   "1"

◆ MESSAGE_CONTENT

#define MESSAGE_CONTENT   "Ai-WB2-12F click board - demo example."

◆ MESSAGE_LEN

#define MESSAGE_LEN   "40"

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ REMOTE_IP

#define REMOTE_IP   "77.46.162.162"

◆ REMOTE_PORT

#define REMOTE_PORT   "51111"

◆ TCP_CLIENT

#define TCP_CLIENT   "4"

◆ UDP_CLIENT

#define UDP_CLIENT   "2"

◆ WIFI_CONNECTED

#define WIFI_CONNECTED   "+EVENT:WIFI_GOT_IP"

◆ WIFI_MODE

#define WIFI_MODE   "1,0"

◆ WIFI_PWD

#define WIFI_PWD   "mikroe.guest"

◆ WIFI_SSID

#define WIFI_SSID   "MikroE Public"

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 )