XML reformatiert und EEPROM Lokationen korrigiert.

master
Jochen Friedrich 7 years ago
parent 65be3ae3fc
commit 2b8935d5bd

@ -1,152 +1,223 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="utf-8"?>
<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>
<device eep_size="512" version="01">
<channels> <supported_types>
<channel index="0" type="MAINTENANCE" count="1" class="maintenance" ui_flags="internal"> <type priority="2" id="HBW-EBIO6" name="Elektor EBus I/O6 Board">
</channel> <parameter const_value="0xE2" size="1" index="0" />
<channel index="1" type="SWITCH" count="4" physical_index_offset="-1"> <parameter const_value="0" size="1" index="1" />
<paramset id="hmw_switch_ch_master" type="MASTER" address_step="2" address_start="0x06"> </type>
<parameter id="LOGGING"> </supported_types>
<logical type="option"> <paramset id="HBW-EBIO6_dev_master" type="MASTER">
<option id="OFF"/> <parameter id="LOGGING_TIME">
<option id="ON" default="true"/> <logical type="float" unit="s" default="5.0" max="25.5" min="0.1" />
</logical> <physical size="1.0" type="integer" interface="eeprom">
<physical size="0.1" type="integer" interface="eeprom"> <address index="0x0001" />
<address index="+0"/> </physical>
</physical> <conversion type="float_integer_scale" offset="0.0" factor="10" />
</parameter> </parameter>
</paramset> <parameter id="CENTRAL_ADDRESS" hidden="true">
<paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x1a" address_step="7" peer_param="SENSOR" channel_param="CHANNEL"> <logical type="integer" />
<parameter id="SENSOR" hidden="true" operations="none"> <physical size="4" type="integer" interface="eeprom">
<logical type="address"/> <address index="0x0002" />
<physical type="array"> </physical>
<physical size="4.0" type="integer" interface="eeprom"> </parameter>
<address index="+0"/> <enforce id="CENTRAL_ADDRESS" value="1" />
</physical> </paramset>
<physical size="1.0" type="integer" interface="eeprom"> <frames>
<address index="+4"/> <frame id="LEVEL_SET" type="#x" channel_field="10" direction="to_device">
</physical> <parameter size="1.0" index="11.0" type="integer" param="LEVEL" />
</physical> </frame>
</parameter> <frame id="LEVEL_GET" type="#S" channel_field="10" direction="to_device" />
<parameter id="CHANNEL" hidden="true" operations="none"> <frame id="INFO_LEVEL" type="#i" channel_field="10" direction="from_device" event="true">
<logical type="integer" min="0" max="255" default="255"/> <parameter size="2.0" index="11.0" type="integer" param="LEVEL" />
<physical size="1.0" type="integer" interface="eeprom"> </frame>
<address index="+5"/> </frames>
</physical> <channels>
</parameter> <channel index="0" type="MAINTENANCE" ui_flags="internal" class="maintenance" count="1">
<parameter id="SHORT_ACTION_TYPE"> <paramset type="MASTER" id="maint_ch_master" />
<logical type="option"> <paramset type="VALUES" id="maint_ch_values">
<option id="ON"/> <parameter id="UNREACH" operations="read,event" ui_flags="service">
<option id="OFF"/> <logical type="boolean" />
<option id="INACTIVE"/> <physical type="integer" interface="internal" value_id="UNREACH" />
<option id="TOGGLE" default="true"/> </parameter>
</logical> <parameter id="STICKY_UNREACH" operations="read,write,event" ui_flags="service">
<physical size="0.2" type="integer" interface="eeprom"> <logical type="boolean" />
<address index="+6"/> <physical type="integer" interface="internal" value_id="STICKY_UNREACH" />
</physical> </parameter>
</parameter> <parameter id="CONFIG_PENDING" operations="read,event" ui_flags="service">
<parameter id="LONG_ACTION_TYPE"> <logical type="boolean" />
<logical type="option"> <physical type="integer" interface="internal" value_id="CONFIG_PENDING" />
<option id="ON"/> </parameter>
<option id="OFF"/> </paramset>
<option id="INACTIVE"/> </channel>
<option id="TOGGLE" default="true"/> <channel index="1" type="SWITCH" count="4" physical_index_offset="-1">
</logical> <paramset id="hmw_switch_ch_master" type="MASTER" address_step="1" address_start="0x06">
<physical size="0.2" type="integer" interface="eeprom"> <parameter id="LOGGING">
<address index="+6.2"/> <logical type="option">
</physical> <option id="OFF" />
</parameter> <option id="ON" default="true" />
<parameter id="LONGRELEASE_ACTION_TYPE"> </logical>
<logical type="option"> <physical size="0.1" type="integer" interface="eeprom">
<option id="ON"/> <address index="+0" />
<option id="OFF"/> </physical>
<option id="INACTIVE" default="true"/> </parameter>
<option id="TOGGLE"/> </paramset>
</logical> <paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x38" address_step="7" peer_param="SENSOR" channel_param="CHANNEL">
<physical size="0.2" type="integer" interface="eeprom"> <parameter id="SENSOR" hidden="true" operations="none">
<address index="+6.4"/> <logical type="address" />
</physical> <physical type="array">
</parameter> <physical size="4.0" type="integer" interface="eeprom">
<parameter id="DOUBLE_ACTION_TYPE"> <address index="+0" />
<logical type="option"> </physical>
<option id="ON"/> <physical size="1.0" type="integer" interface="eeprom">
<option id="OFF"/> <address index="+4" />
<option id="INACTIVE" default="true"/> </physical>
<option id="TOGGLE"/> </physical>
</logical> </parameter>
<physical size="0.2" type="integer" interface="eeprom"> <parameter id="CHANNEL" hidden="true" operations="none">
<address index="+6.6"/> <logical type="integer" min="0" max="255" default="255" />
</physical> <physical size="1.0" type="integer" interface="eeprom">
</parameter> <address index="+5" />
</paramset> </physical>
<paramset id="hmw_switch_ch_values" type="VALUES"> </parameter>
<parameter id="STATE" operations="read,write,event" control="SWITCH.STATE"> <parameter id="SHORT_ACTION_TYPE">
<logical type="boolean" default="false"/> <logical type="option">
<physical type="integer" interface="command" value_id="LEVEL"> <option id="ON" />
<set request="LEVEL_SET"/> <option id="OFF" />
<get request="LEVEL_GET" response="INFO_LEVEL"/> <option id="INACTIVE" />
<event frame="INFO_LEVEL"/> <option id="TOGGLE" default="true" />
</physical> </logical>
<conversion type="boolean_integer" true="200" false="0" threshold="1"/> <physical size="0.2" type="integer" interface="eeprom">
</parameter> <address index="+6" />
</paramset> </physical>
</channel> </parameter>
<channel index="5" type="SENSOR" count="6" physical_index_offset="-1"> <parameter id="LONG_ACTION_TYPE">
<paramset id="hmw_sensor_ch_master" type="MASTER" address_step="2" address_start="0x0e"> <logical type="option">
<parameter id="LOGGING"> <option id="ON" />
<logical type="option"> <option id="OFF" />
<option id="OFF"/> <option id="INACTIVE" />
<option id="ON" default="true"/> <option id="TOGGLE" default="true" />
</logical> </logical>
<physical size="0.1" type="integer" interface="eeprom"> <physical size="0.2" type="integer" interface="eeprom">
<address index="+0"/> <address index="+6.2" />
</physical> </physical>
</parameter> </parameter>
</paramset> <parameter id="LONGRELEASE_ACTION_TYPE">
<paramset id="hmw_sensor_ch_values" type="VALUES"> <logical type="option">
<parameter id="STATE" operations="read,event" control="SWITCH.STATE"> <option id="ON" />
<logical type="boolean" default="false"/> <option id="OFF" />
<physical type="integer" interface="command" value_id="LEVEL"> <option id="INACTIVE" default="true" />
<get request="LEVEL_GET" response="INFO_LEVEL"/> <option id="TOGGLE" />
<event frame="INFO_LEVEL"/> </logical>
</physical> <physical size="0.2" type="integer" interface="eeprom">
<conversion type="boolean_integer" true="200" false="0" threshold="1"/> <address index="+6.4" />
</parameter> </physical>
</paramset> </parameter>
</channel> <parameter id="DOUBLE_ACTION_TYPE">
</channels> <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="5" type="INPUT" count="6" physical_index_offset="-1">
<special_parameter id="BEHAVIOUR">
<logical type="integer" />
<physical interface="eeprom" size="0.1" type="integer">
<address index="0x0a" step="0.1" />
</physical>
</special_parameter>
<paramset address_start="0x0b" address_step="0" id="hmw_io_ch_master" type="MASTER">
<parameter id="BEHAVIOUR" ui_flags="transform">
<logical type="option">
<option default="true" id="DIGITAL_INPUT" />
<option id="ANALOG_INPUT" />
</logical>
<physical interface="internal" type="integer" value_id="BEHAVIOUR" />
</parameter>
</paramset>
<paramset id="hmw_switch_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>
<subconfig>
<paramset address_start="0x0b" address_step="7" id="hmw_io_ch_master" type="MASTER">
<parameter id="SEND_DELTA_VOLT">
<logical type="float" unit="V" default="0.5" min="0.1" max="25.0">
<special_value id="NOT_USED" value="0" />
</logical>
<physical size="1.0" type="integer" interface="eeprom">
<address index="+0.0" />
</physical>
<conversion type="float_integer_scale" factor="10" />
<conversion type="integer_integer_map">
<value_map to_device="false" from_device="true" parameter_value="5" device_value="0xff" />
</conversion>
</parameter>
<parameter id="SEND_MIN_INTERVAL">
<logical type="integer" unit="s" default="10" min="5" max="3600">
<special_value id="NOT_USED" value="0" />
</logical>
<physical size="2.0" type="integer" interface="eeprom" endian="little">
<address index="+2.0" />
</physical>
<conversion type="integer_integer_map">
<value_map to_device="false" from_device="true" parameter_value="10" device_value="0xffff" />
</conversion>
</parameter>
<parameter id="SEND_MAX_INTERVAL">
<logical type="integer" unit="s" default="150" min="5" max="3600">
<special_value id="NOT_USED" value="0" />
</logical>
<physical size="2.0" type="integer" interface="eeprom" endian="little">
<address index="+4.0" />
</physical>
<conversion type="integer_integer_map">
<value_map to_device="false" from_device="true" parameter_value="150" device_value="0xffff" />
</conversion>
</parameter>
<parameter id="BEHAVIOUR" ui_flags="transform">
<logical type="option">
<option default="true" id="DIGITAL_INPUT" />
<option id="ANALOG_INPUT" />
</logical>
<physical interface="internal" type="integer" value_id="BEHAVIOUR" />
</parameter>
</paramset>
<paramset type="VALUES" id="hmw_digital_input_values">
<parameter id="LEVEL" operations="read,event">
<logical type="float" min="0" max="20.47" unit="V" />
<physical type="integer" interface="command" value_id="VOLTAGE">
<get request="LEVEL_GET" response="INFO_LEVEL" />
<event frame="INFO_LEVEL" />
</physical>
<conversion type="float_integer_scale" factor="100" />
</parameter>
</paramset>
</subconfig>
</channel>
</channels>
</device> </device>

