Si114x
[Drivers]

Collaboration diagram for Si114x:

Defines

#define SI1147_ADDR   0xc0
 I2C device address for Si1147 on weather station board.

Enumerations

enum  gesture_t {
  NONE,
  UP,
  DOWN,
  LEFT,
  RIGHT,
  TAP
}
 

Si114x gestures.

More...

Functions

int Si1147_Write_Register (I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t data)
 Writes register in the Si1147 sensor.
int Si1147_Write_Block_Register (I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t length, uint8_t const *data)
 Writes a block of data to the Si1147 sensor.
int Si1147_Read_Block_Register (I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t length, uint8_t *data)
 Reads a block of data from the Si1147 sensor.
int Si1147_Read_Register (I2C_TypeDef *i2c, uint8_t addr, uint8_t reg, uint8_t *data)
 Reads register from the Si1147 sensor.
gesture_t Si1147_NewSample (I2C_TypeDef *i2c, uint8_t addr, uint32_t timestamp)
 Reads new measurement data and processes a new sample.
int Si1147_ConfigureDetection (I2C_TypeDef *i2c, uint8_t addr, int slow)
 Initializes and configures the Si1147 sensor.
int Si1147_SetInterruptOutputEnable (I2C_TypeDef *i2c, uint8_t addr, int enable)
 Enables or disables the Si1147 interrupt pin.
int Si1147_GetInterruptOutputEnable (I2C_TypeDef *i2c, uint8_t addr, int *enable)
 Get the enable status of the Si1147 interrupt pin.
int Si1147_Detect_Device (I2C_TypeDef *i2c, uint8_t addr)
 Detects whether Si1147 is on the i2c bus.
int Si1147_MeasureUVAndObjectPresent (I2C_TypeDef *i2c, uint8_t addr, uint16_t *uvIndex, int *objectDetect)
 Reads the UV measurement data and checks for object in proximity to the Si1147.

Define Documentation

#define SI1147_ADDR   0xc0

I2C device address for Si1147 on weather station board.

Definition at line 41 of file si114x_algorithm.h.


Enumeration Type Documentation

enum gesture_t

Si114x gestures.

Definition at line 67 of file si114x_algorithm.h.


Function Documentation

int Si1147_ConfigureDetection ( I2C_TypeDef *  i2c,
uint8_t  addr,
int  lowpower 
)

Initializes and configures the Si1147 sensor.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[in] lowpower Set to 1 to initialize without autonomous mode (low power) or set to 0 to enable autonomous mode.
Returns:
Returns 0 on success.

Definition at line 385 of file si114x_algorithm.c.

int Si1147_Detect_Device ( I2C_TypeDef *  i2c,
uint8_t  addr 
)

Detects whether Si1147 is on the i2c bus.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
Returns:
Returns 1 on success. Otherwise returns 0.

Definition at line 55 of file si114x_algorithm.c.

int Si1147_GetInterruptOutputEnable ( I2C_TypeDef *  i2c,
uint8_t  addr,
int *  enable 
)

Get the enable status of the Si1147 interrupt pin.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[out] enable Will be set to 1 if the interrupt output pin is enabled or set to 0 if disabled.
Returns:
Returns 0.

Definition at line 110 of file si114x_algorithm.c.

Referenced by Si1147_MeasureUVAndObjectPresent().

Here is the caller graph for this function:

int Si1147_MeasureUVAndObjectPresent ( I2C_TypeDef *  i2c,
uint8_t  addr,
uint16_t *  uvIndex,
int *  objectDetect 
)

Reads the UV measurement data and checks for object in proximity to the Si1147.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[out] uvIndex The UV index read from the sensor
[out] objectDetect Returns true if an object is detected in front of the sensor, otherwise false.
Returns:
Returns 0.

Definition at line 136 of file si114x_algorithm.c.

References Si1147_GetInterruptOutputEnable().

Here is the call graph for this function:

gesture_t Si1147_NewSample ( I2C_TypeDef *  i2c,
uint8_t  addr,
uint32_t  timestamp 
)

Reads new measurement data and processes a new sample.

This function should be called every time an interrupt for a new sample is received.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[in] timestamp The timestamp for when the sample interrupt was received.
Returns:
Returns the type of gesture detected (as defined by gesture_t).

Definition at line 207 of file si114x_algorithm.c.

int Si1147_Read_Block_Register ( I2C_TypeDef *  i2c,
uint8_t  addr,
uint8_t  reg,
uint8_t  length,
uint8_t *  data 
)

Reads a block of data from the Si1147 sensor.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[out] data The data read from the sensor.
[in] length The number of bytes to write to the sensor.
[in] reg The first register to begin reading from.
Returns:
Returns number of bytes read on success. Otherwise returns error codes based on the I2CDRV.

Definition at line 185 of file si1147_i2c.c.

References I2CDRV_Transfer().

Here is the call graph for this function:

int Si1147_Read_Register ( I2C_TypeDef *  i2c,
uint8_t  addr,
uint8_t  reg,
uint8_t *  data 
)

Reads register from the Si1147 sensor.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[out] data The data read from the sensor.
[in] reg The register address to read from in the sensor.
Returns:
Returns number of bytes read on success. Otherwise returns error codes based on the I2CDRV.

Definition at line 47 of file si1147_i2c.c.

References I2CDRV_Transfer().

Here is the call graph for this function:

int Si1147_SetInterruptOutputEnable ( I2C_TypeDef *  i2c,
uint8_t  addr,
int  enable 
)

Enables or disables the Si1147 interrupt pin.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[in] enable Set to 1 to enable the interrupt output pin or set to 0 to disable the pin.
Returns:
Returns error codes based on the I2CDRV.

Definition at line 81 of file si114x_algorithm.c.

int Si1147_Write_Block_Register ( I2C_TypeDef *  i2c,
uint8_t  addr,
uint8_t  reg,
uint8_t  length,
uint8_t const *  data 
)

Writes a block of data to the Si1147 sensor.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[in] data The data to write to the sensor.
[in] length The number of bytes to write to the sensor.
[in] reg The first register to begin writing to.
Returns:
Returns zero on success. Otherwise returns error codes based on the I2CDRV.

Definition at line 136 of file si1147_i2c.c.

References I2CDRV_Transfer().

Here is the call graph for this function:

int Si1147_Write_Register ( I2C_TypeDef *  i2c,
uint8_t  addr,
uint8_t  reg,
uint8_t  data 
)

Writes register in the Si1147 sensor.

Parameters:
[in] i2c The I2C peripheral to use (not used).
[in] addr The I2C address of the sensor.
[in] data The data to write to the sensor.
[in] reg The register address to write to in the sensor.
Returns:
Returns zero on success. Otherwise returns error codes based on the I2CDRV.

Definition at line 91 of file si1147_i2c.c.

References I2CDRV_Transfer().

Here is the call graph for this function: