Sensor Fusion Library 0.6.1
Orientation sensing for Espressif (ESP32, ESP8266) processors
Loading...
Searching...
No Matches
driver_sensors_types.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2017 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
14#ifndef _DRIVER_SENSORS_TYPES_H
15#define _DRIVER_SENSORS_TYPES_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <stdint.h>
22
23/*******************************************************************************
24 * Definitions
25 ******************************************************************************/
26/* @brief This enum defines Write flag for the Register Write. */
27typedef enum EWriteFlags
28{
29 WRITE_OVERWRITE = 0, /* Overwrite the Register Value.*/
30 WRITE_MASK = 1 /* Read and Mask and OR it with Register content.*/
31} EWriteFlags_t;
32
33/* @brief This enum defines Sensor State. */
34enum ESensorErrors
35{
36 SENSOR_ERROR_NONE = 0,
37 SENSOR_ERROR_INVALID_PARAM,
38 SENSOR_ERROR_BAD_ADDRESS,
39 SENSOR_ERROR_INIT,
40 SENSOR_ERROR_WRITE,
41 SENSOR_ERROR_READ,
42};
43
44/* The MAXIMUM number of Sensor Registers possible. */
45#define SENSOR_MAX_REGISTER_COUNT 128 /* As per 7-Bit address. */
46
47/* Used with the RegisterWriteList types as a list terminator */
48#define __END_WRITE_DATA__ \
49 { \
50 .writeTo = 0xFFFF, .value = 0 \
51 }
52
53/* Used with the RegisterReadList types as a list terminator */
54#define __END_READ_DATA__ \
55 { \
56 .readFrom = 0xFFFF, .numBytes = 0 \
57 }
58
59/* Used with the Sensor Command List types as a list terminator */
60#define __END_WRITE_CMD__ \
61 { \
62 .writeTo = 0xFFFF, .numBytes = 0 \
63 }
64
65/*******************************************************************************
66 * Types
67 ******************************************************************************/
71typedef struct
72{
73 uint16_t writeTo; /* Address where the value is writes to.*/
74 uint8_t value; /* value. Note that value should be shifted based on the bit position.*/
75 uint8_t mask; /* mask of the field to be set with given value.*/
77
81typedef struct
82{
83 uint16_t readFrom; /* Address where the value is read from .*/
84 uint8_t numBytes; /* Number of bytes to read.*/
86
90typedef void (*registeridlefunction_t)(void *userParam);
91
95typedef struct
96{
97 registeridlefunction_t idleFunction;
98 void *functionParam;
99 uint8_t deviceInstance;
101
102
103#ifdef __cplusplus
104}
105#endif
106
107#endif //_DRIVER_SENSORS_TYPES_H
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
This structure defines the device specific info required by register I/O.
This structure defines the Read command List.
This structure defines the Write command List.