mbd2pmd Adapter Board Library
This library assigns the proper pins for the mbed LPC1768 with the mbd2pmd adapter board.
- microSD pins
sd(p5, p6, p7, p8 "sd")
- mux I2C pins
mux(p28, p27)
Digital I/O
pmd[8]
is an array of pointers to the DigitalInOut objects
Index | Name | Pmod |
---|---|---|
0 | pa1 | 1 |
1 | pa2 | 2 |
2 | pa3 | 3 |
3 | pa4 | 4 |
4 | pb1 | 7 |
5 | pb2 | 8 |
6 | pb3 | 9 |
7 | pb4 | 10 |
MAX14661 Multiplexer Abstraction
mux_a[17]
is an array of integers representing the bit mask of a multiplexer switch arranged in Arduino order
Index | Pin | Name |
---|---|---|
0 | p10 | RX |
1 | p9 | TX |
2 | p30 | RD |
3 | p25 | PWM1 |
4 | p24 | PB1 |
5 | p23 | PB2 |
6 | p22 | PB3 |
7 | p21 | PB4 |
8 | p29 | TD |
9 | p26 | PWM2 |
10 | p14 | PA1 |
11 | p11 | PA2 |
12 | p12 | PA3 |
13 | p13 | PA4 |
14 | p28 | SDA |
15 | p27 | SCL |
16 | na | 0 |
mux_p[9]
is an array of integers representing the bit mask of a multiplexer switch arranged in Pmod order
Index | Pin | Name |
---|---|---|
0 | p14 | PA1 |
1 | p11 | PA2 |
2 | p12 | PA3 |
3 | p13 | PA4 |
4 | p24 | PB1 |
5 | p23 | PB2 |
6 | p22 | PB3 |
7 | p21 | PB4 |
8 | na | 0 |
Diff: mbd2pmd.cpp
- Revision:
- 0:0b4eb5eb8c18
diff -r 000000000000 -r 0b4eb5eb8c18 mbd2pmd.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbd2pmd.cpp Sat May 10 00:35:23 2014 +0000 @@ -0,0 +1,37 @@ +/* mbd2pmd Board Driver Library + * + */ + +#include "mbed.h" +#include "mbd2pmd.h" + +mbd2pmd::mbd2pmd() : + mux(p28, p27), sd(p5, p6, p7, p8, "sd"), + pa1(p14), pa2(p11), pa3(p12), pa4(p13), + pb1(p24), pb2(p23), pb3(p22), pb4(p21) +{ +} + +mbd2pmd::~mbd2pmd() +{ +} + +const int mbd2pmd::mux_a[17] = {RX, TX, RD, PWM1, PB1, PB2, PB3, PB4, TD, PWM2, PA1, PA2, PA3, PA4, SDA, SCL, 0}; +const int mbd2pmd::mux_p[9] = {PA1, PA2, PA3, PA4, PB1, PB2, PB3, PB4, 0}; + +// Initialize Digital IO to inputs with no pullups +void mbd2pmd::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(); + } +}