Skip to content

Commit

Permalink
Adapt coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
xeonqq committed Jul 28, 2023
1 parent 76c8ce8 commit dbbb278
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions Sming/Libraries/MPU6050/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Based on code from [jrowberg/i2cdevlib](https://github.com/jrowberg/i2cdevlib/tree/master/ESP32_ESP-IDF/components/MPU6050). Most of the code is the same, except:

- Removed MPU6050::ReadRegister function due to incompatibility. It is also not used anywhere in the original code.
- Removed map function in favor of the Sming built-in one.
- Adapted include path and applied clangformat


- Removed MPU6050::ReadRegister function due to incompatibility. It is also not used anywhere in the original code.
- Removed map function in favor of the Sming built-in one.
- Adapted include path and applied clangformat
12 changes: 6 additions & 6 deletions samples/Accel_Gyro_MPU6050/app/application.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <Libraries/MPU6050/MPU6050.h>
#include <SmingCore.h>

constexpr float main_loop_interval = 0.02; // sec
SimpleTimer main_loop_timer;
constexpr float mainLoopInterval = 0.02; // sec
SimpleTimer mainLoopTimer;
MPU6050 mpu;

void print_accel_gyro(int16_t ax, int16_t ay, int16_t az, int16_t gx, int16_t gy, int16_t gz)
void printAccelGyro(int16_t ax, int16_t ay, int16_t az, int16_t gx, int16_t gy, int16_t gz)
{
Serial.print("a/g:\t");
Serial.print(ax);
Expand All @@ -21,12 +21,12 @@ void print_accel_gyro(int16_t ax, int16_t ay, int16_t az, int16_t gx, int16_t gy
Serial.println(gz);
}

void main_loop()
void mainLoop()
{
int16_t ax, ay, az;
int16_t gx, gy, gz;
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
print_accel_gyro(ax, ay, az, gx, gy, gz);
printAccelGyro(ax, ay, az, gx, gy, gz);
}

void init()
Expand All @@ -38,5 +38,5 @@ void init()
mpu.initialize();
Serial.println(mpu.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

main_loop_timer.initializeMs(static_cast<int>(main_loop_interval * 1000), main_loop).start();
mainLoopTimer.initializeMs(static_cast<int>(mainLoopInterval * 1000), mainLoop).start();
}

0 comments on commit dbbb278

Please sign in to comment.