Skip to content

Commit b3f70f6

Browse files
committed
power
1 parent 77bf639 commit b3f70f6

1 file changed

Lines changed: 31 additions & 11 deletions

File tree

main.c

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "util.h"
1919

2020

21+
#if 0
2122
/*--------------------------------------------------------------------------*/
2223
/* 受信フレームの表示 */
2324

@@ -108,19 +109,43 @@ void get_line (char* buff, int len)
108109
buff[idx] = 0;
109110
xputc('\n');
110111
}
112+
#endif
113+
114+
111115

116+
#define SHARP_LEN 6
117+
unsigned char ircode_sharp_2_power[SHARP_LEN] = { 0xAA, 0x5A, 0x8F, 0x18, 0x16, 0x71 };
112118

119+
void dispatch_aquos() {
120+
uint8_t l;
113121

122+
for (;;) {
123+
if (IrCtrl.stat == IR_RECVED) {
124+
l = IrCtrl.len;
125+
if (IrCtrl.fmt != AEHA)
126+
continue;
127+
if (!((l >= 48) && (l % 8 == 0)))
128+
continue;
129+
l /= 8;
130+
131+
if (memcmp(&IrCtrl.rxdata, &ircode_sharp_2_power, SHARP_LEN) == 0) {
132+
xputs(PSTR("POWR \r"));
133+
}
134+
}
135+
}
136+
}
114137

115138
/*-----------------------------------------------------------------------*/
116139
/* Main */
117140
/*-----------------------------------------------------------------------*/
118141

119142
int main (void)
120143
{
144+
#if 0
121145
char line[64], *p;
122146
long val;
123147
uint8_t n;
148+
#endif
124149

125150
/* Disable watchdog if enabled by bootloader/fuses */
126151
MCUSR &= ~(1 << WDRF);
@@ -140,16 +165,6 @@ int main (void)
140165
set_bit(PORTC, 7);
141166
clear_bit(DDRD, 4);
142167

143-
#if 0
144-
/* ポート初期化 */
145-
PORTB = 0b00100111; /* PortB, IR input */ //PB0:ICP1,PB1:OC1A,PB2:OC1B
146-
DDRB = 0b00000000;
147-
PORTD = 0b11011111; /* PortD, IR drive, Comm */ // PD0:RXD, PD1:TXD
148-
DDRD = 0b00100010;
149-
PORTC = 0b00111111; /* PortC */
150-
DDRC = 0b00000000;
151-
#endif
152-
153168
uart_init(); /* Initialize UART driver */
154169
xfunc_out = (void(*)(char))uart_put; /* Join xitoa module to communication module */
155170

@@ -158,11 +173,15 @@ int main (void)
158173

159174
sei();
160175

161-
xputs(PSTR("IR remote control test program\n"));
176+
//xputs(PSTR("IR remote control test program\n"));
162177

163178
clear_bit(PORTC, 7);
164179

165180
/* ユーザコマンド処理ループ */
181+
for (;;) {
182+
dispatch_aquos();
183+
}
184+
#if 0
166185
for (;;) {
167186
get_line(line, sizeof line);
168187
p = line;
@@ -196,6 +215,7 @@ int main (void)
196215
}
197216

198217
}
218+
#endif
199219
}
200220

201221

0 commit comments

Comments
 (0)