Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:e1d130f34972, committed 2021-05-28
- Comitter:
- mtnzmz
- Date:
- Fri May 28 17:42:45 2021 +0000
- Parent:
- 2:4e59a37182df
- Commit message:
- Fixed compile errors
Changed in this revision
diff -r 4e59a37182df -r e1d130f34972 MPU9250.h
--- a/MPU9250.h Tue Aug 05 01:37:23 2014 +0000
+++ b/MPU9250.h Fri May 28 17:42:45 2021 +0000
@@ -625,7 +625,7 @@
// Configure the accelerometer for self-test
writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, 0xE0); // Enable self test on all three axes and set accelerometer range to +/- 2 g
writeByte(MPU9250_ADDRESS, GYRO_CONFIG, 0xE0); // Enable self test on all three axes and set gyro range to +/- 250 degrees/s
- delay(25); // Delay a while to let the device stabilize
+ wait_ms(25); // Delay a while to let the device stabilize
for( int ii = 0; ii < 200; ii++) { // get average self-test values of gyro and acclerometer
@@ -648,7 +648,7 @@
// Configure the gyro and accelerometer for normal operation
writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, 0x00);
writeByte(MPU9250_ADDRESS, GYRO_CONFIG, 0x00);
- delay(25); // Delay a while to let the device stabilize
+ wait_ms(25); // Delay a while to let the device stabilize
// Retrieve accelerometer and gyro factory Self-Test Code from USR_Reg
selfTest[0] = readByte(MPU9250_ADDRESS, SELF_TEST_X_ACCEL); // X-axis accel self-test results
diff -r 4e59a37182df -r e1d130f34972 N5110.lib --- a/N5110.lib Tue Aug 05 01:37:23 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/onehorse/code/Adfs/#28c629d0b0d0
diff -r 4e59a37182df -r e1d130f34972 main.cpp
--- a/main.cpp Tue Aug 05 01:37:23 2014 +0000
+++ b/main.cpp Fri May 28 17:42:45 2021 +0000
@@ -30,7 +30,7 @@
//F401_init84 myinit(0);
#include "mbed.h"
#include "MPU9250.h"
-#include "N5110.h"
+
// Using NOKIA 5110 monochrome 84 x 48 pixel display
// pin 9 - Serial clock out (SCLK)
@@ -43,7 +43,7 @@
float sum = 0;
uint32_t sumCount = 0;
char buffer[14];
-
+float counttime=0;
MPU9250 mpu9250;
Timer t;
@@ -51,7 +51,7 @@
Serial pc(USBTX, USBRX); // tx, rx
// VCC, SCE, RST, D/C, MOSI,S CLK, LED
- N5110 lcd(PA_8, PB_10, PA_9, PA_6, PA_7, PA_5, PC_7);
+ //N5110 lcd(PA_8, PB_10, PA_9, PA_6, PA_7, PA_5, PC_7);
@@ -66,7 +66,7 @@
t.start();
- lcd.init();
+ //lcd.init();
// lcd.setBrightness(0.05);
@@ -78,11 +78,11 @@
{
pc.printf("MPU9250 WHO_AM_I is 0x%x\n\r", whoami);
pc.printf("MPU9250 is online...\n\r");
- lcd.clear();
- lcd.printString("MPU9250 is", 0, 0);
+ //lcd.clear();
+ //lcd.printString("MPU9250 is", 0, 0);
sprintf(buffer, "0x%x", whoami);
- lcd.printString(buffer, 0, 1);
- lcd.printString("shoud be 0x71", 0, 2);
+ //lcd.printString(buffer, 0, 1);
+ //lcd.printString("shoud be 0x71", 0, 2);
wait(1);
mpu9250.resetMPU9250(); // Reset registers to default in preparation for device calibration
@@ -118,11 +118,11 @@
pc.printf("Could not connect to MPU9250: \n\r");
pc.printf("%#x \n", whoami);
- lcd.clear();
- lcd.printString("MPU9250", 0, 0);
- lcd.printString("no connection", 0, 1);
+ //lcd.clear();
+ //lcd.printString("MPU9250", 0, 0);
+ //lcd.printString("no connection", 0, 1);
sprintf(buffer, "WHO_AM_I 0x%x", whoami);
- lcd.printString(buffer, 0, 2);
+ //lcd.printString(buffer, 0, 2);
while(1) ; // Loop forever if communication doesn't happen
}
@@ -179,7 +179,7 @@
mpu9250.MahonyQuaternionUpdate(ax, ay, az, gx*PI/180.0f, gy*PI/180.0f, gz*PI/180.0f, my, mx, mz);
// Serial print and/or display at 0.5 s rate independent of data rates
- delt_t = t.read_ms() - count;
+ delt_t = t.read_ms() - counttime;
if (delt_t > 500) { // update LCD once per half-second independent of read rate
pc.printf("ax = %f", 1000*ax);
@@ -238,11 +238,11 @@
// lcd.printString(buffer, 0, 5);
myled= !myled;
- count = t.read_ms();
+ counttime = t.read_ms();
- if(count > 1<<21) {
+ if(counttime > 1<<21) {
t.start(); // start the timer over again if ~30 minutes has passed
- count = 0;
+ counttime = 0;
deltat= 0;
lastUpdate = t.read_us();
}
diff -r 4e59a37182df -r e1d130f34972 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Fri May 28 17:42:45 2021 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#5941d1718339116cd12914238ec331c84da3d08f
diff -r 4e59a37182df -r e1d130f34972 mbed.bld --- a/mbed.bld Tue Aug 05 01:37:23 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877 \ No newline at end of file