pedometer3 2.0.0.0

Functions

void pedometer3_cfg_setup (pedometer3_cfg_t *cfg)
 Config Object Initialization function.
 
err_t pedometer3_init (pedometer3_t *ctx, pedometer3_cfg_t *cfg)
 Initialization function.
 
void pedometer3_default_cfg (pedometer3_t *ctx)
 Click Default Configuration function.
 
void pedometer3_generic_write (pedometer3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void pedometer3_generic_read (pedometer3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void pedometer3_get_accel_axis (pedometer3_t *ctx, pedometer3_axis_t *axis)
 Functions for read Accel axis data.
 
void pedometer3_get_hp_accel_axis (pedometer3_t *ctx, pedometer3_axis_t *axis)
 Functions for read High Pass Accel axis data.
 
void pedometer3_set_step_watermark (pedometer3_t *ctx, uint16_t value)
 Functions for sets pedometer step counter Watermark.
 
void pedometer3_pedometer_cfg (pedometer3_t *ctx, uint8_t odr)
 Functions for pedometer configuration.
 
uint16_t pedometer3_get_step_counter (pedometer3_t *ctx)
 Functions for get pedometer step counter.
 
void pedometer3_get_tilt_position (pedometer3_t *ctx, pedometer3_tilt_position_t *tilt)
 Functions for get Tilt current and previous position.
 
uint8_t pedometer3_get_tap_detection (pedometer3_t *ctx)
 Functions for get Tap detection.
 
err_t pedometer3_test_communication (pedometer3_t *ctx)
 Functions for test first comunication width chip.
 
uint8_t pedometer3_get_interrupt_1 (pedometer3_t *ctx)
 Functions for read INT pin state.
 
uint8_t pedometer3_get_interrupt_2 (pedometer3_t *ctx)
 Functions for read RST pin state.
 
uint8_t pedometer3_get_trigger_int (pedometer3_t *ctx)
 Functions for read AN pin state.
 

Detailed Description

Function Documentation

◆ pedometer3_cfg_setup()

void pedometer3_cfg_setup ( pedometer3_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ pedometer3_default_cfg()

void pedometer3_default_cfg ( pedometer3_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

This function executes default configuration for Pedometer3 click.

Note
Functions and setups that are included in the device's start configuration
  PEDOMETER3_REG_CONTROL_1
-------------------------------------------
  PEDOMETER3_CNTL1_MODE_STAND_BY
  PEDOMETER3_CNTL1_RES_MODE_HIGHER_NOISE
  PEDOMETER3_CNTL1_DATA_READY_DISABLE
  PEDOMETER3_CNTL1_G_RANGE_8g
  PEDOMETER3_CNTL1_PEDOMETER_DISABLE
  PEDOMETER3_CNTL1_TILT_DISABLE
  PEDOMETER3_CNTL1_TAP_DISABLE

PEDOMETER3_REG_CONTROL_2

  PEDOMETER3_CNTL2_SOFTWARE_RESET_NO_ACTIVE
  PEDOMETER3_CNTL2_COMMAND_TEST_NO_ACTIVE
  PEDOMETER3_CNTL2_DOWN_STATE_ENABLE
  PEDOMETER3_CNTL2_FACE_DOWN_STATE_ENABLE
  PEDOMETER3_CNTL2_FACE_UP_STATE_ENABLE
  PEDOMETER3_CNTL2_LEFT_STATE_ENABLE
  PEDOMETER3_CNTL2_RIGHT_STATE_ENABLE
  PEDOMETER3_CNTL2_UP_STATE_ENABLE
  PEDOMETER3_REG_CONTROL_3
-------------------------------------------
  PEDOMETER3_CNTL3_OTP_OUTPUT_DATA_RATE_12_5Hz
  PEDOMETER3_CNTL3_TAP_OUTPUT_DATA_RATE_400Hz
  PEDOMETER3_CNTL3_OWUF_OUTPUT_DATA_RATE_0_781Hz

PEDOMETER3_REG_CONTROL_4

  PEDOMETER3_CNTL4_COUNTER_DECREMENT_MODE
  PEDOMETER3_CNTL4_THRESHOLD_MODE_ABSOLUTE
  PEDOMETER3_CNTL4_WAKE_UP_DISABLE
  PEDOMETER3_CNTL4_BACK_TO_SLEEP_DISABLE
  PEDOMETER3_CNTL2_FACE_UP_STATE_ENABLE
  PEDOMETER3_CNTL4_HIGH_PASS_ENABLE
  PEDOMETER3_CNTL4_OBTS_OUTPUT_DATA_RATE_0_781Hz
  PEDOMETER3_REG_CONTROL_5
-------------------------------------------
  PEDOMETER3_CNTL5_MANUAL_WAKE_UP_0
  PEDOMETER3_CNTL5_MANUAL_SLEEP_UP_0

PEDOMETER3_REG_OUTPUT_DATA_CONTROL

  PEDOMETER3_ODCNTL_IR_BYPASS_FILTERING_APPLIED
  PEDOMETER3_ODCNTL_LPRO_ODR_9
  PEDOMETER3_ODCNTL_OSA_OUTPUT_DATA_RATE_50Hz
  PEDOMETER3_CNTL4_BACK_TO_SLEEP_DISABLE
  PEDOMETER3_CNTL2_FACE_UP_STATE_ENABLE
  PEDOMETER3_CNTL4_HIGH_PASS_ENABLE
  PEDOMETER3_CNTL4_OBTS_OUTPUT_DATA_RATE_0_781Hz

Set Pedometer Step Watermark on the 10 000 steps

  PEDOMETER3_REG_PEDOMETER_CONTROL_2
-------------------------------------------
  PEDOMETER3_PED_CNTL2_HIGH_PASS_FILTER_4
  PEDOMETER3_PED_CNTL2_ODR_SELECT_100Hz

PEDOMETER3_REG_INTERRUPT_CONTROL_7

  PEDOMETER3_INC7_STEP_OVERFLOW_INTERRUPT_2_ENABLE
  PEDOMETER3_INC7_STEP_WATERMARK_INTERRUPT_2_ENABLE
  PEDOMETER3_INC7_STEP_INCREMENT_INTERRUPT_1_ENABLE
  PEDOMETER3_REG_INTERRUPT_CONTROL_1
-------------------------------------------
  PEDOMETER3_INC1_PHYSICAL_INTERRUPT_ENABLE

  PEDOMETER3_REG_INTERRUPT_CONTROL_5
-------------------------------------------
  PEDOMETER3_INC5_PHYSICAL_INTERRUPT_ENABLE

Start pedometer config on the ODR = 100Hz

◆ pedometer3_generic_read()

void pedometer3_generic_read ( pedometer3_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

This function reads data from the desired register.

◆ pedometer3_generic_write()

void pedometer3_generic_write ( pedometer3_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

This function writes data to the desired register.

◆ pedometer3_get_accel_axis()

void pedometer3_get_accel_axis ( pedometer3_t * ctx,
pedometer3_axis_t * axis )

Functions for read Accel axis data.

Parameters
ctxClick object.
axisAccel axis structure.

◆ pedometer3_get_hp_accel_axis()

void pedometer3_get_hp_accel_axis ( pedometer3_t * ctx,
pedometer3_axis_t * axis )

Functions for read High Pass Accel axis data.

Parameters
ctxClick object.
axisAccel axis structure.

◆ pedometer3_get_interrupt_1()

uint8_t pedometer3_get_interrupt_1 ( pedometer3_t * ctx)

Functions for read INT pin state.

Parameters
ctxClick object.
Return values
Interrupt1 state

◆ pedometer3_get_interrupt_2()

uint8_t pedometer3_get_interrupt_2 ( pedometer3_t * ctx)

Functions for read RST pin state.

Parameters
ctxClick object.
Return values
Interrupt2 state

◆ pedometer3_get_step_counter()

uint16_t pedometer3_get_step_counter ( pedometer3_t * ctx)

Functions for get pedometer step counter.

Parameters
ctxClick object.
Returns
Number of detected steps in one period

◆ pedometer3_get_tap_detection()

uint8_t pedometer3_get_tap_detection ( pedometer3_t * ctx)

Functions for get Tap detection.

Parameters
ctxClick object.
tapA tap that's detected
Note
return value  | name TAP
--------------+---------------------------
10            | PEDOMETER3_TAP_X_NEGATIVE
11            | PEDOMETER3_TAP_X_POSITIVE
20            | PEDOMETER3_TAP_Y_NEGATIVE
21            | PEDOMETER3_TAP_Y_POSITIVE
30            | PEDOMETER3_TAP_Z_NEGATIVE
31            | PEDOMETER3_TAP_Z_POSITIVE

◆ pedometer3_get_tilt_position()

void pedometer3_get_tilt_position ( pedometer3_t * ctx,
pedometer3_tilt_position_t * tilt )

Functions for get Tilt current and previous position.

Parameters
ctxClick object.
tiltTilt structure
Note
return value | name position
-------------+------------------------------------
1            | PEDOMETER3_TILT_POSITION_LEFT
2            | PEDOMETER3_TILT_POSITION_RIGHT
3            | PEDOMETER3_TILT_POSITION_DOWN
4            | PEDOMETER3_TILT_POSITION_UP
5            | PEDOMETER3_TILT_POSITION_FACE_DOWN
6            | PEDOMETER3_TILT_POSITION_FACE_UP

◆ pedometer3_get_trigger_int()

uint8_t pedometer3_get_trigger_int ( pedometer3_t * ctx)

Functions for read AN pin state.

Parameters
ctxClick object.
Return values
Triggerinterrupt state

◆ pedometer3_init()

err_t pedometer3_init ( pedometer3_t * ctx,
pedometer3_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ pedometer3_pedometer_cfg()

void pedometer3_pedometer_cfg ( pedometer3_t * ctx,
uint8_t odr )

Functions for pedometer configuration.

Parameters
ctxClick object.
odrODR frequency ( 100 Hz or 50 Hz)
Note
This function uses default pedometer control of registers for set ODR. Settings that are used for Set frequency see datasheet.

◆ pedometer3_set_step_watermark()

void pedometer3_set_step_watermark ( pedometer3_t * ctx,
uint16_t value )

Functions for sets pedometer step counter Watermark.

Parameters
ctxClick object.
valueValue for sets
Note
This function is used to set the 16-bit watermark threshold for step counting.

◆ pedometer3_test_communication()

err_t pedometer3_test_communication ( pedometer3_t * ctx)

Functions for test first comunication width chip.

Parameters
ctxClick object.
Returns
Did the device have communication with the MCU.
Return values
0[PEDOMETER3_ERROR] - Device error, not read main iD
1[PEDOMETER_OK] - Successfully read the main ID and the device is ready to work