lightranger13 2.2.0
Loading...
Searching...
No Matches
main.c File Reference

LightRanger 13 Click example. More...

#include "board.h"
#include "log.h"
#include "lightranger13.h"

Macros

#define FACTORY_CALIBRATION_DISABLE

Functions

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

Detailed Description

LightRanger 13 Click example.

Description

This application demonstrates the usage of the LightRanger 13 Click for distance measurement and monitoring.

The demo application is composed of two sections:

Application Init

Initializes the logger and LightRanger 13 Click with default configuration, displays device information, performs factory calibration (if enabled), and sets up distance measurement thresholds (1mm-1000mm) with persistence (5 consecutive times) to ensure reliable readings. It then starts the measurement process.

Application Task

Waits for the data ready interrupt signal, indicating a new measurement is available. Upon receiving the signal, it reads the distance and temperature data from the sensor and logs the values to USB UART.

Note
The factory calibration step can be enabled or disabled by commenting/uncommenting the FACTORY_CALIBRATION_DISABLE macro.
Author
Stefan Filipovic

Macro Definition Documentation

◆ FACTORY_CALIBRATION_DISABLE

#define FACTORY_CALIBRATION_DISABLE

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 )