Compare commits

..

No commits in common. '2583860988f2fe9179fde42e3a8946f9f77e2e3e' and '0fd8a988ddd6d60e82442335c3f4ca2e6e3f632a' have entirely different histories.

@ -38,7 +38,7 @@
<channels>
<channel index="0" type="MAINTENANCE" count="1" class="maintenance" ui_flags="internal">
</channel>
<channel index="1" type="SWITCH" count="4" physical_index_offset="-1">
<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">
@ -50,7 +50,7 @@
</physical>
</parameter>
</paramset>
<paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x1a" address_step="7" peer_param="SENSOR" channel_param="CHANNEL">
<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">
@ -125,8 +125,8 @@
</parameter>
</paramset>
</channel>
<channel index="5" type="SENSOR" count="6" physical_index_offset="-1">
<paramset id="hmw_sensor_ch_master" type="MASTER" address_step="2" address_start="0x0e">
<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"/>

@ -50,7 +50,7 @@
</physical>
</parameter>
</paramset>
<paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x12" address_step="7" peer_param="SENSOR" channel_param="CHANNEL">
<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">

@ -1,5 +1,5 @@
#ifndef __IO6HW_H__
#define __IO6HW_H__
#ifndef __ALARMHW_H__
#define __ALARMHW_H__
#define ConfigLED PD4
#define ConfigButton PD5
#define Out0 PD6
@ -25,6 +25,6 @@
#define HBWSERIAL4 'B'
#define HBWSERIAL5 'I'
#define HBWSERIAL6 'O'
#define HBWSERIAL7 '6'
#define HBWSERIAL7 '4'
#endif

@ -15,12 +15,8 @@ uint8_t scount;
uint16_t logtime;
uint8_t logging0;
uint8_t logging1;
uint8_t logging2;
uint8_t logging3;
uint16_t logtimer0;
uint16_t logtimer1;
uint16_t logtimer2;
uint16_t logtimer3;
uint8_t scount;
void hbw_read_config(void)
@ -35,12 +31,6 @@ void hbw_read_config(void)
ee = eeprom_read_byte((const uint8_t *)8);
logging1 = ee & 0x01;
ee = eeprom_read_byte((const uint8_t *)10);
logging2 = ee & 0x01;
ee = eeprom_read_byte((const uint8_t *)12);
logging3 = ee & 0x01;
}
uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
@ -60,55 +50,41 @@ uint8_t hbw_get_channel(uint8_t channel, uint8_t data[])
return 1;
}
if (channel == 2) {
if (bit_is_clear(PIND, Out0))
data[0] = 0;
else
data[0] = 200;
return 1;
}
if (channel == 3) {
if (bit_is_clear(PIND, Out1))
data[0] = 0;
else
data[0] = 200;
return 1;
}
if (channel == 4) {
if (bit_is_clear(PINC, In0))
data[0] = 200;
else
data[0] = 0;
return 1;
}
if (channel == 5) {
if (channel == 3) {
if (bit_is_clear(PINC, In1))
data[0] = 200;
else
data[0] = 0;
return 1;
}
if (channel == 6) {
if (channel == 4) {
if (bit_is_clear(PINC, In2))
data[0] = 200;
else
data[0] = 0;
return 1;
}
if (channel == 7) {
if (channel == 5) {
if (bit_is_clear(PINC, In3))
data[0] = 200;
else
data[0] = 0;
return 1;
}
if (channel == 8) {
if (channel == 6) {
if (bit_is_clear(PINC, In4))
data[0] = 200;
else
data[0] = 0;
return 1;
}
if (channel == 9) {
if (channel == 7) {
if (bit_is_clear(PINC, In5))
data[0] = 200;
else
@ -132,25 +108,13 @@ void hbw_set_channel(uint8_t channel, uint8_t len, uint8_t data[])
else
PORTB &= ~(1<<GreenLED);
}
if (channel == 2) {
if (data[0])
PORTD |= (1<<Out0);
else
PORTD &= ~(1<<Out0);
}
if (channel == 3) {
if (data[0])
PORTD |= (1<<Out1);
else
PORTD &= ~(1<<Out1);
}
}
void hbw_receive_key(uint32_t saddress, uint8_t schannel, uint8_t channel, uint8_t countflag)
{
uint8_t i, type;
if (channel > 3)
if (channel > 1)
return;
if (scount == countflag)
@ -181,32 +145,20 @@ void hbw_receive_key(uint32_t saddress, uint8_t schannel, uint8_t channel, uint8
case 0:
if(channel == 0)
PORTB |= (1<<RedLED);
else if(channel == 1)
PORTB |= (1<<GreenLED);
else if(channel == 2)
PORTD |= (1<<Out0);
else
PORTD |= (1<<Out1);
PORTB |= (1<<GreenLED);
break;
case 1:
if(channel == 0)
PORTB &= ~(1<<RedLED);
else if(channel == 1)
PORTB &= ~(1<<GreenLED);
else if(channel == 2)
PORTD &= ~(1<<Out0);
else
PORTD &= ~(1<<Out1);
PORTB &= ~(1<<GreenLED);
break;
case 3:
if(channel == 0)
PORTB ^= (1<<RedLED);
else if(channel == 1)
PORTB ^= (1<<GreenLED);
else if(channel == 2)
PORTD ^= (1<<Out0);
else
PORTD ^= (1<<Out1);
PORTB ^= (1<<GreenLED);
}
if ((channel == 0) && logging0) {
logtimer0 = hbw_timer + logtime;
@ -216,14 +168,6 @@ void hbw_receive_key(uint32_t saddress, uint8_t schannel, uint8_t channel, uint8
logtimer1 = hbw_timer + logtime;
if (!logtimer1) logtimer1 = 1;
}
if ((channel == 2) && logging2) {
logtimer2 = hbw_timer + logtime;
if (!logtimer2) logtimer2 = 1;
}
if ((channel == 3) && logging3) {
logtimer3 = hbw_timer + logtime;
if (!logtimer3) logtimer3 = 1;
}
return;
}
}
@ -236,9 +180,6 @@ int main(void)
DDRB |= (1<<RedLED);
DDRB |= (1<<GreenLED);
DDRD |= (1<<Out0);
DDRD |= (1<<Out1);
DDRC &= ~(1<<In0);
DDRC &= ~(1<<In1);
DDRC &= ~(1<<In2);
@ -249,9 +190,6 @@ int main(void)
PORTB &= ~(1<<RedLED);
PORTB &= ~(1<<GreenLED);
PORTD &= ~(1<<Out0);
PORTD &= ~(1<<Out1);
PORTC |= (1<<In0);
PORTC |= (1<<In1);
PORTC |= (1<<In2);
@ -267,90 +205,90 @@ int main(void)
if (bit_is_clear(PINC, In0) && (!in0state)) {
state = 200;
if (hbw_send_channel(4, 1, &state))
if (hbw_send_channel(2, 1, &state))
in0state = ~0;
}
if (bit_is_set(PINC, In0) && in0state) {
state = 0;
if (hbw_send_channel(4, 1, &state))
if (hbw_send_channel(2, 1, &state))
in0state = 0;
}
if (bit_is_clear(PINC, In1) && (!in1state)) {
state = 200;
if (hbw_send_channel(5, 1, &state))
if (hbw_send_channel(3, 1, &state))
in1state = ~0;
}
if (bit_is_set(PINC, In1) && in1state) {
state = 0;
if (hbw_send_channel(5, 1, &state))
if (hbw_send_channel(3, 1, &state))
in1state = 0;
}
if (bit_is_clear(PINC, In2) && (!in2state)) {
state = 200;
if (hbw_send_channel(6, 1, &state))
if (hbw_send_channel(4, 1, &state))
in2state = ~0;
}
if (bit_is_set(PINC, In2) && in2state) {
state = 0;
if (hbw_send_channel(6, 1, &state))
if (hbw_send_channel(4, 1, &state))
in2state = 0;
}
if (bit_is_clear(PINC, In3) && (!in3state)) {
state = 200;
if (hbw_send_channel(7, 1, &state))
if (hbw_send_channel(5, 1, &state))
in3state = ~0;
}
if (bit_is_set(PINC, In3) && in3state) {
state = 0;
if (hbw_send_channel(7, 1, &state))
if (hbw_send_channel(5, 1, &state))
in3state = 0;
}
if (bit_is_clear(PINC, In4) && (!in4state)) {
state = 200;
if (hbw_send_channel(8, 1, &state))
if (hbw_send_channel(6, 1, &state))
in4state = ~0;
}
if (bit_is_set(PINC, In4) && in4state) {
state = 0;
if (hbw_send_channel(8, 1, &state))
if (hbw_send_channel(6, 1, &state))
in4state = 0;
}
if (bit_is_clear(PINC, In5) && (!in5state)) {
state = 200;
if (hbw_send_channel(9, 1, &state))
if (hbw_send_channel(7, 1, &state))
in5state = ~0;
}
if (bit_is_set(PINC, In5) && in5state) {
state = 0;
if (hbw_send_channel(9, 1, &state))
if (hbw_send_channel(7, 1, &state))
in5state = 0;
}
if (logtimer0 && (hbw_timer - logtimer0 < 100)) {
state = 0;
if (bit_is_set(PINB, RedLED))
if (bit_is_clear(PINB, RedLED))
state = 200;
if (!hbw_send_channel(0, 1, &state))
logtimer0 += 300;
@ -360,30 +298,12 @@ int main(void)
if (logtimer1 && (hbw_timer - logtimer1 < 100)) {
state = 0;
if (bit_is_set(PINB, GreenLED))
if (bit_is_clear(PINB, GreenLED))
state = 200;
if (!hbw_send_channel(1, 1, &state))
logtimer1 += 300;
else
logtimer1 = 0;
}
if (logtimer2 && (hbw_timer - logtimer2 < 100)) {
state = 0;
if (bit_is_set(PIND, Out0))
state = 200;
if (!hbw_send_channel(2, 1, &state))
logtimer2 += 300;
else
logtimer2 = 0;
}
if (logtimer3 && (hbw_timer - logtimer3 < 100)) {
state = 0;
if (bit_is_set(PIND, Out1))
state = 200;
if (!hbw_send_channel(3, 1, &state))
logtimer3 += 300;
else
logtimer3 = 0;
}
}
}

Loading…
Cancel
Save