Skip to content

Commit

Permalink
maybe works for esp32
Browse files Browse the repository at this point in the history
  • Loading branch information
memeb4082 committed Aug 8, 2024
1 parent 39704a1 commit efaf7c7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
8 changes: 8 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ lib_deps =
sparkfun/SparkFun BMI270 Arduino Library@^1.0.2
dfrobot/DFRobot_QMC5883@^1.0.0
dfrobot/DFRobot_BMP3XX @ ^1.0.3
[env:esp32]
platform = espressif32
board = esp32-s3-devkitm-1
framework = arduino
lib_deps =
sparkfun/SparkFun BMI270 Arduino Library@^1.0.2
dfrobot/DFRobot_QMC5883@^1.0.0
dfrobot/DFRobot_BMP3XX @ ^1.0.3
20 changes: 14 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include "SparkFun_BMI270_Arduino_Library.h"
// #include "DFRobot_QMC5883.h"
#include "DFRobot_BMP3XX.h"
#include <HardwareSerial.h>

#define I2C_SDA 20
#define I2C_SCL 21
#define SerialUSB Serial2

// put function declarations here:
// the pi pico has its pin
Expand All @@ -17,10 +22,12 @@
// RFD900_RADIO TX ---> 12
// RFD900_RADIO RX ---> 13

TwoWire WireI2C(20, 21);
UART RFD900_RADIO(12, 13);
// TwoWire WireI2C(20, 21);
// TwoWire I2C = TwoWire(0/); /* create i2c instance */
// UART RFD900_RADIO(12, 13);
HardwareSerial RFD900_RADIO(1);
// DFRobot_QMC5883 compass(&WireI2C, /*I2C addr*/QMC5883_ADDRESS);
DFRobot_BMP388_I2C baro(&WireI2C, baro.eSDOGND);
DFRobot_BMP388_I2C baro(&Wire, baro.eSDOGND);
BMI270 imu;
volatile float declinationAngle = (11.0 + (7.0 / 60.0)) / (180 / PI);
uint8_t bmiAddress = BMI2_I2C_PRIM_ADDR; // 0x68
Expand All @@ -45,9 +52,10 @@ struct {

void setup() {
// SETUP i2c and virtual serial port and RFD900_RADIO
WireI2C.begin();
Wire.begin();
// I2C.begin(I2C_SDA, I2C_SCL); /* initialise i2c bus with sda and scl, third arg clock freq tbd*/
SerialUSB.begin(9600);
RFD900_RADIO.begin(9600);
RFD900_RADIO.begin(9600, 12, 13);
pinMode(25, OUTPUT);

// SETUP QMC5883L on WireI2C
Expand Down Expand Up @@ -81,7 +89,7 @@ void setup() {


// setup BMI270 on WireI2C
while(imu.beginI2C(bmiAddress, WireI2C) != BMI2_OK)
while(imu.beginI2C(bmiAddress, Wire) != BMI2_OK)
{
// Not connected, inform user
SerialUSB.println("Error: BMI270 not connected, check wiring and I2C address!");
Expand Down
2 changes: 2 additions & 0 deletions test/README
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ in the development cycle.

More information about PlatformIO Unit Testing:
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html


0 comments on commit efaf7c7

Please sign in to comment.