![]() |
TLx493D 3D Hall Sensor Generic Library
1.3
Generic library for the TLx493D 3D Hall sensor family
|
Generic Library interface to the peripheral drivers. More...
#include "src/xmc1100/interrupt/interrupts.h"
#include "src/xmc1100/gpio/gpio.h"
#include "src/xmc1100/uart/uart.h"
#include "src/xmc1100/i2c_int/i2c_int.h"
Go to the source code of this file.
Macros | |
#define | _I2C_read I2C_INT_read_block |
Function Header: (uint8_t addr, uint8_t *data, uint8_t count) More... | |
#define | _I2C_write I2C_INT_write_block |
Function Header: (uint8_t addr, const uint8_t* data, uint8_t count) More... | |
#define | _I2C_recover() I2C_INT_write_recover() |
Function Header: (void) More... | |
#define | _I2C_reset() I2C_INT_write_reset() |
Function Header: (void) More... | |
#define | _SET_ADDR_AND_WAIT(high) GPIO_set_addr_wait(high) |
Function Header: (bool high) More... | |
#define | _POWER_ENABLE() GPIO_sensor_supply(true) |
Function Header: (void) More... | |
#define | _POWER_DISABLE() GPIO_sensor_supply(false) |
Function Header: (void) More... | |
#define | _LOG_STR UART_write |
Function Header: (void *data, uint32_t count) More... | |
Generic Library interface to the peripheral drivers.
The purpose of this file is to connect microcontroller dependent functions to the generic TLx493D library which is microcontroller agnostic. The functions specified below are needed for the normal functioning of the sensor.
Note: ALL I2C functions should return a positive value of type int32_t (defined in stdint.h) indicating some communication error or Zero(0) indicating a successful communication. The positive return values themselves, aside from indicating an error, are meaningless to the library and thus can be arbitrarily chosen by the user as seen fit. Negative return value are reserved and used internally by the generic library, thus no function referred in this library should return a negative error as it may collide with the library reserved return value!
#define _I2C_read I2C_INT_read_block |
Function Header: (uint8_t addr, uint8_t *data, uint8_t count)
I2C read command must have a header precisely of type: (uint8_t addr, uint8_t *data, uint8_t count):
addr | The I2C address of the sensor |
data | The array that the function will read to |
count | The number of bytes the function will read |
#define _I2C_recover | ( | ) | I2C_INT_write_recover() |
Function Header: (void)
_I2C_recover should take no parameter. It will write the recover address (FF) on the I2C bus
#define _I2C_reset | ( | ) | I2C_INT_write_reset() |
Function Header: (void)
_I2C_reset should take no parameter. It will write the reset address (00) on the I2C bus
#define _I2C_write I2C_INT_write_block |
Function Header: (uint8_t addr, const uint8_t* data, uint8_t count)
I2C write command must have a header precisely of type: (uint8_t addr, const uint8_t* data, uint8_t count), where:
addr | Is the I2C address to read from data is the; |
data | is the array that the function will read to |
count | is the number of bytes the function will read |
#define _LOG_STR UART_write |
Function Header: (void *data, uint32_t count)
Offers a method to log a string. The header of the method should be of type (void *data, uint32_t count)
data | An array of unit8_t to be written |
count | The number of bytes to be written // ============ EXAMPLE ============== // log the string 'Example' |
#define _POWER_DISABLE | ( | ) | GPIO_sensor_supply(false) |
Function Header: (void)
Set the pin responsible with supplying the sensor voltage to LOW. The function will be called with no arguments.
#define _POWER_ENABLE | ( | ) | GPIO_sensor_supply(true) |
Function Header: (void)
Set the pin responsible with supplying the sensor voltage to HIGH. The function will be called with no arguments.
#define _SET_ADDR_AND_WAIT | ( | high | ) | GPIO_set_addr_wait(high) |
Function Header: (bool high)
high | A value of true will set the ADDR pin HIGH at sensor power up, and a value of false will set the ADDR pin to LOW at sensor power up. |
Set the desired level on ADDR(SDA) pin and wait at least 200us. Header should be of type (bool high) where: _SET_ADDR_AND_WAIT(true) will set the ADDR(SDA) line to HIGH and then wait for at least 200us. _SET_ADDR_AND_WAIT(false) will set the ADDR(SDA) line to LOW and then wait for at least 200us. Finally, the SDA line should be set back to HIGH.