SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
SensorDefs.hpp File Reference

@license MIT License More...

#include <stdint.h>
#include <math.h>
Include dependency graph for SensorDefs.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SensorVector
 Structure representing a 3D vector with floating-point components. More...
 
struct  RawVector
 Structure representing a raw 3D vector with 16-bit integer components. More...
 
struct  AccelerometerData
 Structure representing accelerometer data. More...
 
struct  MagnetometerData
 Structure representing magnetometer data. More...
 
struct  GyroscopeData
 Structure representing gyroscope data. More...
 
struct  SensorConfig
 Structure representing sensor configuration parameters. More...
 
struct  SensorInfo
 Structure containing sensor identification information. More...
 

Macros

#define M_PI   3.14159265358979323846f
 

Enumerations

enum class  SensorRemap {
  TOP_LAYER_LEFT_CORNER , TOP_LAYER_RIGHT_CORNER , TOP_LAYER_BOTTOM_RIGHT_CORNER , TOP_LAYER_BOTTOM_LEFT_CORNER ,
  BOTTOM_LAYER_TOP_LEFT_CORNER , BOTTOM_LAYER_TOP_RIGHT_CORNER , BOTTOM_LAYER_BOTTOM_RIGHT_CORNER , BOTTOM_LAYER_BOTTOM_LEFT_CORNER
}
 Enumeration representing different remapping options for the sensor's orientation. More...
 
enum  SensorDirection {
  DIRECTION_TOP_RIGHT , DIRECTION_TOP_LEFT , DIRECTION_BOTTOM_LEFT , DIRECTION_BOTTOM_RIGHT ,
  DIRECTION_BOTTOM , DIRECTION_TOP , DIRECTION_UNKNOWN
}
 
enum class  SensorType {
  UNKNOWN = 0 , ACCELEROMETER , GYROSCOPE , MAGNETOMETER ,
  PRESSURE , TEMPERATURE , HUMIDITY , MULTI_AXIS
}
 Enumeration of sensor types. More...
 
enum class  OperationMode { SUSPEND = 0 , NORMAL , SINGLE_MEASUREMENT , CONTINUOUS_MEASUREMENT }
 Enumeration of sensor operation modes. More...
 
enum class  AccelFullScaleRange {
  FS_2G = 0 , FS_4G , FS_8G , FS_16G ,
  FS_32G , FS_64G , FS_128G
}
 Enumeration of accelerometer full-scale range settings. More...
 
enum class  InterruptPinMap { DISABLE = 0 , PIN1 = 1 , PIN2 }
 Enumeration of interrupt pin mapping options. More...
 
enum class  TapEvent : uint8_t { INVALID = 0 , SINGLE = 1 , DOUBLE = 2 }
 Generic tap event type. More...
 
enum class  MagFullScaleRange {
  FS_2G = 0 , FS_4G , FS_8G , FS_12G ,
  FS_16G , FS_20G , FS_25G , FS_30G ,
  FS_32G
}
 Enumeration defining full-scale range settings for the sensor. More...
 
enum class  MagOverSampleRatio { OSR_8 , OSR_4 , OSR_2 , OSR_1 }
 Enumeration defining over-sample ratios for the sensor. More...
 
enum class  MagDownSampleRatio { DSR_1 , DSR_2 , DSR_4 , DSR_8 }
 Enumeration defining down-sample ratios for the sensor. More...
 
enum class  MagLowPassFilter {
  LPF_1 , LPF_2 , LPF_4 , LPF_8 ,
  LPF_16
}
 
enum class  GyroFullScaleRange {
  FS_125_DPS = 0 , FS_250_DPS , FS_500_DPS , FS_1000_DPS ,
  FS_2000_DPS , FS_4000_DPS
}
 Enumeration of gyroscope full-scale range settings. More...
 

Detailed Description

@license MIT License

Copyright (c) 2026 lewis he

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author
Lewis He (lewis.nosp@m.he@o.nosp@m.utloo.nosp@m.k.co.nosp@m.m)
Date
2026-02-04

Definition in file SensorDefs.hpp.

Macro Definition Documentation

◆ M_PI

#define M_PI   3.14159265358979323846f

Definition at line 37 of file SensorDefs.hpp.

Enumeration Type Documentation

◆ AccelFullScaleRange

enum class AccelFullScaleRange
strong

Enumeration of accelerometer full-scale range settings.

Enumerator
FS_2G 

±2g range

FS_4G 

±4g range

FS_8G 

±8g range

FS_16G 

±16g range

FS_32G 

±32g range

FS_64G 

±64g range

FS_128G 

±128g range

Definition at line 243 of file SensorDefs.hpp.

◆ GyroFullScaleRange

enum class GyroFullScaleRange
strong

