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:
0:d42cfc64e43e
Child:
1:0368c98bf4ee
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ARD2PMD.cpp	Mon Feb 10 03:10:39 2014 +0000
@@ -0,0 +1,71 @@
+/* ARD2PMD Board Driver Library
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "ARD2PMD.h"
+#include "mbed.h"
+
+ARD2PMD::ARD2PMD(PinName sda, PinName scl, int addr) : _mux(sda, scl, addr)
+{
+}
+
+ARD2PMD::~ARD2PMD()
+{
+}
+
+void ARD2PMD::clearMux()
+{
+    _mux.clearAll();
+}
+
+void ARD2PMD::setMux(int chA, int chB)
+{
+    _mux.setAB(chA, chB);
+}
+
+int ARD2PMD::iToMux(int index)
+{
+    switch (index) {
+        case 0:
+            return PA1;
+            break;
+        case 1:
+            return PA2;
+            break;
+        case 2:
+            return PA3;
+            break;
+        case 3:
+            return PA4;
+            break;
+        case 4:
+            return PB1;
+            break;
+        case 5:
+            return PB2;
+            break;
+        case 6:
+            return PB3;
+            break;
+        case 7:
+            return PB4;
+            break;
+        default:
+            return 0;
+            break;
+    }
+}
\ No newline at end of file