![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
sample code for LPC810 ToraGi I2C board. you can compile it by mbed compiler.
Fork of lpc810_helloworld by
Revision 2:3d19f6b24059, committed 2014-09-09
- Comitter:
- xshige
- Date:
- Tue Sep 09 12:02:23 2014 +0000
- Parent:
- 1:67310303497a
- Commit message:
- sample code for LPC810 ToraGi I2C board.;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 67310303497a -r 3d19f6b24059 main.cpp --- a/main.cpp Wed Aug 27 04:14:22 2014 +0000 +++ b/main.cpp Tue Sep 09 12:02:23 2014 +0000 @@ -1,23 +1,49 @@ +// sample code for ToraGi I2C board(2014/2) +// please select LPC800-MAX on mbed compiler +// Note: CPU on this board is LPC810 (NOT LPC812) #include "mbed.h" -// LPC810 pinout -#define dp1 P0_5 // nRESET -#define dp2 P0_4 // WAKEUP -#define dp3 // SWCLK -#define dp4 // SWDIO -#define dp5 P0_1 // nISP -#define dp6 // VIN -#define dp7 // GND -#define dp8 P0_0 +DigitalOut myled(P0_1); -DigitalOut myled(dp8); +// generated by Switch Matrix Tool LPC810M021FN8 +//---------------------------- +// pin assigment +//---------------------------- +// Pin Function +// 1------ RESET +// 2(P0_4) I2C0_SCL +// 3------ SWCLK +// 4------ SWDIO +// 5(P0_1) PIO0_1 +// 6------ VDD +// 7------ VSS +// 8(P0_0) I2C0_SDA +//---------------------------- +void SwitchMatrix_Init() +{ + /* Enable SWM clock */ + LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7); + + /* Pin Assign 8 bit Configuration */ + /* I2C0_SDA */ + LPC_SWM->PINASSIGN7 = 0x00ffffffUL; + /* I2C0_SCL */ + LPC_SWM->PINASSIGN8 = 0xffffff04UL; + + /* Pin Assign 1 bit Configuration */ + /* SWCLK */ + /* SWDIO */ + /* RESET */ + LPC_SWM->PINENABLE0 = 0xffffffb3UL; +} int main() { + SwitchMatrix_Init(); + while(1) { myled = 1; - wait_ms(200); + wait_ms(50); myled = 0; - wait_ms(200); + wait_ms(50); } } -