Enumeration of gyroscope full-scale range settings.

Enumerator
FS_125_DPS 

±125 °/s

FS_250_DPS 

±250 °/s

FS_500_DPS 

±500 °/s

FS_1000_DPS 

±1000 °/s

FS_2000_DPS 

±2000 °/s

FS_4000_DPS 

±4000 °/s (if supported)

Definition at line 318 of file SensorDefs.hpp.

◆ InterruptPinMap

enum class InterruptPinMap
strong

Enumeration of interrupt pin mapping options.

Enumerator
DISABLE 

Disable interrupt output.

PIN1 

Interrupt pin 1.

PIN2 

Interrupt pin 2.

Definition at line 256 of file SensorDefs.hpp.

◆ MagDownSampleRatio

enum class MagDownSampleRatio
strong

Enumeration defining down-sample ratios for the sensor.

Enumerator
DSR_1 

1x down-sample ratio

DSR_2 

2x down-sample ratio

DSR_4 

4x down-sample ratio

DSR_8 

8x down-sample ratio

Definition at line 300 of file SensorDefs.hpp.

◆ MagFullScaleRange

enum class MagFullScaleRange
strong

Enumeration defining full-scale range settings for the sensor.

Enumerator
FS_2G 
FS_4G 
FS_8G 
FS_12G 
FS_16G 
FS_20G 
FS_25G 
FS_30G 
FS_32G 

Definition at line 275 of file SensorDefs.hpp.

◆ MagLowPassFilter

enum class MagLowPassFilter
strong
Enumerator
LPF_1 

1 Hz low-pass filter

LPF_2 

2 Hz low-pass filter

LPF_4 

4 Hz low-pass filter

LPF_8 

8 Hz low-pass filter

LPF_16 

16 Hz low-pass filter

Definition at line 307 of file SensorDefs.hpp.

◆ MagOverSampleRatio

enum class MagOverSampleRatio
strong

Enumeration defining over-sample ratios for the sensor.

Enumerator
OSR_8 

8x over-sample ratio

OSR_4 

4x over-sample ratio

OSR_2 

2x over-sample ratio

OSR_1 

1x over-sample ratio

Definition at line 290 of file SensorDefs.hpp.

◆ OperationMode

enum class OperationMode
strong

Enumeration of sensor operation modes.

Enumerator
SUSPEND 
NORMAL 
SINGLE_MEASUREMENT 
CONTINUOUS_MEASUREMENT 

Definition at line 233 of file SensorDefs.hpp.

◆ SensorDirection

Enumerator
DIRECTION_TOP_RIGHT 
DIRECTION_TOP_LEFT 
DIRECTION_BOTTOM_LEFT 
DIRECTION_BOTTOM_RIGHT 
DIRECTION_BOTTOM 
DIRECTION_TOP 
DIRECTION_UNKNOWN 

Definition at line 144 of file SensorDefs.hpp.

◆ SensorRemap

enum class SensorRemap
strong

Enumeration representing different remapping options for the sensor's orientation.

This enum defines various positions and orientations of the sensor chip. Each value corresponds to a specific corner or location of the chip, which can be used to remap the axes of the sensor according to its physical placement.

Top view of the chip, where 'T' stands for top, 'B' stands for bottom,

'L' stands for left, and 'R' stands for right

TL TR
BL BR

There is also a bottom view of the chip:


BT BB
LT RT

Enumerator
TOP_LAYER_LEFT_CORNER 
TOP_LAYER_RIGHT_CORNER 
TOP_LAYER_BOTTOM_RIGHT_CORNER 
TOP_LAYER_BOTTOM_LEFT_CORNER 
BOTTOM_LAYER_TOP_LEFT_CORNER 
BOTTOM_LAYER_TOP_RIGHT_CORNER 
BOTTOM_LAYER_BOTTOM_RIGHT_CORNER 
BOTTOM_LAYER_BOTTOM_LEFT_CORNER 

Definition at line 68 of file SensorDefs.hpp.

◆ SensorType

enum class SensorType
strong

Enumeration of sensor types.

Enumerator
UNKNOWN 

Unknown sensor type.

ACCELEROMETER 

Accelerometer sensor.

GYROSCOPE 

Gyroscope sensor.

MAGNETOMETER 

Magnetometer sensor.

PRESSURE 

Pressure sensor.

TEMPERATURE 

Temperature sensor.

HUMIDITY 

Humidity sensor.

MULTI_AXIS 

Multi-axis sensor.

Definition at line 201 of file SensorDefs.hpp.

◆ TapEvent

enum class TapEvent : uint8_t
strong

Generic tap event type.

Enumerator
INVALID 
SINGLE 
DOUBLE 

Definition at line 265 of file SensorDefs.hpp.