smoke2 2.0.0.0
main.c File Reference

Smoke2 Click example. More...

#include "board.h"
#include "log.h"
#include "smoke2.h"

Macros

#define EXAMPLE_MODE_SMOKE   0
 
#define EXAMPLE_MODE_PROXIMITY   1
 
#define EXAMPLE_MODE   EXAMPLE_MODE_SMOKE
 

Functions

void smoke_example (smoke2_t *ctx)
 Smoke 2 Smoke example.
 
void proximity_example (void)
 Smoke 2 Proximity example.
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

Smoke2 Click example.

Description

This example is made to see how Smoke 2 clicks work. The purpose of this example is that, depending on the way we choose, it collects data from the external environment about smoke, processes it, and prints it via the UART terminal.

The demo application is composed of two sections :

Application Init

Initialization of communication modules, additional pins, Mapping pins and configures device for measurement.

Application Task

Example shows module working depending on example mode. We can choose between: EXAMPLE_MODE_PROXIMITY and EXAMPLE_MODE_SMOKE.

Additional Functions :

  • void smoke_example ( smoke2_t *ctx ) - Example checks if sensor data goes over threshold set.
  • void proximity_example ( void ) - Reads sensor data and logs it.
Author
Jelena Milosavljevic

Macro Definition Documentation

◆ EXAMPLE_MODE

#define EXAMPLE_MODE   EXAMPLE_MODE_SMOKE

◆ EXAMPLE_MODE_PROXIMITY

#define EXAMPLE_MODE_PROXIMITY   1

◆ EXAMPLE_MODE_SMOKE

#define EXAMPLE_MODE_SMOKE   0

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 )

◆ proximity_example()

void proximity_example ( void )

Smoke 2 Proximity example.

This function reads sensor data and logs it.

◆ smoke_example()

void smoke_example ( smoke2_t * ctx)

Smoke 2 Smoke example.

This function checks if sensor data is gone over thershold set.