Compare commits
No commits in common. 'b4cc8c2034ce8beb5d2f931f00ddc4dcd2799923' and 'b5b9383d4e4e8c49d5163cbdf92bf6998f45fb61' have entirely different histories.
b4cc8c2034
...
b5b9383d4e
@ -0,0 +1,7 @@
|
||||
#ifndef __ALARMHW_H__
|
||||
#define __ALARMHW_H__
|
||||
#define RedLED PD4
|
||||
#define GreenLED PD5
|
||||
#define BuzzerON PD6
|
||||
#define ReedSwitch PD7
|
||||
#endif
|
@ -0,0 +1,130 @@
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include "alarmhw.h"
|
||||
#include "rs485.h"
|
||||
#include "eb.h"
|
||||
|
||||
uint8_t reedstate;
|
||||
uint8_t buzzerstate;
|
||||
|
||||
uint8_t waitforack;
|
||||
uint8_t waitforsend;
|
||||
uint8_t acktimer;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
init_rs485();
|
||||
DDRD |= (1<<RedLED);
|
||||
DDRD |= (1<<GreenLED);
|
||||
DDRD |= (1<<BuzzerON);
|
||||
DDRD &= ~(1<<ReedSwitch);
|
||||
|
||||
PORTD &= ~(1<<RedLED);
|
||||
PORTD |= (1<<GreenLED);
|
||||
PORTD &= ~(1<<BuzzerON);
|
||||
PORTD |= (1<<ReedSwitch);
|
||||
|
||||
ADMUX = (0<<REFS1) | (1<<REFS0);
|
||||
ADCSRA = (1<<ADPS2) | (1<<ADPS1);
|
||||
ADCSRA |= (1<<ADEN);
|
||||
ADCSRA |= (1<<ADSC);
|
||||
loop_until_bit_is_clear(ADCSRA, ADSC);
|
||||
svalue = ADCW;
|
||||
|
||||
my_address = eeprom_read_byte((const uint8_t *)0);
|
||||
my_prio = eeprom_read_byte((const uint8_t *)1);
|
||||
master = eeprom_read_byte((const uint8_t *)2);
|
||||
|
||||
buzzerstate = 0;
|
||||
reedstate = 0;
|
||||
|
||||
waitforsend = 0;
|
||||
acktimer = 0;
|
||||
|
||||
sei();
|
||||
while(1) {
|
||||
rs485_loop();
|
||||
if (rflag) {
|
||||
if (rsender)
|
||||
srecv = rsender;
|
||||
else
|
||||
srecv = master;
|
||||
smode = 0;
|
||||
if ((rrecv == my_address) && (rmode == 2)) {
|
||||
acktimer = 0;
|
||||
waitforsend = 0;
|
||||
}
|
||||
|
||||
if ((rrecv == my_address) && (rmode == 0)) {
|
||||
for (i=0; i<4; i++) {
|
||||
decodepart(i);
|
||||
scommand = 0;
|
||||
schannel = rchannel;
|
||||
if ((rcommand == 0x40) && (rchannel == 0)) {
|
||||
scommand = 0x40;
|
||||
svalue = 2; /* 2 LED keys + 4 ADCs */
|
||||
}
|
||||
if ((rcommand == 0x60) && (rchannel == 1)) {
|
||||
if (rvalue & 0x02) {
|
||||
buzzerstate = ~0;
|
||||
PORTD |= (1<<BuzzerON);
|
||||
} else {
|
||||
buzzerstate = 0;
|
||||
PORTD &= ~(1<<BuzzerON);
|
||||
}
|
||||
scommand = 0x40;
|
||||
svalue = (reedstate & 0x01) | (buzzerstate & 0x02);
|
||||
}
|
||||
if ((rcommand == 0x40) && (rchannel == 1)) {
|
||||
scommand = 0x40;
|
||||
svalue = (reedstate & 0x01) | (buzzerstate & 0x02);
|
||||
}
|
||||
if ((rcommand == 0x40) && ((rchannel > 1) && (rchannel < 6))) {
|
||||
ADMUX = (ADMUX & ~(0x1F)) | (rchannel - 2);
|
||||
ADCSRA |= (1<<ADSC);
|
||||
loop_until_bit_is_clear(ADCSRA, ADSC);
|
||||
scommand = 0x40;
|
||||
svalue = ADCW;
|
||||
}
|
||||
encodepart(i);
|
||||
}
|
||||
smode = 0;
|
||||
sendmsg();
|
||||
acktimer = 0;
|
||||
waitforsend = 0;
|
||||
}
|
||||
if ((rrecv == 0) && (rmode == 0) && waitforsend) {
|
||||
if (!acktimer) {
|
||||
scommand = 0x40;
|
||||
schannel = 1;
|
||||
svalue = (reedstate & 0x01) | (buzzerstate & 0x02);
|
||||
encodepart(0);
|
||||
scommand = 0;
|
||||
encodepart(1);
|
||||
encodepart(2);
|
||||
encodepart(3);
|
||||
smode = 1;
|
||||
sendmsg();
|
||||
acktimer = my_prio;
|
||||
} else
|
||||
acktimer--;
|
||||
}
|
||||
rflag = 0;
|
||||
}
|
||||
if (bit_is_clear(PIND, ReedSwitch) && (!reedstate)) {
|
||||
reedstate = ~0;
|
||||
waitforsend = ~0;
|
||||
PORTD |= (1<<RedLED);
|
||||
PORTD &= ~(1<<GreenLED);
|
||||
}
|
||||
if (bit_is_set(PIND, ReedSwitch) && reedstate) {
|
||||
reedstate = 0;
|
||||
waitforsend = ~0;
|
||||
PORTD &= ~(1<<RedLED);
|
||||
PORTD |= (1<<GreenLED);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<device eep_size="512" version="01">
|
||||
<supported_types>
|
||||
<type priority="2" id="HBW-EBALARM" name="EBus Alarm HBW">
|
||||
<parameter const_value="0xAB" size="1" index="0"/>
|
||||
<parameter const_value="0" size="1" index="1"/>
|
||||
</type>
|
||||
</supported_types>
|
||||
|
||||
<paramset id="HBW-EBALARM_dev_master" type="MASTER">
|
||||
<parameter id="LOGGING_TIME">
|
||||
<logical type="float" unit="s" default="5.0" max="25.5" min="0.1"/>
|
||||
<physical size="1.0" type="integer" interface="eeprom">
|
||||
<address index="0x0001"/>
|
||||
</physical>
|
||||
<conversion type="float_integer_scale" offset="0.0" factor="10"/>
|
||||
</parameter>
|
||||
<parameter id="CENTRAL_ADDRESS" hidden="true">
|
||||
<logical type="integer"/>
|
||||
<physical size="4" type="integer" interface="eeprom">
|
||||
<address index="0x0002"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
<enforce id="CENTRAL_ADDRESS" value="1"/>
|
||||
</paramset>
|
||||
|
||||
<channels>
|
||||
<channel index="0" type="MAINTENANCE" count="1" class="maintenance" ui_flags="internal">
|
||||
</channel>
|
||||
<channel index="1" type="SWITCH" count="1" physical_index_offset="-1">
|
||||
</channel>
|
||||
</channels>
|
||||
|
||||
</device>
|
@ -1,152 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<device eep_size="512" version="01">
|
||||
<supported_types>
|
||||
<type priority="2" id="HBW-EBIO6" name="Elektor EBus I/O6 Board">
|
||||
<parameter const_value="0xE2" size="1" index="0"/>
|
||||
<parameter const_value="0" size="1" index="1"/>
|
||||
</type>
|
||||
</supported_types>
|
||||
|
||||
<paramset id="HBW-EBIO6_dev_master" type="MASTER">
|
||||
<parameter id="LOGGING_TIME">
|
||||
<logical type="float" unit="s" default="5.0" max="25.5" min="0.1"/>
|
||||
<physical size="1.0" type="integer" interface="eeprom">
|
||||
<address index="0x0001"/>
|
||||
</physical>
|
||||
<conversion type="float_integer_scale" offset="0.0" factor="10"/>
|
||||
</parameter>
|
||||
<parameter id="CENTRAL_ADDRESS" hidden="true">
|
||||
<logical type="integer"/>
|
||||
<physical size="4" type="integer" interface="eeprom">
|
||||
<address index="0x0002"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
<enforce id="CENTRAL_ADDRESS" value="1"/>
|
||||
</paramset>
|
||||
|
||||
<frames>
|
||||
<frame id="LEVEL_SET" type="#x" channel_field="10" direction="to_device">
|
||||
<parameter size="1.0" index="11.0" type="integer" param="LEVEL"/>
|
||||
</frame>
|
||||
<frame id="LEVEL_GET" type="#S" channel_field="10" direction="to_device"/>
|
||||
<frame id="INFO_LEVEL" type="#i" channel_field="10" direction="from_device" event="true">
|
||||
<parameter size="1.0" index="11.0" type="integer" param="LEVEL"/>
|
||||
</frame>
|
||||
</frames>
|
||||
|
||||
|
||||
<channels>
|
||||
<channel index="0" type="MAINTENANCE" count="1" class="maintenance" ui_flags="internal">
|
||||
</channel>
|
||||
<channel index="1" type="SWITCH" count="2" physical_index_offset="-1">
|
||||
<paramset id="hmw_switch_ch_master" type="MASTER" address_step="2" address_start="0x06">
|
||||
<parameter id="LOGGING">
|
||||
<logical type="option">
|
||||
<option id="OFF"/>
|
||||
<option id="ON" default="true"/>
|
||||
</logical>
|
||||
<physical size="0.1" type="integer" interface="eeprom">
|
||||
<address index="+0"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
</paramset>
|
||||
<paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x10" address_step="7" peer_param="SENSOR" channel_param="CHANNEL">
|
||||
<parameter id="SENSOR" hidden="true" operations="none">
|
||||
<logical type="address"/>
|
||||
<physical type="array">
|
||||
<physical size="4.0" type="integer" interface="eeprom">
|
||||
<address index="+0"/>
|
||||
</physical>
|
||||
<physical size="1.0" type="integer" interface="eeprom">
|
||||
<address index="+4"/>
|
||||
</physical>
|
||||
</physical>
|
||||
</parameter>
|
||||
<parameter id="CHANNEL" hidden="true" operations="none">
|
||||
<logical type="integer" min="0" max="255" default="255"/>
|
||||
<physical size="1.0" type="integer" interface="eeprom">
|
||||
<address index="+5"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
<parameter id="SHORT_ACTION_TYPE">
|
||||
<logical type="option">
|
||||
<option id="ON"/>
|
||||
<option id="OFF"/>
|
||||
<option id="INACTIVE"/>
|
||||
<option id="TOGGLE" default="true"/>
|
||||
</logical>
|
||||
<physical size="0.2" type="integer" interface="eeprom">
|
||||
<address index="+6"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
<parameter id="LONG_ACTION_TYPE">
|
||||
<logical type="option">
|
||||
<option id="ON"/>
|
||||
<option id="OFF"/>
|
||||
<option id="INACTIVE"/>
|
||||
<option id="TOGGLE" default="true"/>
|
||||
</logical>
|
||||
<physical size="0.2" type="integer" interface="eeprom">
|
||||
<address index="+6.2"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
<parameter id="LONGRELEASE_ACTION_TYPE">
|
||||
<logical type="option">
|
||||
<option id="ON"/>
|
||||
<option id="OFF"/>
|
||||
<option id="INACTIVE" default="true"/>
|
||||
<option id="TOGGLE"/>
|
||||
</logical>
|
||||
<physical size="0.2" type="integer" interface="eeprom">
|
||||
<address index="+6.4"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
<parameter id="DOUBLE_ACTION_TYPE">
|
||||
<logical type="option">
|
||||
<option id="ON"/>
|
||||
<option id="OFF"/>
|
||||
<option id="INACTIVE" default="true"/>
|
||||
<option id="TOGGLE"/>
|
||||
</logical>
|
||||
<physical size="0.2" type="integer" interface="eeprom">
|
||||
<address index="+6.6"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
</paramset>
|
||||
<paramset id="hmw_switch_ch_values" type="VALUES">
|
||||
<parameter id="STATE" operations="read,write,event" control="SWITCH.STATE">
|
||||
<logical type="boolean" default="false"/>
|
||||
<physical type="integer" interface="command" value_id="LEVEL">
|
||||
<set request="LEVEL_SET"/>
|
||||
<get request="LEVEL_GET" response="INFO_LEVEL"/>
|
||||
<event frame="INFO_LEVEL"/>
|
||||
</physical>
|
||||
<conversion type="boolean_integer" true="200" false="0" threshold="1"/>
|
||||
</parameter>
|
||||
</paramset>
|
||||
</channel>
|
||||
<channel index="3" type="SENSOR" count="6" physical_index_offset="-1">
|
||||
<paramset id="hmw_sensor_ch_master" type="MASTER" address_step="2" address_start="0x0a">
|
||||
<parameter id="LOGGING">
|
||||
<logical type="option">
|
||||
<option id="OFF"/>
|
||||
<option id="ON" default="true"/>
|
||||
</logical>
|
||||
<physical size="0.1" type="integer" interface="eeprom">
|
||||
<address index="+0"/>
|
||||
</physical>
|
||||
</parameter>
|
||||
</paramset>
|
||||
<paramset id="hmw_sensor_ch_values" type="VALUES">
|
||||
<parameter id="STATE" operations="read,event" control="SWITCH.STATE">
|
||||
<logical type="boolean" default="false"/>
|
||||
<physical type="integer" interface="command" value_id="LEVEL">
|
||||
<get request="LEVEL_GET" response="INFO_LEVEL"/>
|
||||
<event frame="INFO_LEVEL"/>
|
||||
</physical>
|
||||
<conversion type="boolean_integer" true="200" false="0" threshold="1"/>
|
||||
</parameter>
|
||||
</paramset>
|
||||
</channel>
|
||||
</channels>
|
||||
</device>
|
@ -1,30 +0,0 @@
|
||||
#ifndef __ALARMHW_H__
|
||||
#define __ALARMHW_H__
|
||||
#define ConfigLED PD4
|
||||
#define ConfigButton PD5
|
||||
#define Out0 PD6
|
||||
#define Out1 PD7
|
||||
|
||||
#define In0 PC0
|
||||
#define In1 PC1
|
||||
#define In2 PC2
|
||||
#define In3 PC3
|
||||
#define In4 PC4
|
||||
#define In5 PC5
|
||||
|
||||
#define RedLED PB0
|
||||
#define GreenLED PB1
|
||||
|
||||
#define HBWTYPE 0xE2
|
||||
#define HBWMAJOR 1
|
||||
#define HBWMINOR 2
|
||||
#define HBWSERIAL0 'C'
|
||||
#define HBWSERIAL1 'O'
|
||||
#define HBWSERIAL2 'L'
|
||||
#define HBWSERIAL3 'A'
|
||||
#define HBWSERIAL4 'B'
|
||||
#define HBWSERIAL5 'I'
|
||||
#define HBWSERIAL6 'O'
|
||||
#define HBWSERIAL7 '4'
|
||||
|
||||
#endif
|
@ -1,309 +0,0 @@
|
||||
#include "hw.h"
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include "hbw.h"
|
||||
|
||||
uint8_t in0state;
|
||||
uint8_t in1state;
|
||||
uint8_t in2state;
|
||||
uint8_t in3state;
|
||||
uint8_t in4state;
|
||||
uint8_t in5state;
|
||||
uint8_t scount;
|
||||
|
||||
uint16_t logtime;
|
||||
uint8_t logging0;
|
||||
uint8_t logging1;
|
||||
uint16_t logtimer0;
|
||||
uint16_t logtimer1;
|
||||
uint8_t scount;
|
||||
|
||||
void hbw_read_config(void)
|
||||
{
|
||||
uint8_t ee;
|
||||
|
||||
ee = eeprom_read_byte((const uint8_t *)1);
|
||||
logtime = 100L * ee;
|
||||
|
||||
ee = eeprom_read_byte((const uint8_t *)6);
|
||||
logging0 = ee & 0x01;
|
||||
|
||||
ee = eeprom_read_byte((const uint8_t *)8);
|
||||
logging1 = ee & 0x01;
|
||||
}
|
||||
|
||||
uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
|
||||
{
|
||||
if (channel == 0) {
|
||||
if (bit_is_clear(PINB, RedLED))
|
||||
data[0] = 0;
|
||||
else
|
||||
data[0] = 200;
|
||||
return 1;
|
||||
}
|
||||
if (channel == 1) {
|
||||
if (bit_is_clear(PINB, GreenLED))
|
||||
data[0] = 0;
|
||||
else
|
||||
data[0] = 200;
|
||||
return 1;
|
||||
}
|
||||
if (channel == 2) {
|
||||
if (bit_is_clear(PINC, In0))
|
||||
data[0] = 200;
|
||||
else
|
||||
data[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
if (channel == 3) {
|
||||
if (bit_is_clear(PINC, In1))
|
||||
data[0] = 200;
|
||||
else
|
||||
data[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
if (channel == 4) {
|
||||
if (bit_is_clear(PINC, In2))
|
||||
data[0] = 200;
|
||||
else
|
||||
data[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
if (channel == 5) {
|
||||
if (bit_is_clear(PINC, In3))
|
||||
data[0] = 200;
|
||||
else
|
||||
data[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
if (channel == 6) {
|
||||
if (bit_is_clear(PINC, In4))
|
||||
data[0] = 200;
|
||||
else
|
||||
data[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
if (channel == 7) {
|
||||
if (bit_is_clear(PINC, In5))
|
||||
data[0] = 200;
|
||||
else
|
||||
data[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hbw_set_channel(uint8_t channel, uint8_t len, uint8_t data[])
|
||||
{
|
||||
if (channel == 0) {
|
||||
if (data[0])
|
||||
PORTB |= (1<<RedLED);
|
||||
else
|
||||
PORTB &= ~(1<<RedLED);
|
||||
}
|
||||
if (channel == 1) {
|
||||
if (data[0])
|
||||
PORTB |= (1<<GreenLED);
|
||||
else
|
||||
PORTB &= ~(1<<GreenLED);
|
||||
}
|
||||
}
|
||||
|
||||
void hbw_receive_key(uint32_t saddress, uint8_t schannel, uint8_t channel, uint8_t countflag)
|
||||
{
|
||||
uint8_t i, type;
|
||||
|
||||
if (channel > 1)
|
||||
return;
|
||||
|
||||
if (scount == countflag)
|
||||
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);
|
||||
switch (countflag & 3) {
|
||||
case 1:
|
||||
type = (type >> 6) & 0x3;
|
||||
break;
|
||||
case 0:
|
||||
type = (type >> 4) & 0x3;
|
||||
break;
|
||||
case 3:
|
||||
type = (type >> 2) & 0x3;
|
||||
break;
|
||||
case 2:
|
||||
type = type & 0x3;
|
||||
}
|
||||
switch (type) {
|
||||
case 0:
|
||||
if(channel == 0)
|
||||
PORTB |= (1<<RedLED);
|
||||
else
|
||||
PORTB |= (1<<GreenLED);
|
||||
break;
|
||||
case 1:
|
||||
if(channel == 0)
|
||||
PORTB &= ~(1<<RedLED);
|
||||
else
|
||||
PORTB &= ~(1<<GreenLED);
|
||||
break;
|
||||
case 3:
|
||||
if(channel == 0)
|
||||
PORTB ^= (1<<RedLED);
|
||||
else
|
||||
PORTB ^= (1<<GreenLED);
|
||||
}
|
||||
if ((channel == 0) && logging0) {
|
||||
logtimer0 = hbw_timer + logtime;
|
||||
if (!logtimer0) logtimer0 = 1;
|
||||
}
|
||||
if ((channel == 1) && logging1) {
|
||||
logtimer1 = hbw_timer + logtime;
|
||||
if (!logtimer1) logtimer1 = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uint8_t state;
|
||||
|
||||
DDRB |= (1<<RedLED);
|
||||
DDRB |= (1<<GreenLED);
|
||||
|
||||
DDRC &= ~(1<<In0);
|
||||
DDRC &= ~(1<<In1);
|
||||
DDRC &= ~(1<<In2);
|
||||
DDRC &= ~(1<<In3);
|
||||
DDRC &= ~(1<<In4);
|
||||
DDRC &= ~(1<<In5);
|
||||
|
||||
PORTB &= ~(1<<RedLED);
|
||||
PORTB &= ~(1<<GreenLED);
|
||||
|
||||
PORTC |= (1<<In0);
|
||||
PORTC |= (1<<In1);
|
||||
PORTC |= (1<<In2);
|
||||
PORTC |= (1<<In3);
|
||||
PORTC |= (1<<In4);
|
||||
PORTC |= (1<<In5);
|
||||
|
||||
hbw_init();
|
||||
|
||||
while(1) {
|
||||
hbw_loop();
|
||||
|
||||
if (bit_is_clear(PINC, In0) && (!in0state)) {
|
||||
state = 200;
|
||||
|
||||
if (hbw_send_channel(2, 1, &state))
|
||||
in0state = ~0;
|
||||
}
|
||||
|
||||
if (bit_is_set(PINC, In0) && in0state) {
|
||||
state = 0;
|
||||
|
||||
if (hbw_send_channel(2, 1, &state))
|
||||
in0state = 0;
|
||||
}
|
||||
|
||||
if (bit_is_clear(PINC, In1) && (!in1state)) {
|
||||
state = 200;
|
||||
|
||||
if (hbw_send_channel(3, 1, &state))
|
||||
in1state = ~0;
|
||||
}
|
||||
|
||||
if (bit_is_set(PINC, In1) && in1state) {
|
||||
state = 0;
|
||||
|
||||
if (hbw_send_channel(3, 1, &state))
|
||||
in1state = 0;
|
||||
}
|
||||
|
||||
if (bit_is_clear(PINC, In2) && (!in2state)) {
|
||||
state = 200;
|
||||
|
||||
if (hbw_send_channel(4, 1, &state))
|
||||
in2state = ~0;
|
||||
}
|
||||
|
||||
if (bit_is_set(PINC, In2) && in2state) {
|
||||
state = 0;
|
||||
|
||||
if (hbw_send_channel(4, 1, &state))
|
||||
in2state = 0;
|
||||
}
|
||||
|
||||
if (bit_is_clear(PINC, In3) && (!in3state)) {
|
||||
state = 200;
|
||||
|
||||
if (hbw_send_channel(5, 1, &state))
|
||||
in3state = ~0;
|
||||
}
|
||||
|
||||
if (bit_is_set(PINC, In3) && in3state) {
|
||||
state = 0;
|
||||
|
||||
if (hbw_send_channel(5, 1, &state))
|
||||
in3state = 0;
|
||||
}
|
||||
|
||||
if (bit_is_clear(PINC, In4) && (!in4state)) {
|
||||
state = 200;
|
||||
|
||||
if (hbw_send_channel(6, 1, &state))
|
||||
in4state = ~0;
|
||||
}
|
||||
|
||||
if (bit_is_set(PINC, In4) && in4state) {
|
||||
state = 0;
|
||||
|
||||
if (hbw_send_channel(6, 1, &state))
|
||||
in4state = 0;
|
||||
}
|
||||
|
||||
if (bit_is_clear(PINC, In5) && (!in5state)) {
|
||||
state = 200;
|
||||
|
||||
if (hbw_send_channel(7, 1, &state))
|
||||
in5state = ~0;
|
||||
}
|
||||
|
||||
if (bit_is_set(PINC, In5) && in5state) {
|
||||
state = 0;
|
||||
|
||||
if (hbw_send_channel(7, 1, &state))
|
||||
in5state = 0;
|
||||
}
|
||||
|
||||
if (hbw_timer - logtimer0 < 100) {
|
||||
state = 0;
|
||||
if (bit_is_clear(PINB, RedLED))
|
||||
state = 200;
|
||||
if (!hbw_send_channel(0, 1, &state))
|
||||
logtimer0 += 300;
|
||||
else
|
||||
logtimer0 = 0;
|
||||
}
|
||||
|
||||
if (hbw_timer - logtimer1 < 100) {
|
||||
state = 0;
|
||||
if (bit_is_clear(PINB, GreenLED))
|
||||
state = 200;
|
||||
if (!hbw_send_channel(1, 1, &state))
|
||||
logtimer1 += 300;
|
||||
else
|
||||
logtimer1 = 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue