|
20 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
21 | 21 | THE SOFTWARE. |
22 | 22 | */ |
| 23 | +// ================================================ |
| 24 | +// See docs for configuration options and examples: |
| 25 | +// https://docs.slimevr.dev/firmware/configuring-project.html#2-configuring-definesh |
| 26 | +// ================================================ |
23 | 27 |
|
24 | | -#define IMU IMU_LSM6DSV |
25 | | -#define BOARD BOARD_CUSTOM |
26 | | -#define IMU_ROTATION DEG_90 |
| 28 | +// Set parameters of IMU and board used |
| 29 | +#define IMU IMU_BNO085 |
| 30 | +#define SECOND_IMU IMU |
| 31 | +#define BOARD BOARD_SLIMEVR |
| 32 | +#define IMU_ROTATION DEG_270 |
| 33 | +#define SECOND_IMU_ROTATION DEG_270 |
27 | 34 |
|
28 | 35 | #define PRIMARY_IMU_OPTIONAL false |
| 36 | +#define SECONDARY_IMU_OPTIONAL true |
29 | 37 |
|
30 | | -#define MAX_IMU_COUNT 1 |
| 38 | +// Set I2C address here or directly in IMU_DESC_ENTRY for each IMU used |
| 39 | +// If not set, default address is used based on the IMU and Sensor ID |
| 40 | +// #define PRIMARY_IMU_ADDRESS_ONE 0x4a |
| 41 | +// #define SECONDARY_IMU_ADDRESS_TWO 0x4b |
31 | 42 |
|
32 | | -#define ON_OFF_BUTTON 1 |
| 43 | +#define MAX_IMU_COUNT 2 |
| 44 | + |
| 45 | +// Axis mapping example |
| 46 | +/* |
| 47 | +#include "sensors/axisremap.h" |
| 48 | +#define BMI160_QMC_REMAP AXIS_REMAP_BUILD(AXIS_REMAP_USE_Y, AXIS_REMAP_USE_XN, |
| 49 | +AXIS_REMAP_USE_Z, \ AXIS_REMAP_USE_YN, AXIS_REMAP_USE_X, AXIS_REMAP_USE_Z) |
| 50 | +
|
| 51 | +IMU_DESC_ENTRY(IMU_BMP160, PRIMARY_IMU_ADDRESS_ONE, IMU_ROTATION, PIN_IMU_SCL, |
| 52 | +PIN_IMU_SDA, PRIMARY_IMU_OPTIONAL, BMI160_QMC_REMAP) \ |
| 53 | +*/ |
33 | 54 |
|
34 | 55 | #ifndef IMU_DESC_LIST |
35 | | -#define IMU_DESC_LIST \ |
36 | | - IMU_DESC_ENTRY( \ |
37 | | - IMU, \ |
38 | | - PRIMARY_IMU_ADDRESS_ONE, \ |
39 | | - IMU_ROTATION, \ |
40 | | - PIN_IMU_SCL, \ |
41 | | - PIN_IMU_SDA, \ |
42 | | - PRIMARY_IMU_OPTIONAL, \ |
43 | | - PIN_IMU_INT \ |
| 56 | +#define IMU_DESC_LIST \ |
| 57 | + IMU_DESC_ENTRY( \ |
| 58 | + IMU, \ |
| 59 | + PRIMARY_IMU_ADDRESS_ONE, \ |
| 60 | + IMU_ROTATION, \ |
| 61 | + PIN_IMU_SCL, \ |
| 62 | + PIN_IMU_SDA, \ |
| 63 | + PRIMARY_IMU_OPTIONAL, \ |
| 64 | + PIN_IMU_INT \ |
| 65 | + ) \ |
| 66 | + IMU_DESC_ENTRY( \ |
| 67 | + SECOND_IMU, \ |
| 68 | + SECONDARY_IMU_ADDRESS_TWO, \ |
| 69 | + SECOND_IMU_ROTATION, \ |
| 70 | + PIN_IMU_SCL, \ |
| 71 | + PIN_IMU_SDA, \ |
| 72 | + SECONDARY_IMU_OPTIONAL, \ |
| 73 | + PIN_IMU_INT_2 \ |
44 | 74 | ) |
45 | 75 | #endif |
46 | 76 |
|
| 77 | +// Battery monitoring options (comment to disable): |
| 78 | +// BAT_EXTERNAL for ADC pin, |
| 79 | +// BAT_INTERNAL for internal - can detect only low battery, |
| 80 | +// BAT_MCP3021 for external ADC connected over I2C |
47 | 81 | #define BATTERY_MONITOR BAT_EXTERNAL |
48 | 82 |
|
49 | | -#define PIN_IMU_SDA 5 |
50 | | -#define PIN_IMU_SCL 6 |
| 83 | +// BAT_EXTERNAL definition override |
| 84 | +// D1 Mini boards with ESP8266 have internal resistors. For these boards you only have |
| 85 | +// to adjust BATTERY_SHIELD_RESISTANCE. For other boards you can now adjust the other |
| 86 | +// resistor values. The diagram looks like this: |
| 87 | +// (Battery)--- [BATTERY_SHIELD_RESISTANCE] ---(INPUT_BOARD)--- [BATTERY_SHIELD_R2] |
| 88 | +// ---(ESP32_INPUT)--- [BATTERY_SHIELD_R1] --- (GND) |
| 89 | +// #define BATTERY_SHIELD_RESISTANCE 180 //130k BatteryShield, 180k SlimeVR or fill in |
| 90 | +// external resistor value in kOhm #define BATTERY_SHIELD_R1 100 // Board voltage |
| 91 | +// divider resistor Ain to GND in kOhm #define BATTERY_SHIELD_R2 220 // Board voltage |
| 92 | +// divider resistor Ain to INPUT_BOARD in kOhm |
| 93 | + |
| 94 | +// LED configuration: |
| 95 | +// Configuration Priority 1 = Highest: |
| 96 | +// 1. LED_PIN |
| 97 | +// 2. LED_BUILTIN |
| 98 | +// |
| 99 | +// LED_PIN |
| 100 | +// - Number or Symbol (D1,..) of the Output |
| 101 | +// - To turn off the LED, set LED_PIN to LED_OFF |
| 102 | +// LED_INVERTED |
| 103 | +// - false for output 3.3V on high |
| 104 | +// - true for pull down to GND on high |
| 105 | + |
| 106 | +// Board-specific configurations |
| 107 | +#if BOARD == BOARD_SLIMEVR |
| 108 | +#define PIN_IMU_SDA 14 |
| 109 | +#define PIN_IMU_SCL 12 |
| 110 | +#define PIN_IMU_INT 16 |
| 111 | +#define PIN_IMU_INT_2 13 |
| 112 | +#define PIN_BATTERY_LEVEL 17 |
| 113 | +#define LED_PIN 2 |
| 114 | +#define LED_INVERTED true |
| 115 | +#ifndef BATTERY_SHIELD_RESISTANCE |
| 116 | +#define BATTERY_SHIELD_RESISTANCE 0 |
| 117 | +#endif |
| 118 | +#ifndef BATTERY_SHIELD_R1 |
| 119 | +#define BATTERY_SHIELD_R1 10 |
| 120 | +#endif |
| 121 | +#ifndef BATTERY_SHIELD_R2 |
| 122 | +#define BATTERY_SHIELD_R2 40.2 |
| 123 | +#endif |
| 124 | +#elif BOARD == BOARD_SLIMEVR_LEGACY || BOARD == BOARD_SLIMEVR_DEV |
| 125 | +#define PIN_IMU_SDA 4 |
| 126 | +#define PIN_IMU_SCL 5 |
| 127 | +#define PIN_IMU_INT 10 |
| 128 | +#define PIN_IMU_INT_2 13 |
| 129 | +#define PIN_BATTERY_LEVEL 17 |
| 130 | +#define LED_PIN 2 |
| 131 | +#define LED_INVERTED true |
| 132 | +#ifndef BATTERY_SHIELD_RESISTANCE |
| 133 | +#define BATTERY_SHIELD_RESISTANCE 0 |
| 134 | +#endif |
| 135 | +#ifndef BATTERY_SHIELD_R1 |
| 136 | +#define BATTERY_SHIELD_R1 10 |
| 137 | +#endif |
| 138 | +#ifndef BATTERY_SHIELD_R2 |
| 139 | +#define BATTERY_SHIELD_R2 40.2 |
| 140 | +#endif |
| 141 | +#elif BOARD == BOARD_NODEMCU || BOARD == BOARD_WEMOSD1MINI |
| 142 | +#define PIN_IMU_SDA D2 |
| 143 | +#define PIN_IMU_SCL D1 |
| 144 | +#define PIN_IMU_INT D5 |
| 145 | +#define PIN_IMU_INT_2 D6 |
| 146 | +#define PIN_BATTERY_LEVEL A0 |
| 147 | +// #define LED_PIN 2 |
| 148 | +// #define LED_INVERTED true |
| 149 | +#ifndef BATTERY_SHIELD_RESISTANCE |
| 150 | +#define BATTERY_SHIELD_RESISTANCE 180 |
| 151 | +#endif |
| 152 | +#ifndef BATTERY_SHIELD_R1 |
| 153 | +#define BATTERY_SHIELD_R1 100 |
| 154 | +#endif |
| 155 | +#ifndef BATTERY_SHIELD_R2 |
| 156 | +#define BATTERY_SHIELD_R2 220 |
| 157 | +#endif |
| 158 | +#elif BOARD == BOARD_ESP01 |
| 159 | +#define PIN_IMU_SDA 2 |
| 160 | +#define PIN_IMU_SCL 0 |
51 | 161 | #define PIN_IMU_INT 255 |
52 | 162 | #define PIN_IMU_INT_2 255 |
| 163 | +#define PIN_BATTERY_LEVEL 255 |
| 164 | +#define LED_PIN LED_OFF |
| 165 | +#define LED_INVERTED false |
| 166 | +#elif BOARD == BOARD_TTGO_TBASE |
| 167 | +#define PIN_IMU_SDA 5 |
| 168 | +#define PIN_IMU_SCL 4 |
| 169 | +#define PIN_IMU_INT 14 |
| 170 | +#define PIN_IMU_INT_2 13 |
| 171 | +#define PIN_BATTERY_LEVEL A0 |
| 172 | +// #define LED_PIN 2 |
| 173 | +// #define LED_INVERTED false |
| 174 | +#elif BOARD == BOARD_CUSTOM |
| 175 | +// Define pins by the examples above |
| 176 | +#elif BOARD == BOARD_WROOM32 |
| 177 | +#define PIN_IMU_SDA 21 |
| 178 | +#define PIN_IMU_SCL 22 |
| 179 | +#define PIN_IMU_INT 23 |
| 180 | +#define PIN_IMU_INT_2 25 |
| 181 | +#define PIN_BATTERY_LEVEL 36 |
| 182 | +// #define LED_PIN 2 |
| 183 | +// #define LED_INVERTED false |
| 184 | +#elif BOARD == BOARD_LOLIN_C3_MINI |
| 185 | +#define PIN_IMU_SDA 5 |
| 186 | +#define PIN_IMU_SCL 4 |
| 187 | +#define PIN_IMU_INT 6 |
| 188 | +#define PIN_IMU_INT_2 8 |
53 | 189 | #define PIN_BATTERY_LEVEL 3 |
54 | | -#define LED_PIN 0 |
| 190 | +#define LED_PIN 7 |
| 191 | +// #define LED_INVERTED false |
| 192 | +#elif BOARD == BOARD_BEETLE32C3 |
| 193 | +#define PIN_IMU_SDA 8 |
| 194 | +#define PIN_IMU_SCL 9 |
| 195 | +#define PIN_IMU_INT 6 |
| 196 | +#define PIN_IMU_INT_2 7 |
| 197 | +#define PIN_BATTERY_LEVEL 3 |
| 198 | +#define LED_PIN 10 |
| 199 | +#define LED_INVERTED false |
| 200 | +#elif BOARD == BOARD_ES32C3DEVKITM1 || BOARD == BOARD_ES32C6DEVKITC1 |
| 201 | +#define PIN_IMU_SDA 5 |
| 202 | +#define PIN_IMU_SCL 4 |
| 203 | +#define PIN_IMU_INT 6 |
| 204 | +#define PIN_IMU_INT_2 7 |
| 205 | +#define PIN_BATTERY_LEVEL 3 |
| 206 | +#define LED_PIN \ |
| 207 | + LED_OFF // RGB LED Protocol would need to be implementetet did not brother for the |
| 208 | + // test, because the board ideal for tracker ifself |
| 209 | +// #define LED_INVERTED false |
| 210 | +#elif BOARD == BOARD_WEMOSWROOM02 |
| 211 | +#define PIN_IMU_SDA 2 |
| 212 | +#define PIN_IMU_SCL 14 |
| 213 | +#define PIN_IMU_INT 0 |
| 214 | +#define PIN_IMU_INT_2 4 |
| 215 | +#define PIN_BATTERY_LEVEL A0 |
| 216 | +#define LED_PIN 16 |
55 | 217 | #define LED_INVERTED true |
| 218 | +#elif BOARD == BOARD_XIAO_ESP32C3 |
| 219 | +#define PIN_IMU_SDA 6 // D4 |
| 220 | +#define PIN_IMU_SCL 7 // D5 |
| 221 | +#define PIN_IMU_INT 5 // D3 |
| 222 | +#define PIN_IMU_INT_2 10 // D10 |
| 223 | +#define LED_PIN 4 // D2 |
| 224 | +#define LED_INVERTED false |
| 225 | +#define PIN_BATTERY_LEVEL 2 // D0 / A0 |
56 | 226 | #ifndef BATTERY_SHIELD_RESISTANCE |
57 | 227 | #define BATTERY_SHIELD_RESISTANCE 0 |
58 | 228 | #endif |
59 | 229 | #ifndef BATTERY_SHIELD_R1 |
60 | | -#define BATTERY_SHIELD_R1 150 |
| 230 | +#define BATTERY_SHIELD_R1 100 |
61 | 231 | #endif |
62 | 232 | #ifndef BATTERY_SHIELD_R2 |
63 | | -#define BATTERY_SHIELD_R2 150 |
| 233 | +#define BATTERY_SHIELD_R2 100 |
| 234 | +#endif |
64 | 235 | #endif |
0 commit comments