accel18 2.0.0.0
Accel 18 Click Driver

API for configuring and manipulating Accel 18 Click driver. More...

Topics

 Accel 18 Registers List
 List of registers of Accel 18 Click driver.
 
 Accel 18 Registers Settings
 Settings for registers of Accel 18 Click driver.
 
 Accel 18 MikroBUS Map
 MikroBUS pin mapping of Accel 18 Click driver.
 

Functions

void accel18_cfg_setup (accel18_cfg_t *cfg)
 Accel 18 configuration object setup function.
 
void accel18_drv_interface_selection (accel18_cfg_t *cfg, accel18_drv_t drv_sel)
 Accel 18 driver interface setup function.
 
err_t accel18_init (accel18_t *ctx, accel18_cfg_t *cfg)
 Accel 18 initialization function.
 
err_t accel18_default_cfg (accel18_t *ctx)
 Accel 18 default configuration function.
 
err_t accel18_generic_write (accel18_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 18 data writing function.
 
err_t accel18_byte_write (accel18_t *ctx, uint8_t reg, uint8_t data_in)
 Accel 18 byte writing function.
 
err_t accel18_generic_read (accel18_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 18 data reading function.
 
err_t accel18_byte_read (accel18_t *ctx, uint8_t reg, uint8_t *data_out)
 Accel 18 byte reading function.
 
err_t accel18_read_axes (accel18_t *ctx, accel18_axes_t *axes_data)
 Accel data reading.
 
err_t accel18_set_range (accel18_t *ctx, uint8_t range_macro)
 Set range configuration.
 
uint8_t accel18_get_interrupt_1 (accel18_t *ctx)
 Get interrupt 1 pin state.
 
uint8_t accel18_get_interrupt_2 (accel18_t *ctx)
 Get interrupt 2 pin state.
 

Detailed Description

API for configuring and manipulating Accel 18 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ accel18_byte_read()

err_t accel18_byte_read ( accel18_t * ctx,
uint8_t reg,
uint8_t * data_out )

Accel 18 byte reading function.

This function reads a byte of data from the selected register.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read byte.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ accel18_byte_write()

err_t accel18_byte_write ( accel18_t * ctx,
uint8_t reg,
uint8_t data_in )

Accel 18 byte writing function.

This function writes a byte of data to the selected register.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Byte to write.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ accel18_cfg_setup()

void accel18_cfg_setup ( accel18_cfg_t * cfg)

Accel 18 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See accel18_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ accel18_default_cfg()

err_t accel18_default_cfg ( accel18_t * ctx)

Accel 18 default configuration function.

This function executes a default configuration of Accel 18 click board.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ accel18_drv_interface_selection()

void accel18_drv_interface_selection ( accel18_cfg_t * cfg,
accel18_drv_t drv_sel )

Accel 18 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See accel18_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See accel18_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ accel18_generic_read()

err_t accel18_generic_read ( accel18_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Accel 18 data reading function.

This function reads a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ accel18_generic_write()

err_t accel18_generic_write ( accel18_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Accel 18 data writing function.

This function writes a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ accel18_get_interrupt_1()

uint8_t accel18_get_interrupt_1 ( accel18_t * ctx)

Get interrupt 1 pin state.

This function reads logic state of interrupt 1 pin.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
Returns
State of interrupt pin.

◆ accel18_get_interrupt_2()

uint8_t accel18_get_interrupt_2 ( accel18_t * ctx)

Get interrupt 2 pin state.

This function reads logic state of interrupt 2 pin.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
Returns
State of interrupt pin.

◆ accel18_init()

err_t accel18_init ( accel18_t * ctx,
accel18_cfg_t * cfg )

Accel 18 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See accel18_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See accel18_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ accel18_read_axes()

err_t accel18_read_axes ( accel18_t * ctx,
accel18_axes_t * axes_data )

Accel data reading.

This function reads a accel data and calculates it with resolution set in ctx object. Data will be set in axes object.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
[out]axes: Axes data object. See #acce18_axes_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ accel18_set_range()

err_t accel18_set_range ( accel18_t * ctx,
uint8_t range_macro )

Set range configuration.

This function configures device range and resolution.

Parameters
[in]ctx: Click context object. See accel18_t object definition for detailed explanation.
[in]range_macro: Range macro. See Accel 18 range and scale setting.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
Additionally function will set range_resolution in the ctx object.