|
|
|
@ -12,6 +12,19 @@ uint8_t in4state;
|
|
|
|
|
uint8_t in5state;
|
|
|
|
|
uint8_t scount;
|
|
|
|
|
|
|
|
|
|
uint8_t anain0;
|
|
|
|
|
uint8_t anain1;
|
|
|
|
|
uint8_t anain2;
|
|
|
|
|
uint8_t anain3;
|
|
|
|
|
uint8_t anain4;
|
|
|
|
|
uint8_t anain5;
|
|
|
|
|
uint16_t anatimer0;
|
|
|
|
|
uint16_t anatimer1;
|
|
|
|
|
uint16_t anatimer2;
|
|
|
|
|
uint16_t anatimer3;
|
|
|
|
|
uint16_t anatimer4;
|
|
|
|
|
uint16_t anatimer5;
|
|
|
|
|
|
|
|
|
|
uint16_t logtime;
|
|
|
|
|
uint8_t logging0;
|
|
|
|
|
uint8_t logging1;
|
|
|
|
@ -23,6 +36,8 @@ uint16_t logtimer2;
|
|
|
|
|
uint16_t logtimer3;
|
|
|
|
|
uint8_t scount;
|
|
|
|
|
|
|
|
|
|
uint16_t adcvalue;
|
|
|
|
|
|
|
|
|
|
void hbw_read_config(void)
|
|
|
|
|
{
|
|
|
|
|
uint8_t ee;
|
|
|
|
@ -33,14 +48,22 @@ void hbw_read_config(void)
|
|
|
|
|
ee = eeprom_read_byte((const uint8_t *)6);
|
|
|
|
|
logging0 = ee & 0x01;
|
|
|
|
|
|
|
|
|
|
ee = eeprom_read_byte((const uint8_t *)8);
|
|
|
|
|
ee = eeprom_read_byte((const uint8_t *)7);
|
|
|
|
|
logging1 = ee & 0x01;
|
|
|
|
|
|
|
|
|
|
ee = eeprom_read_byte((const uint8_t *)10);
|
|
|
|
|
ee = eeprom_read_byte((const uint8_t *)8);
|
|
|
|
|
logging2 = ee & 0x01;
|
|
|
|
|
|
|
|
|
|
ee = eeprom_read_byte((const uint8_t *)12);
|
|
|
|
|
ee = eeprom_read_byte((const uint8_t *)9);
|
|
|
|
|
logging3 = ee & 0x01;
|
|
|
|
|
|
|
|
|
|
ee = eeprom_read_byte((const uint8_t *)10);
|
|
|
|
|
anain0 = ee & 0x01;
|
|
|
|
|
anain1 = ee & 0x02;
|
|
|
|
|
anain2 = ee & 0x04;
|
|
|
|
|
anain3 = ee & 0x08;
|
|
|
|
|
anain4 = ee & 0x10;
|
|
|
|
|
anain5 = ee & 0x20;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
|
|
|
|
@ -74,6 +97,15 @@ uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (channel == 4) {
|
|
|
|
|
if (anain0) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 0;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
data[0] = adcvalue >> 8;
|
|
|
|
|
data[1] = adcvalue & 0xFF;
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
if (bit_is_clear(PINC, In0))
|
|
|
|
|
data[0] = 200;
|
|
|
|
|
else
|
|
|
|
@ -81,6 +113,15 @@ uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (channel == 5) {
|
|
|
|
|
if (anain1) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 1;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
data[0] = adcvalue >> 8;
|
|
|
|
|
data[1] = adcvalue & 0xFF;
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
if (bit_is_clear(PINC, In1))
|
|
|
|
|
data[0] = 200;
|
|
|
|
|
else
|
|
|
|
@ -88,6 +129,15 @@ uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (channel == 6) {
|
|
|
|
|
if (anain2) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 2;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
data[0] = adcvalue >> 8;
|
|
|
|
|
data[1] = adcvalue & 0xFF;
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
if (bit_is_clear(PINC, In2))
|
|
|
|
|
data[0] = 200;
|
|
|
|
|
else
|
|
|
|
@ -95,6 +145,15 @@ uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (channel == 7) {
|
|
|
|
|
if (anain3) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 3;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
data[0] = adcvalue >> 8;
|
|
|
|
|
data[1] = adcvalue & 0xFF;
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
if (bit_is_clear(PINC, In3))
|
|
|
|
|
data[0] = 200;
|
|
|
|
|
else
|
|
|
|
@ -102,6 +161,15 @@ uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (channel == 8) {
|
|
|
|
|
if (anain4) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 4;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
data[0] = adcvalue >> 8;
|
|
|
|
|
data[1] = adcvalue & 0xFF;
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
if (bit_is_clear(PINC, In4))
|
|
|
|
|
data[0] = 200;
|
|
|
|
|
else
|
|
|
|
@ -109,6 +177,15 @@ uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (channel == 9) {
|
|
|
|
|
if (anain5) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 5;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
data[0] = adcvalue >> 8;
|
|
|
|
|
data[1] = adcvalue & 0xFF;
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
if (bit_is_clear(PINC, In5))
|
|
|
|
|
data[0] = 200;
|
|
|
|
|
else
|
|
|
|
@ -157,13 +234,13 @@ void hbw_receive_key(uint32_t saddress, uint8_t schannel, uint8_t channel, uint8
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (i=0; i < 16; i++) {
|
|
|
|
|
if ((eeprom_read_byte((const uint8_t *)(i*7)+0x10) == ((uint8_t*)&saddress)[0]) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x11) == ((uint8_t*)&saddress)[1]) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x12) == ((uint8_t*)&saddress)[2]) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x13) == ((uint8_t*)&saddress)[3]) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x14) == schannel) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x15) == channel)) {
|
|
|
|
|
type = eeprom_read_byte((const uint8_t *)(i*7)+0x16);
|
|
|
|
|
if ((eeprom_read_byte((const uint8_t *)(i*7)+0x38) == ((uint8_t*)&saddress)[0]) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x39) == ((uint8_t*)&saddress)[1]) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x3a) == ((uint8_t*)&saddress)[2]) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x3b) == ((uint8_t*)&saddress)[3]) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x3c) == schannel) &&
|
|
|
|
|
(eeprom_read_byte((const uint8_t *)(i*7)+0x3d) == channel)) {
|
|
|
|
|
type = eeprom_read_byte((const uint8_t *)(i*7)+0x3e);
|
|
|
|
|
switch (countflag & 3) {
|
|
|
|
|
case 1:
|
|
|
|
|
type = (type >> 6) & 0x3;
|
|
|
|
@ -231,7 +308,7 @@ void hbw_receive_key(uint32_t saddress, uint8_t schannel, uint8_t channel, uint8
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
|
|
|
|
uint8_t state;
|
|
|
|
|
uint8_t state[2];
|
|
|
|
|
|
|
|
|
|
DDRB |= (1<<RedLED);
|
|
|
|
|
DDRB |= (1<<GreenLED);
|
|
|
|
@ -259,128 +336,230 @@ int main(void)
|
|
|
|
|
PORTC |= (1<<In4);
|
|
|
|
|
PORTC |= (1<<In5);
|
|
|
|
|
|
|
|
|
|
ADMUX = (0<<REFS1) | (1<<REFS0);
|
|
|
|
|
ADCSRA = (1<<ADPS2) | (1<<ADPS1);
|
|
|
|
|
ADCSRA |= (1<<ADEN);
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
|
|
|
|
|
hbw_init();
|
|
|
|
|
|
|
|
|
|
while(1) {
|
|
|
|
|
hbw_loop();
|
|
|
|
|
|
|
|
|
|
if (anain0) {
|
|
|
|
|
if (!anatimer0 || (hbw_timer - anatimer0 < 100)) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 0;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
state[0] = adcvalue >> 8;
|
|
|
|
|
state[1] = adcvalue& 0xFF;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(4, 2, state)) {
|
|
|
|
|
anatimer0 = hbw_timer + logtime;
|
|
|
|
|
if (!anatimer0) anatimer0 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (bit_is_clear(PINC, In0) && (!in0state)) {
|
|
|
|
|
state = 200;
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(4, 1, &state))
|
|
|
|
|
if (hbw_send_channel(4, 1, state))
|
|
|
|
|
in0state = ~0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bit_is_set(PINC, In0) && in0state) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(4, 1, &state))
|
|
|
|
|
if (hbw_send_channel(4, 1, state))
|
|
|
|
|
in0state = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (anain1) {
|
|
|
|
|
if (!anatimer1 || (hbw_timer - anatimer1 < 100)) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 1;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
state[0] = adcvalue >> 8;
|
|
|
|
|
state[1] = adcvalue& 0xFF;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(5, 2, state)) {
|
|
|
|
|
anatimer1 = hbw_timer + logtime;
|
|
|
|
|
if (!anatimer1) anatimer1 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (bit_is_clear(PINC, In1) && (!in1state)) {
|
|
|
|
|
state = 200;
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(5, 1, &state))
|
|
|
|
|
if (hbw_send_channel(5, 1, state))
|
|
|
|
|
in1state = ~0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bit_is_set(PINC, In1) && in1state) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(5, 1, &state))
|
|
|
|
|
if (hbw_send_channel(5, 1, state))
|
|
|
|
|
in1state = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (anain2) {
|
|
|
|
|
if (!anatimer2 || (hbw_timer - anatimer2 < 100)) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 2;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
state[0] = adcvalue >> 8;
|
|
|
|
|
state[1] = adcvalue& 0xFF;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(6, 2, state)) {
|
|
|
|
|
anatimer2 = hbw_timer + logtime;
|
|
|
|
|
if (!anatimer2) anatimer2 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (bit_is_clear(PINC, In2) && (!in2state)) {
|
|
|
|
|
state = 200;
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(6, 1, &state))
|
|
|
|
|
if (hbw_send_channel(6, 1, state))
|
|
|
|
|
in2state = ~0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bit_is_set(PINC, In2) && in2state) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(6, 1, &state))
|
|
|
|
|
if (hbw_send_channel(6, 1, state))
|
|
|
|
|
in2state = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (anain3) {
|
|
|
|
|
if (!anatimer3 || (hbw_timer - anatimer3 < 100)) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 3;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
state[0] = adcvalue >> 8;
|
|
|
|
|
state[1] = adcvalue& 0xFF;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(7, 2, state)) {
|
|
|
|
|
anatimer3 = hbw_timer + logtime;
|
|
|
|
|
if (!anatimer3) anatimer3 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (bit_is_clear(PINC, In3) && (!in3state)) {
|
|
|
|
|
state = 200;
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(7, 1, &state))
|
|
|
|
|
if (hbw_send_channel(7, 1, state))
|
|
|
|
|
in3state = ~0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bit_is_set(PINC, In3) && in3state) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(7, 1, &state))
|
|
|
|
|
if (hbw_send_channel(7, 1, state))
|
|
|
|
|
in3state = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (anain4) {
|
|
|
|
|
if (!anatimer4 || (hbw_timer - anatimer4 < 100)) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 4;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
state[0] = adcvalue >> 8;
|
|
|
|
|
state[1] = adcvalue& 0xFF;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(8, 2, state)) {
|
|
|
|
|
anatimer4 = hbw_timer + logtime;
|
|
|
|
|
if (!anatimer4) anatimer4 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (bit_is_clear(PINC, In4) && (!in4state)) {
|
|
|
|
|
state = 200;
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(8, 1, &state))
|
|
|
|
|
if (hbw_send_channel(8, 1, state))
|
|
|
|
|
in4state = ~0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bit_is_set(PINC, In4) && in4state) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(8, 1, &state))
|
|
|
|
|
if (hbw_send_channel(8, 1, state))
|
|
|
|
|
in4state = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (anain5) {
|
|
|
|
|
if (!anatimer5 || (hbw_timer - anatimer5 < 100)) {
|
|
|
|
|
ADMUX = (ADMUX & ~(0x1F)) | 5;
|
|
|
|
|
ADCSRA |= (1<<ADSC);
|
|
|
|
|
loop_until_bit_is_clear(ADCSRA, ADSC);
|
|
|
|
|
adcvalue = ADCW;
|
|
|
|
|
state[0] = adcvalue >> 8;
|
|
|
|
|
state[1] = adcvalue& 0xFF;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(9, 2, state)) {
|
|
|
|
|
anatimer5 = hbw_timer + logtime;
|
|
|
|
|
if (!anatimer5) anatimer5 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (bit_is_clear(PINC, In5) && (!in5state)) {
|
|
|
|
|
state = 200;
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(9, 1, &state))
|
|
|
|
|
if (hbw_send_channel(9, 1, state))
|
|
|
|
|
in5state = ~0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bit_is_set(PINC, In5) && in5state) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
|
|
|
|
|
if (hbw_send_channel(9, 1, &state))
|
|
|
|
|
if (hbw_send_channel(9, 1, state))
|
|
|
|
|
in5state = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (logtimer0 && (hbw_timer - logtimer0 < 100)) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
if (bit_is_set(PINB, RedLED))
|
|
|
|
|
state = 200;
|
|
|
|
|
if (!hbw_send_channel(0, 1, &state))
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
if (!hbw_send_channel(0, 1, state))
|
|
|
|
|
logtimer0 += 300;
|
|
|
|
|
else
|
|
|
|
|
logtimer0 = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (logtimer1 && (hbw_timer - logtimer1 < 100)) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
if (bit_is_set(PINB, GreenLED))
|
|
|
|
|
state = 200;
|
|
|
|
|
if (!hbw_send_channel(1, 1, &state))
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
if (!hbw_send_channel(1, 1, state))
|
|
|
|
|
logtimer1 += 300;
|
|
|
|
|
else
|
|
|
|
|
logtimer1 = 0;
|
|
|
|
|
}
|
|
|
|
|
if (logtimer2 && (hbw_timer - logtimer2 < 100)) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
if (bit_is_set(PIND, Out0))
|
|
|
|
|
state = 200;
|
|
|
|
|
if (!hbw_send_channel(2, 1, &state))
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
if (!hbw_send_channel(2, 1, state))
|
|
|
|
|
logtimer2 += 300;
|
|
|
|
|
else
|
|
|
|
|
logtimer2 = 0;
|
|
|
|
|
}
|
|
|
|
|
if (logtimer3 && (hbw_timer - logtimer3 < 100)) {
|
|
|
|
|
state = 0;
|
|
|
|
|
state[0] = 0;
|
|
|
|
|
if (bit_is_set(PIND, Out1))
|
|
|
|
|
state = 200;
|
|
|
|
|
if (!hbw_send_channel(3, 1, &state))
|
|
|
|
|
state[0] = 200;
|
|
|
|
|
if (!hbw_send_channel(3, 1, state))
|
|
|
|
|
logtimer3 += 300;
|
|
|
|
|
else
|
|
|
|
|
logtimer3 = 0;
|
|
|
|
|