Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@2:1665cd4c922c, 2017-03-06 (annotated)
- Committer:
- ShaolinPoutine
- Date:
- Mon Mar 06 08:00:37 2017 +0000
- Revision:
- 2:1665cd4c922c
- Parent:
- 1:8b93b2102ac5
- Child:
- 3:7b1110501ef9
Manchester code + tests complete
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ShaolinPoutine | 0:529210499c6d | 1 | #include "mbed.h" |
| ShaolinPoutine | 2:1665cd4c922c | 2 | #include "rtos.h" |
| ShaolinPoutine | 2:1665cd4c922c | 3 | #define CLOCK_MAX 96000000 |
| ShaolinPoutine | 2:1665cd4c922c | 4 | |
| ShaolinPoutine | 0:529210499c6d | 5 | |
| ShaolinPoutine | 0:529210499c6d | 6 | DigitalOut myled(LED1); |
| ShaolinPoutine | 0:529210499c6d | 7 | |
| ShaolinPoutine | 2:1665cd4c922c | 8 | //Mail<char (*) [256], 16> messageBox; |
| ShaolinPoutine | 2:1665cd4c922c | 9 | Mail<char, 92 * 4> trameBox; |
| ShaolinPoutine | 2:1665cd4c922c | 10 | |
| ShaolinPoutine | 2:1665cd4c922c | 11 | bool ManchesterDecodeBit(bool* data, bool* out) |
| ShaolinPoutine | 2:1665cd4c922c | 12 | { |
| ShaolinPoutine | 2:1665cd4c922c | 13 | if (data[0] == 0 && data[1] == 1) |
| ShaolinPoutine | 2:1665cd4c922c | 14 | { |
| ShaolinPoutine | 2:1665cd4c922c | 15 | out[0] = 0; |
| ShaolinPoutine | 2:1665cd4c922c | 16 | } |
| ShaolinPoutine | 2:1665cd4c922c | 17 | else if (data[0] == 1 && data[1] == 0) |
| ShaolinPoutine | 2:1665cd4c922c | 18 | { |
| ShaolinPoutine | 2:1665cd4c922c | 19 | out[0] = 1; |
| ShaolinPoutine | 2:1665cd4c922c | 20 | } |
| ShaolinPoutine | 2:1665cd4c922c | 21 | else |
| ShaolinPoutine | 2:1665cd4c922c | 22 | { |
| ShaolinPoutine | 2:1665cd4c922c | 23 | return false; |
| ShaolinPoutine | 2:1665cd4c922c | 24 | } |
| ShaolinPoutine | 2:1665cd4c922c | 25 | return true; |
| ShaolinPoutine | 2:1665cd4c922c | 26 | } |
| ShaolinPoutine | 2:1665cd4c922c | 27 | |
| ShaolinPoutine | 2:1665cd4c922c | 28 | bool ManchesterDecodeByte(bool* data, char* out) |
| ShaolinPoutine | 2:1665cd4c922c | 29 | { |
| ShaolinPoutine | 2:1665cd4c922c | 30 | bool Valid = true; |
| ShaolinPoutine | 2:1665cd4c922c | 31 | bool tmp = true; |
| ShaolinPoutine | 2:1665cd4c922c | 32 | for (int i = 0; i < 8; i++) |
| ShaolinPoutine | 2:1665cd4c922c | 33 | { |
| ShaolinPoutine | 2:1665cd4c922c | 34 | Valid = ManchesterDecodeBit(data, &tmp); |
| ShaolinPoutine | 2:1665cd4c922c | 35 | data += 2; |
| ShaolinPoutine | 2:1665cd4c922c | 36 | if (tmp) |
| ShaolinPoutine | 2:1665cd4c922c | 37 | { |
| ShaolinPoutine | 2:1665cd4c922c | 38 | *out = *out | (0x1 << (7-i)); |
| ShaolinPoutine | 2:1665cd4c922c | 39 | } |
| ShaolinPoutine | 2:1665cd4c922c | 40 | else |
| ShaolinPoutine | 2:1665cd4c922c | 41 | { |
| ShaolinPoutine | 2:1665cd4c922c | 42 | *out = *out & ~(0x1 << (7-i)); |
| ShaolinPoutine | 2:1665cd4c922c | 43 | } |
| ShaolinPoutine | 2:1665cd4c922c | 44 | if (!Valid) |
| ShaolinPoutine | 2:1665cd4c922c | 45 | { |
| ShaolinPoutine | 2:1665cd4c922c | 46 | return false; |
| ShaolinPoutine | 2:1665cd4c922c | 47 | } |
| ShaolinPoutine | 2:1665cd4c922c | 48 | } |
| ShaolinPoutine | 2:1665cd4c922c | 49 | return true; |
| ShaolinPoutine | 2:1665cd4c922c | 50 | } |
| ShaolinPoutine | 2:1665cd4c922c | 51 | |
| ShaolinPoutine | 2:1665cd4c922c | 52 | void ManchesterEncode(bool data, bool* out) |
| ShaolinPoutine | 2:1665cd4c922c | 53 | { |
| ShaolinPoutine | 2:1665cd4c922c | 54 | if (data == 0) |
| ShaolinPoutine | 2:1665cd4c922c | 55 | { |
| ShaolinPoutine | 2:1665cd4c922c | 56 | out[0] = 0; |
| ShaolinPoutine | 2:1665cd4c922c | 57 | out[1] = 1; |
| ShaolinPoutine | 2:1665cd4c922c | 58 | } |
| ShaolinPoutine | 2:1665cd4c922c | 59 | else |
| ShaolinPoutine | 2:1665cd4c922c | 60 | { |
| ShaolinPoutine | 2:1665cd4c922c | 61 | out[0] = 1; |
| ShaolinPoutine | 2:1665cd4c922c | 62 | out[1] = 0; |
| ShaolinPoutine | 2:1665cd4c922c | 63 | } |
| ShaolinPoutine | 2:1665cd4c922c | 64 | } |
| ShaolinPoutine | 2:1665cd4c922c | 65 | |
| ShaolinPoutine | 2:1665cd4c922c | 66 | void ManchesterEncode(char data, bool* out) |
| ShaolinPoutine | 2:1665cd4c922c | 67 | { |
| ShaolinPoutine | 2:1665cd4c922c | 68 | for (int i = 0; i < 8; i++) |
| ShaolinPoutine | 2:1665cd4c922c | 69 | { |
| ShaolinPoutine | 2:1665cd4c922c | 70 | ManchesterEncode((bool) ((data >> (7 - i)) & 1), &(out[2*i])); |
| ShaolinPoutine | 2:1665cd4c922c | 71 | } |
| ShaolinPoutine | 2:1665cd4c922c | 72 | } |
| ShaolinPoutine | 2:1665cd4c922c | 73 | |
| ShaolinPoutine | 2:1665cd4c922c | 74 | void CreateAndSendTrame() |
| ShaolinPoutine | 2:1665cd4c922c | 75 | { |
| ShaolinPoutine | 2:1665cd4c922c | 76 | |
| ShaolinPoutine | 2:1665cd4c922c | 77 | } |
| ShaolinPoutine | 2:1665cd4c922c | 78 | |
| ShaolinPoutine | 1:8b93b2102ac5 | 79 | extern "C" void TIMER2_IRQHandler (void) |
| ShaolinPoutine | 1:8b93b2102ac5 | 80 | { |
| ShaolinPoutine | 1:8b93b2102ac5 | 81 | if((LPC_TIM2->IR & 0x01) == 0x01) // if MR0 interrupt, proceed |
| ShaolinPoutine | 1:8b93b2102ac5 | 82 | { |
| ShaolinPoutine | 1:8b93b2102ac5 | 83 | LPC_TIM2->IR |= 1 << 0; // Clear MR0 interrupt flag |
| ShaolinPoutine | 0:529210499c6d | 84 | } |
| ShaolinPoutine | 0:529210499c6d | 85 | } |
| ShaolinPoutine | 1:8b93b2102ac5 | 86 | |
| ShaolinPoutine | 1:8b93b2102ac5 | 87 | void init_clk() |
| ShaolinPoutine | 1:8b93b2102ac5 | 88 | { |
| ShaolinPoutine | 1:8b93b2102ac5 | 89 | LPC_PINCON->PINSEL0 |=3<<12; //P0.6 = MAT2.0 // p8 |
| ShaolinPoutine | 1:8b93b2102ac5 | 90 | LPC_SC->PCLKSEL1 |=1<<12; //pclk timer2 = cclk |
| ShaolinPoutine | 1:8b93b2102ac5 | 91 | LPC_SC->PCONP |=1<<22; //timer2 power on |
| ShaolinPoutine | 2:1665cd4c922c | 92 | LPC_TIM2->MR0 = CLOCK_MAX / 2; // 1 sec period |
| ShaolinPoutine | 1:8b93b2102ac5 | 93 | LPC_TIM2->MCR = 3; //interrupt and reset control |
| ShaolinPoutine | 1:8b93b2102ac5 | 94 | //3 = Interrupt & reset timer2 on match |
| ShaolinPoutine | 1:8b93b2102ac5 | 95 | //1 = Interrupt only, no reset of timer0 |
| ShaolinPoutine | 1:8b93b2102ac5 | 96 | LPC_TIM2->EMR =3<<4; //EMC0 = 11 (Toogle) |
| ShaolinPoutine | 1:8b93b2102ac5 | 97 | NVIC_EnableIRQ(TIMER2_IRQn); //enable timer2 interrupt |
| ShaolinPoutine | 1:8b93b2102ac5 | 98 | LPC_TIM2->TCR = 1; //enable Timer2 |
| ShaolinPoutine | 1:8b93b2102ac5 | 99 | } |
| ShaolinPoutine | 2:1665cd4c922c | 100 | void TestManchester(); |
| ShaolinPoutine | 2:1665cd4c922c | 101 | void mainRaph() |
| ShaolinPoutine | 1:8b93b2102ac5 | 102 | { |
| ShaolinPoutine | 1:8b93b2102ac5 | 103 | init_clk(); |
| ShaolinPoutine | 2:1665cd4c922c | 104 | TestManchester(); |
| ShaolinPoutine | 1:8b93b2102ac5 | 105 | } |
| ShaolinPoutine | 1:8b93b2102ac5 | 106 | |
| ShaolinPoutine | 1:8b93b2102ac5 | 107 | void tick() |
| ShaolinPoutine | 1:8b93b2102ac5 | 108 | { |
| ShaolinPoutine | 1:8b93b2102ac5 | 109 | myled = !myled; |
| ShaolinPoutine | 1:8b93b2102ac5 | 110 | } |
| ShaolinPoutine | 1:8b93b2102ac5 | 111 | int main() { |
| ShaolinPoutine | 1:8b93b2102ac5 | 112 | Ticker ticker; |
| ShaolinPoutine | 1:8b93b2102ac5 | 113 | ticker.attach(&tick, 0.5); |
| ShaolinPoutine | 2:1665cd4c922c | 114 | wait(2); |
| ShaolinPoutine | 2:1665cd4c922c | 115 | mainRaph(); |
| ShaolinPoutine | 1:8b93b2102ac5 | 116 | } |
| ShaolinPoutine | 2:1665cd4c922c | 117 | |
| ShaolinPoutine | 2:1665cd4c922c | 118 | |
| ShaolinPoutine | 2:1665cd4c922c | 119 | |
| ShaolinPoutine | 2:1665cd4c922c | 120 | //--------------------------------TEST---------------------------------------------------// |
| ShaolinPoutine | 2:1665cd4c922c | 121 | |
| ShaolinPoutine | 2:1665cd4c922c | 122 | void TestManchester() |
| ShaolinPoutine | 2:1665cd4c922c | 123 | { |
| ShaolinPoutine | 2:1665cd4c922c | 124 | printf("TestManchester - Begin\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 125 | |
| ShaolinPoutine | 2:1665cd4c922c | 126 | // ----------------------------ENCODE-----------------------------------------------// |
| ShaolinPoutine | 2:1665cd4c922c | 127 | bool Valid = true; |
| ShaolinPoutine | 2:1665cd4c922c | 128 | bool boolData0 = (char) 0b0; |
| ShaolinPoutine | 2:1665cd4c922c | 129 | bool boolExpected0[] = {0,1}; |
| ShaolinPoutine | 2:1665cd4c922c | 130 | bool boolAns0[2]; |
| ShaolinPoutine | 2:1665cd4c922c | 131 | |
| ShaolinPoutine | 2:1665cd4c922c | 132 | ManchesterEncode(boolData0, (bool *) boolAns0); |
| ShaolinPoutine | 2:1665cd4c922c | 133 | |
| ShaolinPoutine | 2:1665cd4c922c | 134 | int i = 0; |
| ShaolinPoutine | 2:1665cd4c922c | 135 | Valid = true; |
| ShaolinPoutine | 2:1665cd4c922c | 136 | while (Valid && i < 2) |
| ShaolinPoutine | 2:1665cd4c922c | 137 | { |
| ShaolinPoutine | 2:1665cd4c922c | 138 | Valid = !(boolExpected0[i] ^ boolAns0[i]); |
| ShaolinPoutine | 2:1665cd4c922c | 139 | i++; |
| ShaolinPoutine | 2:1665cd4c922c | 140 | } |
| ShaolinPoutine | 2:1665cd4c922c | 141 | |
| ShaolinPoutine | 2:1665cd4c922c | 142 | if (!Valid) |
| ShaolinPoutine | 2:1665cd4c922c | 143 | { |
| ShaolinPoutine | 2:1665cd4c922c | 144 | printf("TestManchester - encode - bool0 - Failed\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 145 | printf("Expected: [%d, %d]. Received: [%d, %d].\r\n\n", boolExpected0[0], boolExpected0[1], boolAns0[0], boolAns0[1]); |
| ShaolinPoutine | 2:1665cd4c922c | 146 | } |
| ShaolinPoutine | 2:1665cd4c922c | 147 | |
| ShaolinPoutine | 2:1665cd4c922c | 148 | bool boolData1 = (char) 0b1; |
| ShaolinPoutine | 2:1665cd4c922c | 149 | bool boolExpected1[] = {1,0}; |
| ShaolinPoutine | 2:1665cd4c922c | 150 | bool boolAns1[2]; |
| ShaolinPoutine | 2:1665cd4c922c | 151 | ManchesterEncode(boolData1, (bool*) boolAns1); |
| ShaolinPoutine | 2:1665cd4c922c | 152 | |
| ShaolinPoutine | 2:1665cd4c922c | 153 | i = 0; |
| ShaolinPoutine | 2:1665cd4c922c | 154 | Valid = true; |
| ShaolinPoutine | 2:1665cd4c922c | 155 | while (Valid && i < 2) |
| ShaolinPoutine | 2:1665cd4c922c | 156 | { |
| ShaolinPoutine | 2:1665cd4c922c | 157 | Valid = !(boolExpected1[i] ^ boolAns1[i]); |
| ShaolinPoutine | 2:1665cd4c922c | 158 | i++; |
| ShaolinPoutine | 2:1665cd4c922c | 159 | } |
| ShaolinPoutine | 2:1665cd4c922c | 160 | if (!Valid) |
| ShaolinPoutine | 2:1665cd4c922c | 161 | { |
| ShaolinPoutine | 2:1665cd4c922c | 162 | printf("TestManchester - encode - boo11 - Failed\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 163 | printf("Expected: [%d, %d]. Received: [%d, %d].\r\n\n", boolExpected1[0], boolExpected1[1], boolAns1[0], boolAns1[1]); |
| ShaolinPoutine | 2:1665cd4c922c | 164 | } |
| ShaolinPoutine | 2:1665cd4c922c | 165 | |
| ShaolinPoutine | 2:1665cd4c922c | 166 | char charData = (char) 0b01010101; |
| ShaolinPoutine | 2:1665cd4c922c | 167 | bool charExpected[] = {0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0}; |
| ShaolinPoutine | 2:1665cd4c922c | 168 | bool charAns[16]; |
| ShaolinPoutine | 2:1665cd4c922c | 169 | ManchesterEncode(charData, (bool*) charAns); |
| ShaolinPoutine | 2:1665cd4c922c | 170 | |
| ShaolinPoutine | 2:1665cd4c922c | 171 | i = 0; |
| ShaolinPoutine | 2:1665cd4c922c | 172 | Valid = true; |
| ShaolinPoutine | 2:1665cd4c922c | 173 | while (Valid && i < 16) |
| ShaolinPoutine | 2:1665cd4c922c | 174 | { |
| ShaolinPoutine | 2:1665cd4c922c | 175 | Valid = !(charExpected[i] ^ charAns[i]); |
| ShaolinPoutine | 2:1665cd4c922c | 176 | i++; |
| ShaolinPoutine | 2:1665cd4c922c | 177 | } |
| ShaolinPoutine | 2:1665cd4c922c | 178 | if (!Valid) |
| ShaolinPoutine | 2:1665cd4c922c | 179 | { |
| ShaolinPoutine | 2:1665cd4c922c | 180 | printf("TestManchester - encode - char - Failed\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 181 | printf("Expected: [%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d]\r\nReceived: [%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d].\r\n\n", |
| ShaolinPoutine | 2:1665cd4c922c | 182 | charExpected[0], charExpected[1], charExpected[2], charExpected[3], |
| ShaolinPoutine | 2:1665cd4c922c | 183 | charExpected[4], charExpected[5], charExpected[6], charExpected[7], |
| ShaolinPoutine | 2:1665cd4c922c | 184 | charExpected[8], charExpected[9], charExpected[10], charExpected[11], |
| ShaolinPoutine | 2:1665cd4c922c | 185 | charExpected[12], charExpected[13], charExpected[14], charExpected[15], |
| ShaolinPoutine | 2:1665cd4c922c | 186 | charAns[0], charAns[1], charAns[2], charAns[3], |
| ShaolinPoutine | 2:1665cd4c922c | 187 | charAns[4], charAns[5], charAns[6], charAns[7], |
| ShaolinPoutine | 2:1665cd4c922c | 188 | charAns[8], charAns[9], charAns[10], charAns[11], |
| ShaolinPoutine | 2:1665cd4c922c | 189 | charAns[12], charAns[13], charAns[14], charAns[15]); |
| ShaolinPoutine | 2:1665cd4c922c | 190 | } |
| ShaolinPoutine | 2:1665cd4c922c | 191 | |
| ShaolinPoutine | 2:1665cd4c922c | 192 | // ----------------------------DECODE-----------------------------------------------// |
| ShaolinPoutine | 2:1665cd4c922c | 193 | Valid = true; |
| ShaolinPoutine | 2:1665cd4c922c | 194 | bool boolDecodeData0[] = {0,1}; |
| ShaolinPoutine | 2:1665cd4c922c | 195 | bool boolDecodeExpected0 = 0b0; |
| ShaolinPoutine | 2:1665cd4c922c | 196 | bool boolDecodeAns0; |
| ShaolinPoutine | 2:1665cd4c922c | 197 | bool Success = true; |
| ShaolinPoutine | 2:1665cd4c922c | 198 | Success = ManchesterDecodeBit((bool *)boolDecodeData0, &boolDecodeAns0); |
| ShaolinPoutine | 2:1665cd4c922c | 199 | |
| ShaolinPoutine | 2:1665cd4c922c | 200 | if (!Success) |
| ShaolinPoutine | 2:1665cd4c922c | 201 | { |
| ShaolinPoutine | 2:1665cd4c922c | 202 | printf("TestManchester - decode - bool0 - Invalid format\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 203 | } |
| ShaolinPoutine | 2:1665cd4c922c | 204 | |
| ShaolinPoutine | 2:1665cd4c922c | 205 | if (boolDecodeExpected0 != boolDecodeAns0) |
| ShaolinPoutine | 2:1665cd4c922c | 206 | { |
| ShaolinPoutine | 2:1665cd4c922c | 207 | printf("TestManchester - decode - bool0 - Failed\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 208 | printf("Expected: %d. Received: %d.\r\n\n", boolDecodeExpected0, boolDecodeAns0); |
| ShaolinPoutine | 2:1665cd4c922c | 209 | } |
| ShaolinPoutine | 2:1665cd4c922c | 210 | |
| ShaolinPoutine | 2:1665cd4c922c | 211 | bool boolDecodeData1[] = {1,0}; |
| ShaolinPoutine | 2:1665cd4c922c | 212 | bool boolDecodeExpected1 = (char) 0b1; |
| ShaolinPoutine | 2:1665cd4c922c | 213 | bool boolDecodeAns1; |
| ShaolinPoutine | 2:1665cd4c922c | 214 | Success = ManchesterDecodeBit((bool *)boolDecodeData1, &boolDecodeAns1); |
| ShaolinPoutine | 2:1665cd4c922c | 215 | |
| ShaolinPoutine | 2:1665cd4c922c | 216 | if (!Success) |
| ShaolinPoutine | 2:1665cd4c922c | 217 | { |
| ShaolinPoutine | 2:1665cd4c922c | 218 | printf("TestManchester - decode - bool1 - Invalid format\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 219 | } |
| ShaolinPoutine | 2:1665cd4c922c | 220 | if (boolDecodeExpected1 != boolDecodeAns1) |
| ShaolinPoutine | 2:1665cd4c922c | 221 | { |
| ShaolinPoutine | 2:1665cd4c922c | 222 | printf("TestManchester - decode - boo11 - Failed\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 223 | printf("Expected: %d. Received: %d\r\n\n", boolDecodeExpected1, boolDecodeAns1); |
| ShaolinPoutine | 2:1665cd4c922c | 224 | } |
| ShaolinPoutine | 2:1665cd4c922c | 225 | |
| ShaolinPoutine | 2:1665cd4c922c | 226 | bool boolDataInv0[] = {0,0}; |
| ShaolinPoutine | 2:1665cd4c922c | 227 | bool boolDataInv1[] = {0,0}; |
| ShaolinPoutine | 2:1665cd4c922c | 228 | bool boolAnsInv; |
| ShaolinPoutine | 2:1665cd4c922c | 229 | Success = ManchesterDecodeBit((bool *)boolDataInv0, (bool*) boolAnsInv); |
| ShaolinPoutine | 2:1665cd4c922c | 230 | if (Success) |
| ShaolinPoutine | 2:1665cd4c922c | 231 | { |
| ShaolinPoutine | 2:1665cd4c922c | 232 | printf("TestManchester - decode - boolInv0 - Invalid format not caught\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 233 | } |
| ShaolinPoutine | 2:1665cd4c922c | 234 | Success = ManchesterDecodeBit((bool *)boolDataInv1, (bool*) boolAnsInv); |
| ShaolinPoutine | 2:1665cd4c922c | 235 | if (Success) |
| ShaolinPoutine | 2:1665cd4c922c | 236 | { |
| ShaolinPoutine | 2:1665cd4c922c | 237 | printf("TestManchester - decode - boolInv1 - Invalid format not caught\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 238 | } |
| ShaolinPoutine | 2:1665cd4c922c | 239 | |
| ShaolinPoutine | 2:1665cd4c922c | 240 | |
| ShaolinPoutine | 2:1665cd4c922c | 241 | bool charEncodeData[] = {0,1,0,1,1,0,0,1,1,0,0,1,1,0,0,1}; |
| ShaolinPoutine | 2:1665cd4c922c | 242 | char charEncodeExpected = 42; |
| ShaolinPoutine | 2:1665cd4c922c | 243 | char charEncodeAns; |
| ShaolinPoutine | 2:1665cd4c922c | 244 | Valid = ManchesterDecodeByte(charEncodeData, &charEncodeAns); |
| ShaolinPoutine | 2:1665cd4c922c | 245 | |
| ShaolinPoutine | 2:1665cd4c922c | 246 | if (!Valid) |
| ShaolinPoutine | 2:1665cd4c922c | 247 | { |
| ShaolinPoutine | 2:1665cd4c922c | 248 | printf("Function detected error in format\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 249 | } |
| ShaolinPoutine | 2:1665cd4c922c | 250 | else if (charEncodeExpected != charEncodeAns) |
| ShaolinPoutine | 2:1665cd4c922c | 251 | { |
| ShaolinPoutine | 2:1665cd4c922c | 252 | printf("TestManchester - decode - char - Failed\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 253 | printf("Expected: %d\t\tReceived: %d\r\n", |
| ShaolinPoutine | 2:1665cd4c922c | 254 | charEncodeExpected, charEncodeAns); |
| ShaolinPoutine | 2:1665cd4c922c | 255 | } |
| ShaolinPoutine | 2:1665cd4c922c | 256 | |
| ShaolinPoutine | 2:1665cd4c922c | 257 | printf("TestManchester - End\r\n"); |
| ShaolinPoutine | 2:1665cd4c922c | 258 | } |