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

Committer:
Info
Date:
Sun Mar 09 09:33:14 2014 +0000
Revision:
0:12d93184b350
Child:
1:95255bae41c8
Automatic module changer for MCU Gear. It make circuit each time. You don't need to think about the Bank.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Info 0:12d93184b350 1 /* MCU Gear Library, only for testing MCUGear without any circuit you connected.
Info 0:12d93184b350 2 * Copyright (c) 2013, NestEgg Inc., http://www.mcugear.com/
Info 0:12d93184b350 3 *
Info 0:12d93184b350 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
Info 0:12d93184b350 5 * of this software and associated documentation files (the "Software"), to deal
Info 0:12d93184b350 6 * in the Software without restriction, including without limitation the rights
Info 0:12d93184b350 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Info 0:12d93184b350 8 * copies of the Software, and to permit persons to whom the Software is
Info 0:12d93184b350 9 * furnished to do so, subject to the following conditions:
Info 0:12d93184b350 10 *
Info 0:12d93184b350 11 * The above copyright notice and this permission notice shall be included in
Info 0:12d93184b350 12 * all copies or substantial portions of the Software.
Info 0:12d93184b350 13 *
Info 0:12d93184b350 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Info 0:12d93184b350 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Info 0:12d93184b350 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Info 0:12d93184b350 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Info 0:12d93184b350 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Info 0:12d93184b350 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Info 0:12d93184b350 20 * THE SOFTWARE.
Info 0:12d93184b350 21 */
Info 0:12d93184b350 22
Info 0:12d93184b350 23 #include "commonA.h"
Info 0:12d93184b350 24
Info 0:12d93184b350 25 class MCUGear
Info 0:12d93184b350 26 {
Info 0:12d93184b350 27 public:
Info 0:12d93184b350 28 MCUGear(PinName sda, PinName scl, char addr);
Info 0:12d93184b350 29 void disconnectModule(void);
Info 0:12d93184b350 30 void connectModuleA(void);
Info 0:12d93184b350 31 void savePinSetting(uint8_t number, unsigned char CPUPin, unsigned char Direction ,unsigned char ModulePin);
Info 0:12d93184b350 32 uint8_t detectModule(void);
Info 0:12d93184b350 33 //void startReg(char bank);
Info 0:12d93184b350 34 uint8_t setWireA(uint8_t mcuIO, uint8_t direction, uint8_t moduleIO);
Info 0:12d93184b350 35 //void endReg(char bank);
Info 0:12d93184b350 36
Info 0:12d93184b350 37 protected:
Info 0:12d93184b350 38 void fpga_write(unsigned char adr, unsigned char data);
Info 0:12d93184b350 39 void write(uint8_t c);
Info 0:12d93184b350 40 void startReg(char bank);
Info 0:12d93184b350 41 void endReg(void);
Info 0:12d93184b350 42 void saveWire(uint8_t mcuIO, uint8_t moduleIO);
Info 0:12d93184b350 43
Info 0:12d93184b350 44 uint8_t _addr;
Info 0:12d93184b350 45 uint8_t _pnum;
Info 0:12d93184b350 46 I2C _i2c;
Info 0:12d93184b350 47 char _bank;
Info 0:12d93184b350 48 uint8_t _mcuIO[16];
Info 0:12d93184b350 49 uint8_t _moduleIO[16];
Info 0:12d93184b350 50 int _counter;
Info 0:12d93184b350 51
Info 0:12d93184b350 52 typedef enum {
Info 0:12d93184b350 53 IO_REG_EN = 0x80,
Info 0:12d93184b350 54 IO_REG_OUT_DIR = 0x40,
Info 0:12d93184b350 55 IO_REG_IN_DIR = 0x00,
Info 0:12d93184b350 56 IO_REG_DISABLE = 0x3f
Info 0:12d93184b350 57 } en_fpga_io_reg;
Info 0:12d93184b350 58
Info 0:12d93184b350 59 };
Info 0:12d93184b350 60
Info 0:12d93184b350 61
Info 0:12d93184b350 62