Sensor Fusion Library
0.6.1
Orientation sensing for Espressif (ESP32, ESP8266) processors
Loading...
Searching...
No Matches
src
board.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015, Freescale Semiconductor, Inc.
3
* Copyright 2016-2018 NXP
4
* Copyright 2020 Bjarne Hansen
5
* All rights reserved.
6
*
7
* SPDX-License-Identifier: BSD-3-Clause
8
*/
9
16
#ifndef _BOARD_H_
17
#define _BOARD_H_
18
19
#include <Arduino.h>
20
21
#ifndef BOARD_USES_HW_GPIO_NUMBERS
22
#define BOARD_USES_HW_GPIO_NUMBERS
23
#endif
24
25
#if defined(__cplusplus)
26
extern
"C"
{
27
#endif
/* __cplusplus */
28
29
#ifdef ESP8266
30
// #include "Arduino.h" has definitions for following, but if full Arduino.h is included, then some other defines
31
// like PI in sensor_fusion.h will clash. Also get errors if Arduino.h is inside extern "C" {} brackets.
32
#ifndef HIGH
33
#define HIGH (0x01)
34
#endif
35
#ifndef LOW
36
#define LOW (0x00)
37
#endif
38
#ifndef OUTPUT
39
#define OUTPUT (0x01)
40
#endif
41
#endif
42
#ifdef ESP32
43
//#include <Arduino.h> //Can use this instead (which includes the *_hal_gpio), but then some other
44
// constants get defined too (like PI) which clash with defines in sensor_fusion.h
45
#include <esp32-hal-gpio.h>
//needed for pinMode() etc.
46
#endif
47
48
// Specify the specific sensor IC(s) used
49
#include "
sensor_fusion/driver_fxos8700.h
"
50
#include "
sensor_fusion/driver_fxas21002.h
"
51
52
// Board name and type, passed in packets to Sensor Toolbox.
53
// Suspect these fields are only informational.
54
#define BOARD_NAME "ESP32 WROVER"
55
#define THIS_BOARD 9
//impersonates a FRDM_K22F. Sent in packets to PC-based App.
56
#define THIS_SHIELD 4
//impersonates shield AGMP03. Sent in packets to PC-based App.
57
58
// sensor hardware details
59
#define GYRO_FIFO_SIZE 32
60
#define ACCEL_FIFO_SIZE 32
61
#define MAG_FIFO_SIZE 1
62
//these ICs we save 6 bytes * 31 = 186 bytes of RAM by setting this FIFO size to 1
63
64
// Board LED mappings for ESP32 WROVER-KIT
65
#define LOGIC_LED_ON 1U
66
#define LOGIC_LED_OFF 0U
67
68
#ifndef BOARD_LED_RED_GPIO_PIN
69
#define BOARD_LED_RED_GPIO_PIN (0)
70
#endif
71
#ifndef BOARD_LED_GREEN_GPIO_PIN
72
#define BOARD_LED_GREEN_GPIO_PIN (2)
73
#endif
74
#ifndef BOARD_LED_BLUE_GPIO_PIN
75
#define BOARD_LED_BLUE_GPIO_PIN (4)
76
#endif
77
78
#ifndef LED_BUILTIN
79
#define LED_BUILTIN BOARD_LED_RED_GPIO_PIN
80
#endif
81
82
// LED-related macros to replace the functions used in status.c
83
#define LED_RED_INIT(output) \
84
pinMode(BOARD_LED_RED_GPIO_PIN, OUTPUT);
// Enable LED_RED
85
#define LED_RED_ON() digitalWrite(BOARD_LED_RED_GPIO_PIN, HIGH);
// Turn on LED_RED
86
#define LED_RED_OFF() digitalWrite(BOARD_LED_RED_GPIO_PIN, LOW);
// Turn off LED_RED
87
#define LED_RED_TOGGLE() \
88
digitalWrite(BOARD_LED_RED_GPIO_PIN, !digitalRead(BOARD_LED_RED_GPIO_PIN));
// Toggle LED_RED
89
90
#define LED_GREEN_INIT(output) \
91
pinMode(BOARD_LED_GREEN_GPIO_PIN, OUTPUT);
// Enable LED_GREEN
92
#define LED_GREEN_ON() digitalWrite(BOARD_LED_GREEN_GPIO_PIN, HIGH);
// Turn on LED_GREEN
93
#define LED_GREEN_OFF() digitalWrite(BOARD_LED_GREEN_GPIO_PIN, LOW);
// Turn off LED_GREEN
94
#define LED_GREEN_TOGGLE() \
95
digitalWrite(BOARD_LED_GREEN_GPIO_PIN, !digitalRead(BOARD_LED_GREEN_GPIO_PIN));
// Toggle LED_GREEN
96
97
#define LED_BLUE_INIT(output) \
98
pinMode(BOARD_LED_BLUE_GPIO_PIN, OUTPUT);
// Enable LED_BLUE
99
#define LED_BLUE_ON() digitalWrite(BOARD_LED_BLUE_GPIO_PIN, HIGH);
// Turn on LED_BLUE
100
#define LED_BLUE_OFF() digitalWrite(BOARD_LED_BLUE_GPIO_PIN, LOW);
// Turn off LED_BLUE
101
#define LED_BLUE_TOGGLE() \
102
digitalWrite(BOARD_LED_BLUE_GPIO_PIN, !digitalRead(BOARD_LED_BLUE_GPIO_PIN));
// Toggle LED_BLUE
103
104
// Functions that have no equivalent and are unneeded
105
#define CLOCK_EnableClock(x)
//found in status.c
106
#define PORT_SetPinMux(x,y,z)
//found in status.c
107
108
109
#if defined(__cplusplus)
110
}
111
#endif
/* __cplusplus */
112
113
#endif
/* _BOARD_H_ */
driver_fxas21002.h
Contains the fxas21002 sensor register definitions and its bit mask.
driver_fxos8700.h
Describes the fxos8700 driver interface and structures.
Generated on Wed Feb 18 2026 09:42:29 for Sensor Fusion Library by
1.9.8