ninaw152  2.1.0.0
Macros | Enumerations | Functions
main.c File Reference

NINA-W152 Click Example. More...

#include "board.h"
#include "log.h"
#include "ninaw152.h"

Macros

#define EXAMPLE_WIFI   0
 
#define EXAMPLE_BT   1
 
#define DEMO_EXAMPLE   EXAMPLE_WIFI
 
#define WIFI_SSID   "MikroE Public"
 
#define WIFI_PASSWORD   "mikroe.guest"
 
#define REMOTE_IP   "77.46.162.162"
 
#define REMOTE_PORT   "51111"
 
#define MESSAGE_CONTENT   "NINA-W152 click board - demo example."
 
#define APP_BUFFER_SIZE   600
 
#define PROCESS_BUFFER_SIZE   200
 
#define READ_RESPONSE_TIMEOUT_MS   60000
 
#define WIFI_CONFIG_ID   "0"
 
#define WIFI_PARAM_TAG_SSID   "2"
 
#define WIFI_PARAM_TAG_AUTH   "5"
 
#define WIFI_PARAM_VAL1_WPA_WPA2_WPA3   "2"
 
#define WIFI_PARAM_TAG_PASSWORD   "8"
 
#define WIFI_ACTION_ACTIVATE   "3"
 
#define SCHEME_AT_TCP   "at-tcp"
 
#define SCHEME_AT_UDP   "at-udp"
 
#define DATA_FORMAT_STRING   "0"
 
#define DATA_FORMAT_BINARY   "2"
 

Enumerations

enum  ninaw152_app_state_t { NINAW152_POWER_UP = 1, NINAW152_CONFIGURE_CONNECTION, NINAW152_WAIT_FOR_CONNECTION, NINAW152_EXAMPLE }
 Example states. More...
 

Functions

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

Detailed Description

NINA-W152 Click Example.

Description

Application example shows device capability of connecting to a WiFi network and sending TCP/UDP messages to an echo server, or 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:

By default, the WiFi TCP/UDP example is selected.

Additional Function

Note
For the BT example, 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

◆ DATA_FORMAT_BINARY

#define DATA_FORMAT_BINARY   "2"

◆ DATA_FORMAT_STRING

#define DATA_FORMAT_STRING   "0"

◆ DEMO_EXAMPLE

#define DEMO_EXAMPLE   EXAMPLE_WIFI

◆ EXAMPLE_BT

#define EXAMPLE_BT   1

◆ EXAMPLE_WIFI

#define EXAMPLE_WIFI   0

◆ MESSAGE_CONTENT

#define MESSAGE_CONTENT   "NINA-W152 click board - demo example."

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ READ_RESPONSE_TIMEOUT_MS

#define READ_RESPONSE_TIMEOUT_MS   60000

◆ REMOTE_IP

#define REMOTE_IP   "77.46.162.162"

◆ REMOTE_PORT

#define REMOTE_PORT   "51111"

◆ SCHEME_AT_TCP

#define SCHEME_AT_TCP   "at-tcp"

◆ SCHEME_AT_UDP

#define SCHEME_AT_UDP   "at-udp"

◆ WIFI_ACTION_ACTIVATE

#define WIFI_ACTION_ACTIVATE   "3"

◆ WIFI_CONFIG_ID

#define WIFI_CONFIG_ID   "0"

◆ WIFI_PARAM_TAG_AUTH

#define WIFI_PARAM_TAG_AUTH   "5"

◆ WIFI_PARAM_TAG_PASSWORD

#define WIFI_PARAM_TAG_PASSWORD   "8"

◆ WIFI_PARAM_TAG_SSID

#define WIFI_PARAM_TAG_SSID   "2"

◆ WIFI_PARAM_VAL1_WPA_WPA2_WPA3

#define WIFI_PARAM_VAL1_WPA_WPA2_WPA3   "2"

◆ WIFI_PASSWORD

#define WIFI_PASSWORD   "mikroe.guest"

◆ WIFI_SSID

#define WIFI_SSID   "MikroE Public"

Enumeration Type Documentation

◆ ninaw152_app_state_t

Example states.

Predefined enum values for application example state.

Enumerator
NINAW152_POWER_UP 
NINAW152_CONFIGURE_CONNECTION 
NINAW152_WAIT_FOR_CONNECTION 
NINAW152_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  )