inclinometer 2.0.0.0
inclinometer.h File Reference

This file contains API for Inclinometer Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  inclinometer_t
 Inclinometer Click context object. More...
 
struct  inclinometer_cfg_t
 Inclinometer Click configuration object. More...
 
struct  inclinometer_accel_t
 Inclinometer Click axis/angle data object. More...
 

Macros

#define INCLINOMETER_REG_ACC_X   0x01
 Inclinometer control register.
 
#define INCLINOMETER_REG_ACC_Y   0x02
 
#define INCLINOMETER_REG_ACC_Z   0x03
 
#define INCLINOMETER_REG_STO   0x04
 
#define INCLINOMETER_REG_TEMP   0x05
 
#define INCLINOMETER_REG_STATUS   0x06
 
#define INCLINOMETER_REG_ERR_FLAG1   0x07
 
#define INCLINOMETER_REG_ERR_FLAG2   0x08
 
#define INCLINOMETER_REG_ANG_X   0x09
 
#define INCLINOMETER_REG_ANG_Y   0x0A
 
#define INCLINOMETER_REG_ANG_Z   0x0B
 
#define INCLINOMETER_REG_ANG_CTRL   0x0C
 
#define INCLINOMETER_REG_MODE   0x0D
 
#define INCLINOMETER_REG_WHOAMI   0x10
 
#define INCLINOMETER_REG_SERIAL1   0x19
 
#define INCLINOMETER_REG_SERIAL2   0x1A
 
#define INCLINOMETER_REG_SELBANK   0x1F
 
#define INCLINOMETER_CMD_READ_ACC_X   0x040000F7
 Inclinometer control commands.
 
#define INCLINOMETER_CMD_READ_ACC_Y   0x080000FD
 
#define INCLINOMETER_CMD_READ_ACC_Z   0x0C0000FB
 
#define INCLINOMETER_CMD_READ_STO   0x100000E9
 
#define INCLINOMETER_CMD_EN_ANGLE_OUT   0xB0001F6F
 
#define INCLINOMETER_CMD_READ_ANG_X   0x240000C7
 
#define INCLINOMETER_CMD_READ_ANG_Y   0x280000CD
 
#define INCLINOMETER_CMD_READ_ANG_Z   0x2C0000CB
 
#define INCLINOMETER_CMD_READ_TEMP   0x140000EF
 
#define INCLINOMETER_CMD_READ_STATUS   0x180000E5
 
#define INCLINOMETER_CMD_READ_ERR_FLAG1   0x1C0000E3
 
#define INCLINOMETER_CMD_READ_ERR_FLAG2   0x200000C1
 
#define INCLINOMETER_CMD_READ_MODE   0x340000DF
 
#define INCLINOMETER_CMD_CHANGE_TO_MODE1   0xB400001F
 
#define INCLINOMETER_CMD_CHANGE_TO_MODE2   0xB4000102
 
#define INCLINOMETER_CMD_CHANGE_TO_MODE3   0xB4000225
 
#define INCLINOMETER_CMD_CHANGE_TO_MODE4   0xB4000338
 
#define INCLINOMETER_CMD_POWER_DOWN   0xB400046B
 
#define INCLINOMETER_CMD_WAKE_UP   0xB400001F
 
#define INCLINOMETER_CMD_SW_RESET   0xB4002098
 
#define INCLINOMETER_CMD_READ_WHOAMI   0x40000091
 
#define INCLINOMETER_CMD_READ_SERIAL1   0x640000A7
 
#define INCLINOMETER_CMD_READ_SERIAL2   0x680000AD
 
#define INCLINOMETER_CMD_READ_CURRENT_BANK   0x7C0000B3
 
#define INCLINOMETER_CMD_SWITCH_TO_BANK0   0xFC000073
 
#define INCLINOMETER_CMD_SWITCH_TO_BANK1   0xFC00016E
 
#define INCLINOMETER_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  inclinometer_return_value_t { INCLINOMETER_OK = 0 , INCLINOMETER_ERROR = -1 , INCLINOMETER_CRC_ERROR = -2 }
 Inclinometer Click return value data. More...
 

Functions

void inclinometer_cfg_setup (inclinometer_cfg_t *cfg)
 Inclinometer configuration object setup function.
 
err_t inclinometer_init (inclinometer_t *ctx, inclinometer_cfg_t *cfg)
 Inclinometer initialization function.
 
err_t inclinometer_default_cfg (inclinometer_t *ctx)
 Inclinometer default configuration function.
 
err_t inclinometer_generic_write (inclinometer_t *ctx, uint8_t reg, uint16_t data_in)
 Data writing function.
 
err_t inclinometer_generic_read (inclinometer_t *ctx, uint8_t reg, uint16_t *data_out)
 Data reading function.
 
err_t inclinometer_cmd_write (inclinometer_t *ctx, uint32_t cmd)
 CMD writing function.
 
err_t inclinometer_cmd_read (inclinometer_t *ctx, uint32_t cmd, uint16_t *cmd_data)
 CMD reading function.
 
err_t inclinometer_get_temperature (inclinometer_t *ctx, float *temperature)
 Temperature reading.
 
err_t inclinometer_get_axes (inclinometer_t *ctx, inclinometer_accel_t *axes_data)
 Axes reading.
 
err_t inclinometer_get_angle (inclinometer_t *ctx, inclinometer_accel_t *angle_data)
 Angle reading.
 

Detailed Description

This file contains API for Inclinometer Click Driver.

Enumeration Type Documentation

◆ inclinometer_return_value_t

Inclinometer Click return value data.

Predefined enum values for driver return values.

Enumerator
INCLINOMETER_OK 
INCLINOMETER_ERROR 
INCLINOMETER_CRC_ERROR