USBUART - IRQ
Dependencies: BufferedSerial MODSERIAL ST_401_84MHZ USBDevice mbed
Fork of MPU9250AHRS by
Revision 3:423c156187bd, committed 2015-12-11
- Comitter:
- banhis
- Date:
- Fri Dec 11 00:55:22 2015 +0000
- Parent:
- 2:4e59a37182df
- Child:
- 4:cebd240ac324
- Commit message:
- INCLUDE - USB2UART LIBRARIES
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BufferedSerial.lib Fri Dec 11 00:55:22 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/sam_grove/code/BufferedSerial/#779304f9c5d2
--- a/MPU9250.h Tue Aug 05 01:37:23 2014 +0000
+++ b/MPU9250.h Fri Dec 11 00:55:22 2015 +0000
@@ -151,7 +151,7 @@
#define YA_OFFSET_H 0x7A
#define YA_OFFSET_L 0x7B
#define ZA_OFFSET_H 0x7D
-#define ZA_OFFSET_L 0x7E
+#define ZA_OFFSET_L 0x0E
// Using the MSENSR-9250 breakout board, ADO is set to 0
// Seven-bit device address is 110100 for ADO = 0 and 110101 for ADO = 1
@@ -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
+ //delay(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
+ // delay(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
--- 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Fri Dec 11 00:55:22 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/USBDevice/#2af474687369
--- a/main.cpp Tue Aug 05 01:37:23 2014 +0000
+++ b/main.cpp Fri Dec 11 00:55:22 2015 +0000
@@ -30,7 +30,7 @@
//F401_init84 myinit(0);
#include "mbed.h"
#include "MPU9250.h"
-#include "N5110.h"
+//#include "N5110.h"
// Using NOKIA 5110 monochrome 84 x 48 pixel display
// pin 9 - Serial clock out (SCLK)
@@ -51,13 +51,13 @@
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);
int main()
{
- pc.baud(9600);
+ pc.baud(115200);
//Set up I2C
i2c.frequency(400000); // use fast (400 kHz) I2C
@@ -66,23 +66,23 @@
t.start();
- lcd.init();
+ //lcd.init();
// lcd.setBrightness(0.05);
// Read the WHO_AM_I register, this is a good test of communication
uint8_t whoami = mpu9250.readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250); // Read WHO_AM_I register for MPU-9250
- pc.printf("I AM 0x%x\n\r", whoami); pc.printf("I SHOULD BE 0x71\n\r");
+ pc.printf("I AM 0x%x\n\r", whoami); pc.printf("I SHOULD BE 0x74\n\r");
- if (whoami == 0x71) // WHO_AM_I should always be 0x68
+ if (whoami == 0x74) // WHO_AM_I should always be 0x68
{
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
}
