wirelesssun 2.1.0.0
main.c File Reference

Wireless SUN Click Example. More...

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

Macros

#define DEMO_APP_BORDER
 
#define DEVICE_NETWORK_NAME   "\"Wireless SUN click\""
 
#define DEMO_TEXT_MESSAGE   "MikroE - Wireless SUN click board"
 
#define PROCESS_BUFFER_SIZE   600
 
#define FSTAT_OPERATIONAL   "fstat 5(OPERATIONAL)"
 
#define FMNG_JOIN_STATE_5   "FMng: changed fan join state (4 -> 5)"
 
#define GBL_ADDRESS_START   "GBL<"
 
#define GBL_ADDRESS_END   ">"
 

Functions

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

Detailed Description

Wireless SUN Click Example.

Description

This example demonstrates the use of Wireless SUN click board by showing the communication between the two click boards configured as BORDER and ROUTER.

The demo application is composed of two sections :

Application Init

Initializes the driver and configures the click board by performing a hardware reset and a clear parameters feature, and setting the device network name, device role to BORDER or ROUTER depending on the application mode. In the end, it saves settings and reboots device.

Application Task

Depending on the selected application mode, it reads all the received data and parses the received TCP/UDP messages (BORDER mode) or waits for the connection, reads the parent global address, and then starts sending a desired TCP/UDP messages to the parent every 3 seconds (ROUTER mode).

Additional Function

  • static void wirelesssun_clear_app_buf ( void )
  • static err_t wirelesssun_process ( void )
  • static err_t wirelesssun_rsp_check ( void )
  • static void wirelesssun_wait_for_connection ( void )
  • static void wirelesssun_get_parent_gbl_address ( uint8_t *gbl_addr )
Note
By default, the BORDER application mode is selected. comment out the DEMO_APP_BORDER macro definition in order to switch the application mode to ROUTER.
Author
Stefan Filipovic

Macro Definition Documentation

◆ DEMO_APP_BORDER

#define DEMO_APP_BORDER

◆ DEMO_TEXT_MESSAGE

#define DEMO_TEXT_MESSAGE   "MikroE - Wireless SUN click board"

◆ DEVICE_NETWORK_NAME

#define DEVICE_NETWORK_NAME   "\"Wireless SUN click\""

◆ FMNG_JOIN_STATE_5

#define FMNG_JOIN_STATE_5   "FMng: changed fan join state (4 -> 5)"

◆ FSTAT_OPERATIONAL

#define FSTAT_OPERATIONAL   "fstat 5(OPERATIONAL)"

◆ GBL_ADDRESS_END

#define GBL_ADDRESS_END   ">"

◆ GBL_ADDRESS_START

#define GBL_ADDRESS_START   "GBL<"

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   600

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 )