proximity6  2.0.0.0
Main Page

Proximity 6 click

Proximity 6 click is a versatile proximity detection device on a Click boardâ„¢.

click Product page


Click library

  • Author : MikroE Team
  • Date : Dec 2019.
  • Type : I2C type

Software Support

We provide a library for the Proximity6 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for Proximity6 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void proximity6_cfg_setup ( proximity6_cfg_t *cfg );

  • Initialization function.

    PROXIMITY6_RETVAL proximity6_init ( proximity6_t *ctx, proximity6_cfg_t *cfg );

  • Click Default Configuration function.

    void proximity6_default_cfg ( proximity6_t *ctx );

Example key functions :

Examples Description

This application can detect the proximity of an object via sensor and can show the results of proximity as a graphic view, or show the position of the object.

The demo application is composed of two sections :

Application Init

Sets the registers in default state and configures the device to work in proper operating mode (Proximity Mode).

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "-|--|- Application Init -|--|-" );
// Click initialization.
PROXIMITY6_MAP_MIKROBUS( cfg, MIKROBUS_1 );
proximity6_init( &proximity6, &cfg );
Delay_ms( 300 );
proximity6_default_cfg( &proximity6 );
proximity6_load_settings( &proximity6 );
log_printf( &logger, "Proximity 6 is initialized\r\n\r\n");
Delay_ms( 300 );
}

Application Task

Example can show the data register values as graphic view in desired resolution. Also can determine from which side the object (body) affects on the sensor and logs results on USB UART. Results will be shown only when one or more data registers are updated with the new value (sensor detects the change).

void application_task ( void )
{
// Task implementation.
}

Note

void proximity6_logGraphicRes() - Function loggs on USB UART results from the data proximity registers as graphic view. void proximity6_logPositionRes() - Function loggs on USB UART the position of the object which affects of the sensor.

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Proximity6

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


proximity6_cfg_t
Click configuration structure definition.
Definition: proximity6.h:208
PROXIMITY6_MAP_MIKROBUS
#define PROXIMITY6_MAP_MIKROBUS(cfg, mikrobus)
Definition: proximity6.h:54
application_task
void application_task(void)
Definition: main.c:143
proximity6_cfg_setup
void proximity6_cfg_setup(proximity6_cfg_t *cfg)
Config Object Initialization function.
PROXIMITY6_PROXIMITY_MODE
#define PROXIMITY6_PROXIMITY_MODE
Definition: proximity6.h:151
proximity6_default_cfg
void proximity6_default_cfg(proximity6_t *ctx)
Click Default Configuration function.
proximity6_log_position_res
void proximity6_log_position_res(proximity6_t *ctx)
Definition: main.c:71
proximity6_load_settings
void proximity6_load_settings(proximity6_t *ctx)
Settings Load function.
proximity6_init
PROXIMITY6_RETVAL proximity6_init(proximity6_t *ctx, proximity6_cfg_t *cfg)
Initialization function.
application_init
void application_init(void)
Definition: main.c:109
proximity6_set_mode
uint8_t proximity6_set_mode(proximity6_t *ctx, uint8_t select_mode)
Mode Set function.