16 uint32_t address1 = ((data.rc_code_1 & 0xff00) | (~(data.rc_code_1 >> 8) & 0xff));
17 uint32_t address2 = ((data.rc_code_2 & 0xff00) | (~(data.rc_code_2 >> 8) & 0xff));
21 for (
uint32_t bit = 0; bit < 4; bit++) {
22 if ((data.rc_code_1 >> bit) & 1)
23 command1 |= (1UL << (7 - bit));
26 for (
uint32_t bit = 0; bit < 4; bit++) {
27 if ((data.rc_code_1 >> (bit + 4)) & 1)
28 command1 |= (1UL << (3 - bit));
31 for (
uint32_t bit = 0; bit < 4; bit++) {
32 if ((data.rc_code_2 >> bit) & 1)
33 command2 |= (1UL << (7 - bit));
36 for (
uint32_t bit = 0; bit < 4; bit++) {
37 if ((data.rc_code_2 >> (bit + 4)) & 1)
38 command2 |= (1UL << (3 - bit));
41 command1 = (command1 << 8) | ((~command1) & 0xff);
42 command2 = (command2 << 8) | ((~command2) & 0xff);
44 if (data.rc_code_2 == 0) {
52 dst->
item(HEADER_HIGH_US, HEADER_LOW_US);
53 for (
uint32_t mask = 1UL << 15; mask; mask >>= 1) {
54 if (address1 & mask) {
55 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
57 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
61 for (
uint32_t mask = 1UL << 15; mask; mask >>= 1) {
62 if (command1 & mask) {
63 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
65 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
69 dst->
mark(BIT_HIGH_US);
71 if (data.rc_code_2 != 0) {
72 dst->
space(TRAILER_SPACE_US);
73 dst->
item(HEADER_HIGH_US, HEADER_LOW_US);
74 for (
uint32_t mask = 1UL << 15; mask; mask >>= 1) {
75 if (address2 & mask) {
76 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
78 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
82 for (
uint32_t mask = 1UL << 15; mask; mask >>= 1) {
83 if (command2 & mask) {
84 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
86 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
90 dst->
mark(BIT_HIGH_US);
94 uint16_t address1 = 0;
95 uint16_t command1 = 0;
101 if (!src.
expect_item(HEADER_HIGH_US, HEADER_LOW_US))
104 for (
uint32_t mask = 1UL << 15; mask != 0; mask >>= 1) {
105 if (src.
expect_item(BIT_HIGH_US, BIT_ONE_LOW_US)) {
107 }
else if (src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
114 for (
uint32_t mask = 1UL << 15; mask != 0; mask >>= 1) {
115 if (src.
expect_item(BIT_HIGH_US, BIT_ONE_LOW_US)) {
117 }
else if (src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
127 if ((address1 >> 8) != ((~address1) & 0xff))
130 if ((command1 >> 8) != ((~command1) & 0xff))
133 for (
uint32_t bit = 0; bit < 4; bit++) {
134 if ((~command1 >> bit) & 1)
135 data.rc_code_1 |= (1UL << (7 - bit));
138 for (
uint32_t bit = 0; bit < 4; bit++) {
139 if ((~command1 >> (bit + 4)) & 1)
140 data.rc_code_1 |= (1UL << (3 - bit));
142 data.rc_code_1 |= address1 & 0xff00;