@ -1,152 +1,164 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="utf-8"?>
<device eep_size="512" version="01">
<supported_types>
<type priority="2" id="HBW-EBRELAIS" name="Elektor EBus Relais Board">
<parameter const_value="0xE1" size="1" index="0"/>
<parameter const_value="0" size="1" index="1"/>
</type>
</supported_types>
<paramset id="HBW-EBRELAIS_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>
<device eep_size="512" version="01">
<channels> <supported_types>
<channel index="0" type="MAINTENANCE" count="1" class="maintenance" ui_flags="internal"> <type priority="2" id="HBW-EBRELAIS" name="Elektor EBus Relais Board">
</channel> <parameter const_value="0xE1" size="1" index="0" />
<channel index="1" type="SWITCH" count="2" physical_index_offset="-1"> <parameter const_value="0" size="1" index="1" />
<paramset id="hmw_switch_ch_master" type="MASTER" address_step="2" address_start="0x06"> </type>
<parameter id="LOGGING"> </supported_types>
<logical type="option"> <paramset id="HBW-EBRELAIS_dev_master" type="MASTER">
<option id="OFF"/> <parameter id="LOGGING_TIME">
<option id="ON" default="true"/> <logical type="float" unit="s" default="5.0" max="25.5" min="0.1" />
</logical> <physical size="1.0" type="integer" interface="eeprom">
<physical size="0.1" type="integer" interface="eeprom"> <address index="0x0001" />
<address index="+0"/> </physical>
</physical> <conversion type="float_integer_scale" offset="0.0" factor="10" />
</parameter> </parameter>
</paramset> <parameter id="CENTRAL_ADDRESS" hidden="true">
<paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x12" address_step="7" peer_param="SENSOR" channel_param="CHANNEL"> <logical type="integer" />
<parameter id="SENSOR" hidden="true" operations="none"> <physical size="4" type="integer" interface="eeprom">
<logical type="address"/> <address index="0x0002" />
<physical type="array"> </physical>
<physical size="4.0" type="integer" interface="eeprom"> </parameter>
<address index="+0"/> <enforce id="CENTRAL_ADDRESS" value="1" />
</physical> </paramset>
<physical size="1.0" type="integer" interface="eeprom"> <frames>
<address index="+4"/> <frame id="LEVEL_SET" type="#x" channel_field="10" direction="to_device">
</physical> <parameter size="1.0" index="11.0" type="integer" param="LEVEL" />
</physical> </frame>
</parameter> <frame id="LEVEL_GET" type="#S" channel_field="10" direction="to_device" />
<parameter id="CHANNEL" hidden="true" operations="none"> <frame id="INFO_LEVEL" type="#i" channel_field="10" direction="from_device" event="true">
<logical type="integer" min="0" max="255" default="255"/> <parameter size="1.0" index="11.0" type="integer" param="LEVEL" />
<physical size="1.0" type="integer" interface="eeprom"> </frame>
<address index="+5"/> </frames>
</physical> <channels>
</parameter> <channel index="0" type="MAINTENANCE" ui_flags="internal" class="maintenance" count="1">
<parameter id="SHORT_ACTION_TYPE"> <paramset type="MASTER" id="maint_ch_master" />
<logical type="option"> <paramset type="VALUES" id="maint_ch_values">
<option id="ON"/> <parameter id="UNREACH" operations="read,event" ui_flags="service">
<option id="OFF"/> <logical type="boolean" />
<option id="INACTIVE"/> <physical type="integer" interface="internal" value_id="UNREACH" />
<option id="TOGGLE" default="true"/> </parameter>
</logical> <parameter id="STICKY_UNREACH" operations="read,write,event" ui_flags="service">
<physical size="0.2" type="integer" interface="eeprom"> <logical type="boolean" />
<address index="+6"/> <physical type="integer" interface="internal" value_id="STICKY_UNREACH" />
</physical> </parameter>
</parameter> <parameter id="CONFIG_PENDING" operations="read,event" ui_flags="service">
<parameter id="LONG_ACTION_TYPE"> <logical type="boolean" />
<logical type="option"> <physical type="integer" interface="internal" value_id="CONFIG_PENDING" />
<option id="ON"/> </parameter>
<option id="OFF"/> </paramset>
<option id="INACTIVE"/> </channel>
<option id="TOGGLE" default="true"/> <channel index="1" type="SWITCH" count="2" physical_index_offset="-1">
</logical> <paramset id="hmw_switch_ch_master" type="MASTER" address_step="1" address_start="0x06">
<physical size="0.2" type="integer" interface="eeprom"> <parameter id="LOGGING">
<address index="+6.2"/> <logical type="option">
</physical> <option id="OFF" />
</parameter> <option id="ON" default="true" />
<parameter id="LONGRELEASE_ACTION_TYPE"> </logical>
<logical type="option"> <physical size="0.1" type="integer" interface="eeprom">
<option id="ON"/> <address index="+0" />
<option id="OFF"/> </physical>
<option id="INACTIVE" default="true"/> </parameter>
<option id="TOGGLE"/> </paramset>
</logical> <paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x0C" address_step="7" peer_param="SENSOR" channel_param="CHANNEL">
<physical size="0.2" type="integer" interface="eeprom"> <parameter id="SENSOR" hidden="true" operations="none">
<address index="+6.4"/> <logical type="address" />
</physical> <physical type="array">
</parameter> <physical size="4.0" type="integer" interface="eeprom">
<parameter id="DOUBLE_ACTION_TYPE"> <address index="+0" />
<logical type="option"> </physical>
<option id="ON"/> <physical size="1.0" type="integer" interface="eeprom">
<option id="OFF"/> <address index="+4" />
<option id="INACTIVE" default="true"/> </physical>
<option id="TOGGLE"/> </physical>
</logical> </parameter>
<physical size="0.2" type="integer" interface="eeprom"> <parameter id="CHANNEL" hidden="true" operations="none">
<address index="+6.6"/> <logical type="integer" min="0" max="255" default="255" />
</physical> <physical size="1.0" type="integer" interface="eeprom">
</parameter> <address index="+5" />
</paramset> </physical>
<paramset id="hmw_switch_ch_values" type="VALUES"> </parameter>
<parameter id="STATE" operations="read,write,event" control="SWITCH.STATE"> <parameter id="SHORT_ACTION_TYPE">
<logical type="boolean" default="false"/> <logical type="option">
<physical type="integer" interface="command" value_id="LEVEL"> <option id="ON" />
<set request="LEVEL_SET"/> <option id="OFF" />
<get request="LEVEL_GET" response="INFO_LEVEL"/> <option id="INACTIVE" />
<event frame="INFO_LEVEL"/> <option id="TOGGLE" default="true" />
</physical> </logical>
<conversion type="boolean_integer" true="200" false="0" threshold="1"/> <physical size="0.2" type="integer" interface="eeprom">
</parameter> <address index="+6" />
</paramset> </physical>
</channel> </parameter>
<channel index="3" type="SENSOR" count="4" physical_index_offset="-1"> <parameter id="LONG_ACTION_TYPE">
<paramset id="hmw_sensor_ch_master" type="MASTER" address_step="2" address_start="0x0a"> <logical type="option">
<parameter id="LOGGING"> <option id="ON" />
<logical type="option"> <option id="OFF" />
<option id="OFF"/> <option id="INACTIVE" />
<option id="ON" default="true"/> <option id="TOGGLE" default="true" />
</logical> </logical>
<physical size="0.1" type="integer" interface="eeprom"> <physical size="0.2" type="integer" interface="eeprom">
<address index="+0"/> <address index="+6.2" />
</physical> </physical>
</parameter> </parameter>
</paramset> <parameter id="LONGRELEASE_ACTION_TYPE">
<paramset id="hmw_sensor_ch_values" type="VALUES"> <logical type="option">
<parameter id="STATE" operations="read,event" control="SWITCH.STATE"> <option id="ON" />
<logical type="boolean" default="false"/> <option id="OFF" />
<physical type="integer" interface="command" value_id="LEVEL"> <option id="INACTIVE" default="true" />
<get request="LEVEL_GET" response="INFO_LEVEL"/> <option id="TOGGLE" />
<event frame="INFO_LEVEL"/> </logical>
</physical> <physical size="0.2" type="integer" interface="eeprom">
<conversion type="boolean_integer" true="200" false="0" threshold="1"/> <address index="+6.4" />
</parameter> </physical>
</paramset> </parameter>
</channel> <parameter id="DOUBLE_ACTION_TYPE">
</channels> <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="4" physical_index_offset="-1">
<paramset id="hmw_sensor_ch_master" type="MASTER" address_step="1" address_start="0x08">
<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> </device>

