mbed apps shield
Dependencies: C12832 LM75B MMA7660 mbed
Fork of u-blox-shield by
Revision 2:989f84939300, committed 2014-01-30
- Comitter:
- chris
- Date:
- Thu Jan 30 17:18:10 2014 +0000
- Parent:
- 1:e50da1f1f653
- Commit message:
- example apps shield
Changed in this revision
diff -r e50da1f1f653 -r 989f84939300 C12832.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Thu Jan 30 17:18:10 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/chris/code/C12832/#67dfa5550b73
diff -r e50da1f1f653 -r 989f84939300 C12832_lcd_fork.lib --- a/C12832_lcd_fork.lib Wed Jan 08 16:58:55 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://mbed.org/users/chris/code/C12832_lcd_fork/#b834d587bf45
diff -r e50da1f1f653 -r 989f84939300 arduino.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arduino.h Thu Jan 30 17:18:10 2014 +0000 @@ -0,0 +1,62 @@ + + +// u-blox C027 + +/* +#define ARD_A0 P0_23 +#define ARD_A1 P0_24 +#define ARD_A2 P0_25 +#define ARD_A3 P0_26 +#define ARD_A4 P0_30 +#define ARD_A5 P1_31 + +#define ARD_D0 P4_29 +#define ARD_D1 P4_28 +#define ARD_D2 P2_13 +#define ARD_D3 P2_0 +#define ARD_D4 P2_12 +#define ARD_D5 P2_1 +#define ARD_D6 P2_2 +#define ARD_D7 P2_11 + +#define ARD_D8 P2_4 +#define ARD_D9 P2_3 +#define ARD_D10 P1_21 +#define ARD_D11 P1_24 +#define ARD_D12 P1_23 +#define ARD_D13 P1_20 + +#define ARD_SDA P0_0 +#define ARD_SCL P0_1 +*/ + + +// ST Nucleo STM32F103RB + +#define ARD_A0 P0_23 +#define ARD_A1 P0_24 +#define ARD_A2 P0_25 +#define ARD_A3 P0_26 +#define ARD_A4 P0_30 +#define ARD_A5 P1_31 + +#define ARD_D0 P4_29 +#define ARD_D1 P4_28 +#define ARD_D2 P2_13 +#define ARD_D3 P2_0 +#define ARD_D4 P2_12 +#define ARD_D5 P2_1 +#define ARD_D6 P2_2 +#define ARD_D7 P2_11 + +#define ARD_D8 P2_4 +#define ARD_D9 P2_3 +#define ARD_D10 P1_21 +#define ARD_D11 P1_24 +#define ARD_D12 P1_23 +#define ARD_D13 P1_20 + +#define ARD_SDA P0_0 +#define ARD_SCL P0_1 + +
diff -r e50da1f1f653 -r 989f84939300 main.cpp --- a/main.cpp Wed Jan 08 16:58:55 2014 +0000 +++ b/main.cpp Thu Jan 30 17:18:10 2014 +0000 @@ -1,43 +1,33 @@ #include "mbed.h" -#include "C12832_lcd.h" +#include "arduino.h" +#include "C12832.h" #include "LM75B.h" #include "MMA7660.h" -// Map the LPC1768 pins to the arduino pin names -// These are the only things that are constant between ARCH, FRDM, u-blox etc -#define ARD_D5 P2_1 -#define ARD_D7 P2_11 -#define ARD_D10 P1_21 -#define ARD_D11 P1_24 -#define ARD_D12 P1_23 -#define ARD_D13 P1_20 -#define ARD_SDA P0_0 -#define ARD_SCL P0_1 + + +C12832_LCD lcd(ARD_D11,ARD_D13, ARD_D12, ARD_D7, ARD_D10); DigitalOut redled(ARD_D5); +DigitalOut blueled(ARD_D8); +DigitalOut greenled(ARD_D9); LM75B sensor(ARD_SDA,ARD_SCL); MMA7660 MMA(ARD_SDA,ARD_SCL); -// ==== Using SDK primitives ====== -// Construct the required pin functions, this works! +DigitalOut spk(ARD_D6); + +AnalogIn pot1 (ARD_A0); +AnalogIn pot2 (ARD_A1); -/* -DigitalOut a_d7 (ARD_D7); // a0 -DigitalOut a_d10 (ARD_D10); // nCS -DigitalOut a_d12 (ARD_D12); // reset -SPI myspi (ARD_D11,NC,ARD_D13); // MOSI -*/ +DigitalIn up(ARD_A2); +DigitalIn down(ARD_A3); +DigitalIn left(ARD_A4); +AnalogIn right(ARD_A5); +DigitalIn center(ARD_D4); -// ==== Using the LCD library ====== - -// Use my fork of the original library that allows pin names to be passed in -// This works on KL25Z and Seeedstudio Arch -// C12832_LCD(PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs, const char* name = "LCD"); -// using this causes the program to hang -C12832_LCD lcd(ARD_D11, ARD_D13, ARD_D12, ARD_D7, ARD_D10); @@ -46,15 +36,13 @@ int i=0; - - + while(1) { lcd.cls(); lcd.locate(0,3); lcd.printf("Temp = %.3f", (float)sensor); lcd.locate(0,14); lcd.printf("x=%.2f y=%.2f z=%.2f",MMA.x(), MMA.y(), MMA.z()); - redled = !redled; wait(1.0); i++;