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

ARD2PMD.cpp

Committer:
gsteiert
Date:
2014-05-10
Revision:
3:18ae8990f74b
Parent:
1:0368c98bf4ee

File content as of revision 3:18ae8990f74b:

/* ARD2PMD Board Driver Library
 *
 */

#include "ARD2PMD.h"
#include "mbed.h"

ARD2PMD::ARD2PMD() : 
    pa1(D10), pa2(D11), pa3(D12), pa4(D13),
    pb1(D4), pb2(D5), pb3(D6), pb4(D7),
    mux(D14, D15)
{
}

ARD2PMD::~ARD2PMD()
{
}

const int ARD2PMD::mux_a[17] = {RX, TX, D2, D3, PB1, PB2, PB3, PB4, D8, D9, PA1, PA2, PA3, PA4, SDA, SCL, 0};
const int ARD2PMD::mux_p[9] = {PA1, PA2, PA3, PA4, PB1, PB2, PB3, PB4, 0};

// Initialize Digital IO to inputs with no pullups
void ARD2PMD::init()
{
    pmd[0] = &pa1;
    pmd[1] = &pa2;
    pmd[2] = &pa3;
    pmd[3] = &pa4;
    pmd[4] = &pb1;
    pmd[5] = &pb2;
    pmd[6] = &pb3;
    pmd[7] = &pb4;
    for (int i=0; i < 8; i++) {
        (*pmd[i]).mode(PullNone);
        (*pmd[i]).input();
    }
}