TLx493D 3D Hall Sensor Generic Library  1.3
Generic library for the TLx493D 3D Hall sensor family
Classes | Functions
TLV_A1B6_driver.h File Reference

Low level driver for the TLV493D-A1B6. More...

#include <stdint.h>
#include "TLV_A1B6_defines.h"
#include "src/TLx493D/interface.h"

Go to the source code of this file.

Classes

struct  TLV493D_regmap_read_t
 Data structure describing the TLV493D read registers. More...
 
struct  TLV493D_regmap_write_t
 Data structure describing the TLV493D write registers. More...
 

Functions

int32_t TLV493D_A1B6_read_regs (uint8_t addr, TLV493D_regmap_read_t *regmap, uint8_t upto)
 Read register values from the sensor, starting with the register at address 0 up to register upto. More...
 
int32_t TLV493D_A1B6_write_regs (uint8_t addr, TLV493D_regmap_write_t *regmap, const TLV493D_regmap_read_t *regmap_check)
 Write the register data from regmap to the sensor registers. More...
 

Detailed Description

Low level driver for the TLV493D-A1B6.

It simplifies the read and write operations when working with the internal registers of the sensor and also help prevent changes to the reserved data registers.

Function Documentation

◆ TLV493D_A1B6_read_regs()

int32_t TLV493D_A1B6_read_regs ( uint8_t  addr,
TLV493D_regmap_read_t regmap,
uint8_t  upto 
)

Read register values from the sensor, starting with the register at address 0 up to register upto.

Parameters
addrthe I2C address of the sensor;
regmapregister map read structure used to store the read registers of the sensor.
uptoThe reading process will start with register 0 and will continue incrementally up to the register upto
Returns
Error code.

◆ TLV493D_A1B6_write_regs()

int32_t TLV493D_A1B6_write_regs ( uint8_t  addr,
TLV493D_regmap_write_t regmap,
const TLV493D_regmap_read_t regmap_check 
)

Write the register data from regmap to the sensor registers.

If the regmap_check pointer points to a valid structure (is not NULL), the reserved registers data from the regmap will be overwritten with the reserved data from regmap_check. This ensures that the reserved data read from the sensor is properly written back to the sensor. This overwrite will need to happend only once, as the corrections will be stored inside regmap.

Returns
Error code.