APP 4
Dependencies: mbed CRC16 mbed-rtos
Diff: APP.cpp
- Revision:
- 11:097ae746d8ac
- Parent:
- 10:51ee22e230c7
- Parent:
- 9:b937f9c6d682
- Child:
- 12:715af3660c73
- Child:
- 13:195826b8c61b
diff -r 51ee22e230c7 -r 097ae746d8ac APP.cpp --- a/APP.cpp Sun Feb 21 21:42:36 2016 +0000 +++ b/APP.cpp Sun Feb 21 21:47:13 2016 +0000 @@ -1,14 +1,13 @@ #include "APP.h" #include "Manchester.h" +#include "Frame.h" Serial pc(USBTX, USBRX); DigitalIn in(p9); bool clockTick = false; -bitset<FRAMESIZE> message(string("1000111011110101011100000000000111011010101001111111011110011010")); +bitset<FRAMESIZE> message; int counter = 0; -bitset<8> inputBuffer; -int preableCounter; int benchmark(void (*function) (void)) { @@ -23,7 +22,7 @@ { LPC_TIM2->IR |= 1 << 0; // Clear MR0 interrupt flag clockTick = !clockTick; - LPC_TIM2->EMR = encode(message[counter], clockTick); + LPC_TIM2->EMR = encode(message[counter] & 0x1, clockTick); if (clockTick) { @@ -83,12 +82,14 @@ int main() { + message = buildFrame(convertToBits("ASDF", 4, &pc), 4, &pc); + LPC_PINCON->PINSEL0 |= (3 << 12); // P0.6 = MAT2.0 initTimers(); while (true) { - pc.printf("%i", decode(in.read(), clockTick)); + pc.printf("%i ", decode(in.read(), clockTick)); wait(0.2); } }