proximity10 2.0.0.0
main.c File Reference

Proximity10 Click example. More...

#include "board.h"
#include "log.h"
#include "proximity10.h"

Functions

void check_response (uint8_t cmd_resp)
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

Proximity10 Click example.

Description

This application enables proximity sensor to detect objects from distance up to 20cm.

The demo application is composed of two sections :

Application Init

Initializes I2C serial interface and performs a device wake up, reset and all necessary configurations. The device will wake up and performs measurements every 10 milliseconds.

Application Task

Reads the proximity PS1 data value and sends result to the uart terminal. If measured proximity value is greater than selected proximity threshold value, the interrupt will be generated and the message will be showed on the uart terminal. When interrupt is generated the Sound function will make an alarm sound with determined duration depending on the detected proximity value, how much is object away or close from the sensor.

note: Additional Functions :

  • checkResponse - Sends an error code message to the uart terminal if error code is detected in the response.
Author
MikroE Team

Function Documentation

◆ application_init()

void application_init ( void )

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 )

◆ check_response()

void check_response ( uint8_t cmd_resp)

◆ main()

int main ( void )