@ -1,210 +1,223 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="utf-8"?>
<device eep_size="512" version="01">
<supported_types>
<type priority="2" id="HBW-EBTEST" name="Elektor EBus Test Board">
<parameter const_value="0xE0" size="1" index="0"/>
<parameter const_value="0" size="1" index="1"/>
</type>
</supported_types>
<paramset id="HBW-EBTEST_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> <device eep_size="512" version="01">
<frame id="LEVEL_SET" type="#x" channel_field="10" direction="to_device"> <supported_types>
<parameter size="1.0" index="11.0" type="integer" param="LEVEL"/> <type priority="2" id="HBW-EBTEST" name="Elektor EBus Test Board">
</frame> <parameter const_value="0xE0" size="1" index="0" />
<frame id="LEVEL_GET" type="#S" channel_field="10" direction="to_device"/> <parameter const_value="0" size="1" index="1" />
<frame id="INFO_LEVEL" type="#i" channel_field="10" direction="from_device" event="true"> </type>
<parameter size="1.0" index="11.0" type="integer" param="LEVEL"/> </supported_types>
</frame> <paramset id="HBW-EBTEST_dev_master" type="MASTER">
<frame id="KEY_EVENT_SHORT" type="#K" channel_field="10" direction="from_device" event="true"> <parameter id="LOGGING_TIME">
<parameter const_value="2" size="0.2" index="12.0" type="integer"/> <logical type="float" unit="s" default="5.0" max="25.5" min="0.1" />
<parameter size="0.6" index="12.2" type="integer" param="COUNTER"/> <physical size="1.0" type="integer" interface="eeprom">
</frame> <address index="0x0001" />
<frame id="KEY_EVENT_LONG" type="#K" channel_field="10" direction="from_device" event="true"> </physical>
<parameter const_value="3" size="0.2" index="12.0" type="integer"/> <conversion type="float_integer_scale" offset="0.0" factor="10" />
<parameter size="0.6" index="12.2" type="integer" param="COUNTER"/> </parameter>
</frame> <parameter id="CENTRAL_ADDRESS" hidden="true">
<frame id="KEY_EVENT_LONGRELEASE" type="#K" channel_field="10" direction="from_device" event="true"> <logical type="integer" />
<parameter const_value="0" size="0.2" index="12.0" type="integer"/> <physical size="4" type="integer" interface="eeprom">
<parameter size="0.6" index="12.2" type="integer" param="COUNTER"/> <address index="0x0002" />
</frame> </physical>
<frame id="KEY_EVENT_DOUBLE" type="#K" channel_field="10" direction="from_device" event="true"> </parameter>
<parameter const_value="1" size="0.2" index="12.0" type="integer"/> <enforce id="CENTRAL_ADDRESS" value="1" />
<parameter size="0.6" index="12.2" type="integer" param="COUNTER"/> </paramset>
</frame> <frames>
</frames> <frame id="LEVEL_SET" type="#x" channel_field="10" direction="to_device">
<parameter size="1.0" index="11.0" type="integer" param="LEVEL" />
<channels> </frame>
<channel index="0" type="MAINTENANCE" count="1" class="maintenance" ui_flags="internal"> <frame id="LEVEL_GET" type="#S" channel_field="10" direction="to_device" />
</channel> <frame id="INFO_LEVEL" type="#i" channel_field="10" direction="from_device" event="true">
<channel index="1" type="SWITCH" count="1" physical_index_offset="-1"> <parameter size="1.0" index="11.0" type="integer" param="LEVEL" />
<paramset id="hmw_switch_ch_master" type="MASTER" address_step="1" address_start="0x06"> </frame>
<parameter id="LOGGING"> <frame id="KEY_EVENT_SHORT" type="#K" channel_field="10" direction="from_device" event="true">
<logical type="option"> <parameter const_value="2" size="0.2" index="12.0" type="integer" />
<option id="OFF"/> <parameter size="0.6" index="12.2" type="integer" param="COUNTER" />
<option id="ON" default="true"/> </frame>
</logical> <frame id="KEY_EVENT_LONG" type="#K" channel_field="10" direction="from_device" event="true">
<physical size="0.1" type="integer" interface="eeprom"> <parameter const_value="3" size="0.2" index="12.0" type="integer" />
<address index="+0"/> <parameter size="0.6" index="12.2" type="integer" param="COUNTER" />
</physical> </frame>
</parameter> <frame id="KEY_EVENT_LONGRELEASE" type="#K" channel_field="10" direction="from_device" event="true">
</paramset> <parameter const_value="0" size="0.2" index="12.0" type="integer" />
<paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x10" address_step="7" peer_param="SENSOR" channel_param="CHANNEL"> <parameter size="0.6" index="12.2" type="integer" param="COUNTER" />
<parameter id="SENSOR" hidden="true" operations="none"> </frame>
<logical type="address"/> <frame id="KEY_EVENT_DOUBLE" type="#K" channel_field="10" direction="from_device" event="true">
<physical type="array"> <parameter const_value="1" size="0.2" index="12.0" type="integer" />
<physical size="4.0" type="integer" interface="eeprom"> <parameter size="0.6" index="12.2" type="integer" param="COUNTER" />
<address index="+0"/> </frame>
</physical> </frames>
<physical size="1.0" type="integer" interface="eeprom"> <channels>
<address index="+4"/> <channel index="0" type="MAINTENANCE" ui_flags="internal" class="maintenance" count="1">
</physical> <paramset type="MASTER" id="maint_ch_master" />
</physical> <paramset type="VALUES" id="maint_ch_values">
</parameter> <parameter id="UNREACH" operations="read,event" ui_flags="service">
<parameter id="CHANNEL" hidden="true" operations="none"> <logical type="boolean" />
<logical type="integer" min="0" max="255" default="255"/> <physical type="integer" interface="internal" value_id="UNREACH" />
<physical size="1.0" type="integer" interface="eeprom"> </parameter>
<address index="+5"/> <parameter id="STICKY_UNREACH" operations="read,write,event" ui_flags="service">
</physical> <logical type="boolean" />
</parameter> <physical type="integer" interface="internal" value_id="STICKY_UNREACH" />
<parameter id="SHORT_ACTION_TYPE"> </parameter>
<logical type="option"> <parameter id="CONFIG_PENDING" operations="read,event" ui_flags="service">
<option id="ON"/> <logical type="boolean" />
<option id="OFF"/> <physical type="integer" interface="internal" value_id="CONFIG_PENDING" />
<option id="INACTIVE"/> </parameter>
<option id="TOGGLE" default="true"/> </paramset>
</logical> </channel>
<physical size="0.2" type="integer" interface="eeprom"> <channel index="1" type="SWITCH" count="1" physical_index_offset="-1">
<address index="+6"/> <paramset id="hmw_switch_ch_master" type="MASTER" address_step="1" address_start="0x06">
</physical> <parameter id="LOGGING">
</parameter> <logical type="option">
<parameter id="LONG_ACTION_TYPE"> <option id="OFF" />
<logical type="option"> <option id="ON" default="true" />
<option id="ON"/> </logical>
<option id="OFF"/> <physical size="0.1" type="integer" interface="eeprom">
<option id="INACTIVE"/> <address index="+0" />
<option id="TOGGLE" default="true"/> </physical>
</logical> </parameter>
<physical size="0.2" type="integer" interface="eeprom"> </paramset>
<address index="+6.2"/> <paramset id="hmw_switch_ch_link" type="LINK" count="16" address_start="0x68" address_step="7" peer_param="SENSOR" channel_param="CHANNEL">
</physical> <parameter id="SENSOR" hidden="true" operations="none">
</parameter> <logical type="address" />
<parameter id="LONGRELEASE_ACTION_TYPE"> <physical type="array">
<logical type="option"> <physical size="4.0" type="integer" interface="eeprom">
<option id="ON"/> <address index="+0" />
<option id="OFF"/> </physical>
<option id="INACTIVE" default="true"/> <physical size="1.0" type="integer" interface="eeprom">
<option id="TOGGLE"/> <address index="+4" />
</logical> </physical>
<physical size="0.2" type="integer" interface="eeprom"> </physical>
<address index="+6.4"/> </parameter>
</physical> <parameter id="CHANNEL" hidden="true" operations="none">
</parameter> <logical type="integer" min="0" max="255" default="255" />
<parameter id="DOUBLE_ACTION_TYPE"> <physical size="1.0" type="integer" interface="eeprom">
<logical type="option"> <address index="+5" />
<option id="ON"/> </physical>
<option id="OFF"/> </parameter>
<option id="INACTIVE" default="true"/> <parameter id="SHORT_ACTION_TYPE">
<option id="TOGGLE"/> <logical type="option">
</logical> <option id="ON" />
<physical size="0.2" type="integer" interface="eeprom"> <option id="OFF" />
<address index="+6.6"/> <option id="INACTIVE" />
</physical> <option id="TOGGLE" default="true" />
</parameter> </logical>
</paramset> <physical size="0.2" type="integer" interface="eeprom">
<paramset id="hmw_switch_ch_values" type="VALUES"> <address index="+6" />
<parameter id="STATE" operations="read,write,event" control="SWITCH.STATE"> </physical>
<logical type="boolean" default="false"/> </parameter>
<physical type="integer" interface="command" value_id="LEVEL"> <parameter id="LONG_ACTION_TYPE">
<set request="LEVEL_SET"/> <logical type="option">
<get request="LEVEL_GET" response="INFO_LEVEL"/> <option id="ON" />
<event frame="INFO_LEVEL"/> <option id="OFF" />
</physical> <option id="INACTIVE" />
<conversion type="boolean_integer" true="200" false="0" threshold="1"/> <option id="TOGGLE" default="true" />
</parameter> </logical>
</paramset> <physical size="0.2" type="integer" interface="eeprom">
</channel> <address index="+6.2" />
<channel index="2" type="KEY" count="1" physical_index_offset="-1"> </physical>
<link_roles> </parameter>
<source name="SWITCH"/> <parameter id="LONGRELEASE_ACTION_TYPE">
</link_roles> <logical type="option">
<paramset id="hmw_input_ch_master" type="MASTER" address_step="1" address_start="0x07"> <option id="ON" />
<parameter id="LONG_PRESS_TIME"> <option id="OFF" />
<logical type="float" unit="s" default="1.0" max="5.0" min="0.4"/> <option id="INACTIVE" default="true" />
<physical size="1.0" type="integer" interface="eeprom"> <option id="TOGGLE" />
<address index="+1"/> </logical>
</physical> <physical size="0.2" type="integer" interface="eeprom">
<conversion type="float_integer_scale" factor="10"/> <address index="+6.4" />
<conversion type="integer_integer_map"> </physical>
<value_map to_device="false" from_device="true" parameter_value="10" device_value="0xff"/> </parameter>
</conversion> <parameter id="DOUBLE_ACTION_TYPE">
</parameter> <logical type="option">
</paramset> <option id="ON" />
<paramset id="hmw_input_ch_link" type="LINK" count="16" address_step="6" address_start="0x80" channel_param="CHANNEL" peer_param="ACTUATOR"> <option id="OFF" />
<parameter hidden="true" id="CHANNEL" operations="none"> <option id="INACTIVE" default="true" />
<logical type="integer" default="255" max="255" min="0"/> <option id="TOGGLE" />
<physical size="1.0" type="integer" interface="eeprom"> </logical>
<address index="+0"/> <physical size="0.2" type="integer" interface="eeprom">
</physical> <address index="+6.6" />
</parameter> </physical>
<parameter hidden="true" id="ACTUATOR" operations="none"> </parameter>
<logical type="address"/> </paramset>
<physical type="array"> <paramset id="hmw_switch_ch_values" type="VALUES">
<physical size="4.0" type="integer" interface="eeprom"> <parameter id="STATE" operations="read,write,event" control="SWITCH.STATE">
<address index="+1"/> <logical type="boolean" default="false" />
</physical> <physical type="integer" interface="command" value_id="LEVEL">
<physical size="1.0" type="integer" interface="eeprom"> <set request="LEVEL_SET" />
<address index="+5"/> <get request="LEVEL_GET" response="INFO_LEVEL" />
</physical> <event frame="INFO_LEVEL" />
</physical> </physical>
</parameter> <conversion type="boolean_integer" true="200" false="0" threshold="1" />
</paramset> </parameter>
<paramset id="hmw_input_ch_values" type="VALUES"> </paramset>
<parameter id="PRESS_SHORT" operations="event,write" loopback="true" control="BUTTON.SHORT"> </channel>
<logical type="action"/> <channel index="2" type="KEY" count="1" physical_index_offset="-1">
<physical type="integer" interface="command" value_id="COUNTER"> <link_roles>
<event frame="KEY_EVENT_SHORT"/> <source name="SWITCH" />
</physical> </link_roles>
<conversion type="action_key_counter" counter_size="6" sim_counter="SIM_COUNTER"/> <paramset id="hmw_input_ch_master" type="MASTER" address_step="1" address_start="0x07">
</parameter> <parameter id="LONG_PRESS_TIME">
<parameter id="PRESS_LONG" operations="event,write" loopback="true" control="BUTTON.LONG"> <logical type="float" unit="s" default="1.0" max="5.0" min="0.4" />
<logical type="action"/> <physical size="1.0" type="integer" interface="eeprom">
<physical type="integer" interface="command" value_id="COUNTER"> <address index="+1" />
<event frame="KEY_EVENT_LONG"/> </physical>
</physical> <conversion type="float_integer_scale" factor="10" />
<conversion type="action_key_counter" counter_size="6" sim_counter="SIM_COUNTER"/> <conversion type="integer_integer_map">
</parameter> <value_map to_device="false" from_device="true" parameter_value="10" device_value="0xff" />
<parameter id="RELEASE_LONG" operations="event" loopback="true" control="BUTTON.RELEASE"> </conversion>
<logical type="action"/> </parameter>
<physical type="integer" interface="command" value_id="COUNTER"> </paramset>
<event frame="KEY_EVENT_LONGRELEASE"/> <paramset id="hmw_input_ch_link" type="LINK" count="16" address_step="6" address_start="0x08" channel_param="CHANNEL" peer_param="ACTUATOR">
</physical> <parameter hidden="true" id="CHANNEL" operations="none">
<conversion type="action_key_counter" counter_size="6" sim_counter="SIM_COUNTER"/> <logical type="integer" default="255" max="255" min="0" />
</parameter> <physical size="1.0" type="integer" interface="eeprom">
<parameter id="DOUBLECLICK" operations="event" loopback="true" control="BUTTON.DOUBLE"> <address index="+0" />
<logical type="action"/> </physical>
<physical type="integer" interface="command" value_id="COUNTER"> </parameter>
<event frame="KEY_EVENT_DOUBLE"/> <parameter hidden="true" id="ACTUATOR" operations="none">
</physical> <logical type="address" />
<conversion type="action_key_counter" counter_size="6" sim_counter="SIM_COUNTER"/> <physical type="array">
</parameter> <physical size="4.0" type="integer" interface="eeprom">
</paramset> <address index="+1" />
</channel> </physical>
</channels> <physical size="1.0" type="integer" interface="eeprom">
<address index="+5" />
</physical>
</physical>
</parameter>
</paramset>
<paramset id="hmw_input_ch_values" type="VALUES">
<parameter id="PRESS_SHORT" operations="event,write" loopback="true" control="BUTTON.SHORT">
<logical type="action" />
<physical type="integer" interface="command" value_id="COUNTER">
<event frame="KEY_EVENT_SHORT" />
</physical>
<conversion type="action_key_counter" counter_size="6" sim_counter="SIM_COUNTER" />
</parameter>
<parameter id="PRESS_LONG" operations="event,write" loopback="true" control="BUTTON.LONG">
<logical type="action" />
<physical type="integer" interface="command" value_id="COUNTER">
<event frame="KEY_EVENT_LONG" />
</physical>
<conversion type="action_key_counter" counter_size="6" sim_counter="SIM_COUNTER" />
</parameter>
<parameter id="RELEASE_LONG" operations="event" loopback="true" control="BUTTON.RELEASE">
<logical type="action" />
<physical type="integer" interface="command" value_id="COUNTER">
<event frame="KEY_EVENT_LONGRELEASE" />
</physical>
<conversion type="action_key_counter" counter_size="6" sim_counter="SIM_COUNTER" />
</parameter>
<parameter id="DOUBLECLICK" operations="event" loopback="true" control="BUTTON.DOUBLE">
<logical type="action" />
<physical type="integer" interface="command" value_id="COUNTER">
<event frame="KEY_EVENT_DOUBLE" />
</physical>
<conversion type="action_key_counter" counter_size="6" sim_counter="SIM_COUNTER" />
</parameter>
</paramset>
</channel>
</channels>
</device> </device>

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

