Utilities for sensor drivers.
Driver include
This header file should be included in an application as follows:
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Task.h>
Go to the source code of this file.
§ ST_ASSERT
bool assertion; return 'false' and release I2C if condition is not met
§ ST_ASSERT_V
void assertion; return and release I2C if condition is not met
§ ST
#define ST |
( |
|
x | ) |
do { x } while (__LINE__ == -1) |
Loop enclosure for macros
§ HI_UINT16
#define HI_UINT16 |
( |
|
a | ) |
(((a) >> 8) & 0xFF) |
Extract MSB from a 16 bit word
§ LO_UINT16
#define LO_UINT16 |
( |
|
a | ) |
((a) & 0xFF) |
Extract LSB from a 16 bit word
§ SWAP
Swap bytes within a 16 bit word
§ DELAY_MS
#define DELAY_MS |
( |
|
i | ) |
(Task_sleep(((i) * 1000) / Clock_tickPeriod)) |
Delay task execution by (n) milliseconds
§ DELAY_US
#define DELAY_US |
( |
|
i | ) |
(Task_sleep(((i) * 1) / Clock_tickPeriod)) |
Delay task execution by (n) microseconds
§ MS_2_TICKS
#define MS_2_TICKS |
( |
|
ms | ) |
(((ms) * 1000) / Clock_tickPeriod) |
Convert milliseconds to RTOS system ticks
§ SensorUtil_convertToLe()
void SensorUtil_convertToLe |
( |
uint8_t * |
pData, |
|
|
uint8_t |
nWords |
|
) |
| |
Convert 16-bit words to/from big-endian to little-endian.
- Parameters
-
pData | - buffer to the data to be converted |
nWords | - number of 16-bit words to be swapped |
§ SensorUtil_floatToSfloat()
uint16_t SensorUtil_floatToSfloat |
( |
float |
data | ) |
|
Convert a float to a short float.
- Parameters
-
data | - floating point number to convert |
- Returns
- converted value
§ SensorUtil_sfloatToFloat()
float SensorUtil_sfloatToFloat |
( |
uint16_t |
data | ) |
|
Convert a short float to a float.
- Parameters
-
data | - short float number to convert |
- Returns
- converted value
§ SensorUtil_intToSfloat()
uint16_t SensorUtil_intToSfloat |
( |
int |
data | ) |
|
Convert an integer to a short float.
- Parameters
-
- Returns
- converted value