This Automatic mode is the most simple lib for MCU Gear with LPC1114FN28. You don't need to think about Bank.

Dependents:   MCUGearALPC1114FN28

Fork of MCUGearA by mille feuille

Files at this revision

API Documentation at this revision

Comitter:
Info
Date:
Tue May 06 15:53:05 2014 +0000
Parent:
2:aa2e471e8317
Commit message:
Added command; void clear(void); It can clear saved IO setting.

Changed in this revision

MCUGearALPC1114.cpp Show annotated file Show diff for this revision Revisions of this file
MCUGearALPC1114.h Show annotated file Show diff for this revision Revisions of this file
commonALPC1114.h Show annotated file Show diff for this revision Revisions of this file
--- a/MCUGearALPC1114.cpp	Sat May 03 17:09:14 2014 +0000
+++ b/MCUGearALPC1114.cpp	Tue May 06 15:53:05 2014 +0000
@@ -27,7 +27,7 @@
 
 MCUGear::MCUGear(PinName scl, PinName sda, char addr)
      : _i2c(scl, sda) {
-    //_i2c.frequency(FPGA_I2C_CLOCK);
+    _i2c.frequency(FPGA_I2C_CLOCK);
     _addr = addr;   //save address
     write(0xff);    //close Module gate
     _counter = 0;
@@ -98,6 +98,9 @@
     fpga_write(0x10,_bank);//init regist///////
 }
 
+void MCUGear::clear(void){
+    _counter = 0;
+}
 
 //send I2C signal function
 void MCUGear::write(uint8_t c){
--- a/MCUGearALPC1114.h	Sat May 03 17:09:14 2014 +0000
+++ b/MCUGearALPC1114.h	Tue May 06 15:53:05 2014 +0000
@@ -33,6 +33,7 @@
         //void startReg(char bank);
         uint8_t setWireA(uint8_t mcuIO, uint8_t direction, uint8_t moduleIO);
         //void endReg(char bank);
+        void clear(void);
         
     protected:
         void fpga_write(unsigned char adr, unsigned char data);
--- a/commonALPC1114.h	Sat May 03 17:09:14 2014 +0000
+++ b/commonALPC1114.h	Tue May 06 15:53:05 2014 +0000
@@ -25,7 +25,7 @@
 
 
 #define BaudRate 9600
-#define FPGA_I2C_CLOCK    2000000
+#define FPGA_I2C_CLOCK    1000000
 #define MODULE_I2C_CLOCK    2000000
 
 //#define DEBUG //If you need to debug, define this.