@ -27,7 +27,7 @@ void hbw_read_config(void)
ee = eeprom_read_byte((const uint8_t *)6); ee = eeprom_read_byte((const uint8_t *)6);
logging0 = ee & 0x01; logging0 = ee & 0x01;
ee = eeprom_read_byte((const uint8_t *)8); ee = eeprom_read_byte((const uint8_t *)7);
logging1 = ee & 0x01; logging1 = ee & 0x01;
} }
@ -105,13 +105,13 @@ void hbw_receive_key(uint32_t saddress, uint8_t schannel, uint8_t channel, uint8
return; return;
for (i=0; i < 16; i++) { for (i=0; i < 16; i++) {
if ((eeprom_read_byte((const uint8_t *)(i*7)+0x10) == ((uint8_t*)&saddress)[0]) && if ((eeprom_read_byte((const uint8_t *)(i*7)+0x0C) == ((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)+0x0D) == ((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)+0x0E) == ((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)+0x0F) == ((uint8_t*)&saddress)[3]) &&
(eeprom_read_byte((const uint8_t *)(i*7)+0x14) == schannel) && (eeprom_read_byte((const uint8_t *)(i*7)+0x10) == schannel) &&
(eeprom_read_byte((const uint8_t *)(i*7)+0x15) == channel)) { (eeprom_read_byte((const uint8_t *)(i*7)+0x11) == channel)) {
type = eeprom_read_byte((const uint8_t *)(i*7)+0x16); type = eeprom_read_byte((const uint8_t *)(i*7)+0x12);
switch (countflag & 3) { switch (countflag & 3) {
case 1: case 1:
type = (type >> 6) & 0x3; type = (type >> 6) & 0x3;

@ -25,7 +25,7 @@ void hbw_read_config(void)
ee = eeprom_read_byte((const uint8_t *)6); ee = eeprom_read_byte((const uint8_t *)6);
logging = ee & 0x01; logging = ee & 0x01;
ee = eeprom_read_byte((const uint8_t *)8); ee = eeprom_read_byte((const uint8_t *)7);
if (ee == 0xFF) if (ee == 0xFF)
longtime = 1000; longtime = 1000;

Loading…
Cancel
Save