41 enableReceiveIRQ(PIN); |
41 enableReceiveIRQ(PIN); |
42 |
42 |
43 while (1) { |
43 while (1) { |
44 if (available()) { |
44 if (available()) { |
45 |
45 |
46 int value = getReceivedValue(); |
46 unsigned long int value = getReceivedValue(); |
|
47 int bitlen = getReceivedBitlength(); |
47 |
48 |
48 if (value == 0) { |
49 if (value == 0) { |
49 printf("Unknown encoding\n"); |
50 printf("Unknown encoding\n"); |
50 } else { |
51 } else { |
51 printf("Received %ld/%d bit Protocol: %d\n", getReceivedValue(), getReceivedBitlength(), getReceivedProtocol() ); |
52 if (bitlen == 24) { |
|
53 printf("Received 0x%06lx/24 bit %s Protocol: %d", value, dec2binWzerofill(value, bitlen), getReceivedProtocol() ); |
|
54 if ((value & 0x00000000000003f0) == 0x0000000000000150) { |
|
55 printf(" Type A "); |
|
56 printf("%c%c%c%c%c ", (value & 0xc00000) ? '0' : '1', (value & 0x300000) ? '0' : '1', (value & 0x0c0000) ? '0' : '1', (value & 0x030000) ? '0' : '1', (value & 0x00c000) ? '0' : '1'); |
|
57 printf("%c%c%c%c%c ", (value & 0x003000) ? '0' : '1', (value & 0x000c00) ? '0' : '1', (value & 0x000300) ? '0' : '1', (value & 0x0000c0) ? '0' : '1', (value & 0x000030) ? '0' : '1'); |
|
58 } |
|
59 if ((value & 0x000000000000001c) == 0x0000000000000000) { |
|
60 printf(" Type E"); |
|
61 } |
|
62 printf("\n"); |
|
63 } else { |
|
64 printf("Received 0x%lx/%d bit %s Protocol: %d\n", value, bitlen, dec2binWzerofill(value, bitlen), getReceivedProtocol() ); |
|
65 } |
52 } |
66 } |
53 |
67 |
54 resetAvailable(); |
68 resetAvailable(); |
55 } else { |
69 } else { |
56 /* |
70 /* |