Arduino to Peripheral Module adapter library

Dependents:   ARD2PMD_WebServer

This library assigns the proper pins for an Arduino compatible board with the ard2pmd adapter board.

  • mux I2C pins mux(D14, D15)

Digital I/O

pmd[8] is an array of pointers to the DigitalInOut objects

IndexNamePmod
0pa11
1pa22
2pa33
3pa44
4pb17
5pb28
6pb39
7pb410

MAX14661 Multiplexer Abstraction

mux_a[17] is an array of integers representing the bit mask of a multiplexer switch arranged in Arduino order

IndexPinName
0D0RX
1D1TX
2D2D3
3D3D4
4D4PB1
5D5PB2
6D6PB3
7D7PB4
8D8D8
9D9D9
10D10PA1
11D11PA2
12D12PA3
13D13PA4
14D14SDA
15D15SCL
16na0

mux_p[9] is an array of integers representing the bit mask of a multiplexer switch arranged in Pmod order

IndexPinName
0D10PA1
1D11PA2
2D12PA3
3D13PA4
4D4PB1
5D5PB2
6D6PB3
7D7PB4
8na0
Revision:
3:18ae8990f74b
Parent:
2:722a0e1df9a9
Child:
4:f016a009708c
--- a/ARD2PMD.h	Sat Feb 15 22:08:18 2014 +0000
+++ b/ARD2PMD.h	Sat May 10 02:05:38 2014 +0000
@@ -34,7 +34,7 @@
  * ARD2PMD a2p(p28, p27);
  *
  * int main() {
- *     a2p.setMux((ARD2PMD::RX | ARD2PMD::PA3), (ARD2PMD::TX | ARD2PMD::PA2)); 
+ *     a2p.mux.setAB((mbd2pmd::RX | mbd2pmd::PA3), (mbd2pmd::TX | mbd2pmd::PA2));
  * }
  * @endcode
  */
@@ -48,10 +48,39 @@
      * @param scl I2C clock line pin
      * @param addr MAX14661 I2C address
      */
-    ARD2PMD(PinName sda, PinName scl, int addr = 0x98);
+    ARD2PMD();
 
     ~ARD2PMD();
 
+    /** Initialize the digital pins and PWM
+     *
+     */
+    void init();
+
+    /** ard2pmd resources mux, digital IO
+    */
+    MAX14661 mux;
+    DigitalInOut pa1;
+    DigitalInOut pa2;
+    DigitalInOut pa3;
+    DigitalInOut pa4;
+    DigitalInOut pb1;
+    DigitalInOut pb2;
+    DigitalInOut pb3;
+    DigitalInOut pb4;
+
+    /** Array of pointers to the DIO pins
+    */
+    DigitalInOut *pmd[8];
+
+    /** LUT for multiplexer micro connections
+    */
+    static const int mux_a[17];
+
+    /** LUT for multiplexer PMOD connections
+    */
+    static const int mux_p[9];
+
     /** Name the register addresses
     */
     enum MUXsignals {
@@ -73,25 +102,6 @@
         SCL = MAX14661::SW09  /**< I2C Clock */
     };
 
-    /** Opens all mux switches
-     */
-    void clearMux();
-
-    /** Simultaneously sets both mux channels
-     *
-     *  @param chA the signals to route through channel A
-     *  @param chB the signals to route through channel B
-     */
-    void setMux(int chA, int chB);
-
-    /** Convert peripheral pin index to mux bit
-     *
-     *  @param index the index [7-0] of desired pin on the peripheral connector
-     */
-    int iToMux(int index);
-
-private:
-    MAX14661 _mux;
 };
 
 #endif
\ No newline at end of file