AskSin++
Register.h
1 //- -----------------------------------------------------------------------------------------------------------------------
2 // AskSin++
3 // 2017-10-19 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
4 //- -----------------------------------------------------------------------------------------------------------------------
5 
6 #ifndef __REGISTER_H__
7 #define __REGISTER_H__
8 
9 #include "ChannelList.h"
10 #include "cm.h"
11 #include "Debug.h"
12 
13 namespace as {
14 
15 // Device Registers used in List0
16 #define DREG_BURSTRX 0x01
17 #define DREG_INTKEY 0x02
18 #define DREG_LEDMODE 0x05
19 #define DREG_DISPLAY 0x05 //added twice, it's more plausible in sketch
20 #define DREG_POWERSUPPLY 0x08
21 #define DREG_CYCLICINFOMSG 0x09
22 #define DREG_MASTER_ID1 0x0A
23 #define DREG_MASTER_ID2 0x0B
24 #define DREG_MASTER_ID3 0x0C
25 #define DREG_BACKONTIME 0x0e
26 #define DREG_SABOTAGEMSG 0x10
27 #define DREG_CYCLICINFOMSGDIS 0x11
28 #define DREG_LOWBATLIMIT 0x12
29 #define DREG_TRANSMITTRYMAX 0x14
30 #define DREG_CONFBUTTONTIME 0x15
31 #define DREG_LOCALRESETDISABLE 0x18
32 #define DREG_TPARAMS 0x1b
33 #define DREG_WAKEUPBEHAVIOUR 0x21
34 #define DREG_BUTTON_MODE 0x32 // iButton Mode - Remote or State
35 #define DREG_BUZZER_ENABLED 0x33 // enable Buzzer (used in HB-Devices)
36 
37 // Channel Registers used in List1
38 #define CREG_EVENTFILTER 0x01
39 #define CREG_INTERVAL 0x02
40 #define CREG_LONGPRESSTIME 0x04
41 #define CREG_AES_ACTIVE 0x08
42 #define CREG_DOUBLEPRESSTIME 0x09
43 #define CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM_1 0x0b
44 #define CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM_2 0x0c
45 #define CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP_1 0x0d
46 #define CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP_2 0x0e
47 #define CREG_CHANGE_OVER_DELAY 0x0f
48 #define CREG_REFERENCE_RUN_COUNTER 0x10
49 #define CREG_MSGFORPOS 0x20
50 #define CREG_EVENTDELAYTIME 0x21
51 #define CREG_LEDONTIME 0x22
52 #define CREG_EVENTFILTERTIME 0x23
53 #define CREG_TRANSMITTRYMAX 0x30
54 #define CREG_LOADAPPEARBEHAVIOUR 0x31
55 #define CREG_OVERTEMPLEVEL 0x32
56 #define CREG_REDUCETEMPLEVEL 0x34
57 #define CREG_REDUCELEVEL 0x35
58 #define CREG_POWERUPACTION 0x56
59 #define CREG_STATUSINFO 0x57
60 #define CREG_CHARACTERISTIC 0x58
61 #define CREG_LOGICCOMBINATION 0x59
62 #define CREG_TX_MINDELAY 0x7b
63 #define CREG_TX_THRESHOLD_PERCENT 0xac
64 #define CREG_WATER_UPPER_THRESHOLD_CH 0x06
65 #define CREG_WATER_LOWER_THRESHOLD_CH 0x07
66 #define CREG_CASE_DESIGN 0x5a
67 #define CREG_CASE_HIGH_1 0x5e
68 #define CREG_CASE_HIGH_2 0x5f
69 #define CREG_FILL_LEVEL_1 0x62
70 #define CREG_FILL_LEVEL_2 0x63
71 #define CREG_CASE_WIDTH_1 0x66
72 #define CREG_CASE_WIDTH_2 0x67
73 #define CREG_CASE_LENGTH_1 0x6a
74 #define CREG_CASE_LENGTH_2 0x6b
75 #define CREG_MEASURE_LENGTH_1 0x6c
76 #define CREG_MEASURE_LENGTH_2 0x6d
77 #define CREG_USE_CUSTOM_CALIBRATION 0x6e
78 //POWER_METER REGS
79 #define CREG_AVERAGING 0x7a
80 #define CREG_TX_THRESHOLD_POWER_1 0x7c
81 #define CREG_TX_THRESHOLD_POWER_2 0x7d
82 #define CREG_TX_THRESHOLD_POWER_3 0x7e
83 #define CREG_TX_THRESHOLD_CURRENT_1 0x7f
84 #define CREG_TX_THRESHOLD_CURRENT_2 0x80
85 #define CREG_TX_THRESHOLD_VOLTAGE_1 0x81
86 #define CREG_TX_THRESHOLD_VOLTAGE_2 0x82
87 #define CREG_TX_THRESHOLD_FREQUENCY 0x83
88 #define CREG_COND_TX 0x84
89 #define CREG_COND_TX_DECISION_ABOVE 0x85
90 #define CREG_COND_TX_DECISION_BELOW 0x86
91 #define CREG_COND_TX_THRESHOLD_HI_1 0x87
92 #define CREG_COND_TX_THRESHOLD_HI_2 0x88
93 #define CREG_COND_TX_THRESHOLD_HI_3 0x89
94 #define CREG_COND_TX_THRESHOLD_HI_4 0x8a
95 #define CREG_COND_TX_THRESHOLD_LO_1 0x8b
96 #define CREG_COND_TX_THRESHOLD_LO_2 0x8c
97 #define CREG_COND_TX_THRESHOLD_LO_3 0x8d
98 #define CREG_COND_TX_THRESHOLD_LO_4 0x8e
99 
100 #define CREG_DATA_TRANSMISSION_CONDITION 0xb0
101 #define CREG_DATA_STABILITY_FILTER_TIME 0xb1
102 #define CREG_DATA_INPUT_PROPERTIES 0xb2
103 #define CREG_CHANNEL_FUNCTION 0x92
104 
105 // Peer Registers used in List3
106 #define PREG_CTRAMPONOFF 0x01
107 #define PREG_CTDELAYONOFF 0x02
108 #define PREG_CTONOFF 0x03
109 #define PREG_CONDVALUELOW 0x04
110 #define PREG_CONDVALUEHIGH 0x05
111 #define PREG_ONDELAYTIME 0x06
112 #define PREG_ONTIME 0x07
113 #define PREG_OFFDELAYTIME 0x08
114 #define PREG_OFFTIME 0x09
115 #define PREG_ACTIONTYPE 0x0A
116 #define PREG_JTONOFF 0x0B
117 #define PREG_JTDELAYONOFF 0x0C
118 #define PREG_JTRAMPONOFF 0x0D
119 #define PREG_DELAYMODE 0x0E
120 #define PREG_OFFLEVEL 0x0F
121 #define PREG_ONMINLEVEL 0x10
122 #define PREG_ONLEVEL 0x11
123 #define PREG_RAMPSTARTSTEP 0x12
124 #define PREG_RAMPONTIME 0x13
125 #define PREG_RAMPOFFTIME 0x14
126 #define PREG_DIMMINLEVEL 0x15
127 #define PREG_DIMMAXLEVEL 0x16
128 #define PREG_DIMSTEP 0x17
129 #define PREG_OFFDELAYSTEP 0x18
130 #define PREG_OFFDELAYNEWTIME 0x19
131 #define PREG_OFFDELAYOLDTIME 0x1A
132 #define PREG_CTREPONOFF 0x1C
133 #define PREG_MAXTIMEFIRSTDIR 0x1D
134 #define PREG_JTREFONOFF 0x1E
135 #define PREG_DRIVINGMODE 0x1F
136 #define PREG_ELSEACTIONTYPE 0x26
137 #define PREG_ELSEJTONOFF 0x27
138 #define PREG_ELSEJTDELAYONOFF 0x28
139 #define PREG_ELSEJTRAMPONOFF 0x29
140 #define PREG_ACTTYPE 0x24
141 #define PREG_ACTNUM 0x25
142 #define PREG_ACTINTENS 0x2B
143 
144 // Peer Registers used in List4
145 #define PREG_BURST_AES 0x01
146 
147 // some shortcuts
148 #define MASTERID_REGS DREG_MASTER_ID1,DREG_MASTER_ID2,DREG_MASTER_ID3
149 
150 #define CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM_1,CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM_2
151 #define CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP_1,CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP_2
152 #define CREG_CASE_HIGH CREG_CASE_HIGH_1,CREG_CASE_HIGH_2
153 #define CREG_FILL_LEVEL CREG_FILL_LEVEL_1,CREG_FILL_LEVEL_2
154 #define CREG_CASE_WIDTH CREG_CASE_WIDTH_1,CREG_CASE_WIDTH_2
155 #define CREG_CASE_LENGTH CREG_CASE_LENGTH_1,CREG_CASE_LENGTH_2
156 #define CREG_MEASURE_LENGTH CREG_MEASURE_LENGTH_1,CREG_MEASURE_LENGTH_2
157 #define CREG_TX_THRESHOLD_POWER CREG_TX_THRESHOLD_POWER_1,CREG_TX_THRESHOLD_POWER_2,CREG_TX_THRESHOLD_POWER_3
158 #define CREG_TX_THRESHOLD_CURRENT CREG_TX_THRESHOLD_CURRENT_1,CREG_TX_THRESHOLD_CURRENT_2
159 #define CREG_TX_THRESHOLD_VOLTAGE CREG_TX_THRESHOLD_VOLTAGE_1,CREG_TX_THRESHOLD_VOLTAGE_2
160 #define CREG_COND_TX_THRESHOLD_HI CREG_COND_TX_THRESHOLD_HI_1,CREG_COND_TX_THRESHOLD_HI_2,CREG_COND_TX_THRESHOLD_HI_3,CREG_COND_TX_THRESHOLD_HI_4
161 #define CREG_COND_TX_THRESHOLD_LO CREG_COND_TX_THRESHOLD_LO_1,CREG_COND_TX_THRESHOLD_LO_2,CREG_COND_TX_THRESHOLD_LO_3,CREG_COND_TX_THRESHOLD_LO_4
162 
163 // This is only a helper class
165 public:
166  static uint8_t getOffset(uint8_t reg,const uint8_t* reglist,uint8_t size) {
167  for(uint8_t idx=0; idx<size; ++idx) {
168  if(pgm_read_byte(reglist + idx) == reg) {
169  return idx;
170  }
171  }
172  return 0xff;
173  }
174  static uint8_t getRegister(uint8_t offset,const uint8_t* reglist,uint8_t size) {
175  if (offset < size) {
176  return pgm_read_byte(reglist + offset);
177  }
178  return 0xff;
179  }
180 };
181 
182 // This is a generic list using a Register class
183 template<class RegisterType>
184 class RegisterList : public BaseList {
185 public:
186  static uint8_t getOffset (uint8_t reg) { return RegisterType::getOffset(reg); }
187  static uint8_t getRegister (uint8_t offset) { return RegisterType::getRegister(offset); }
188  static uint8_t size () { return RegisterType::getSize(); }
189 
190  operator GenericList () const {
191  return GenericList(address(),size(),getRegister,getOffset);
192  }
193 
194  RegisterList (uint16_t a) : BaseList(a) {}
195 
196  bool writeRegister (uint8_t reg, uint8_t value) const {
197  uint8_t offset = RegisterType::getOffset(reg);
198  if( offset != 0xff ) {
199  return setByte(offset,value);
200  }
201  return false;
202  }
203  bool writeRegister (uint8_t reg, uint8_t mask,uint8_t shift,uint8_t value) const {
204  uint8_t offset = RegisterType::getOffset(reg);
205  if( offset != 0xff ) {
206  return setByte(offset,value,mask<<shift,shift);
207  }
208  return false;
209  }
210  bool writeBit (uint8_t reg,uint8_t bitnum,bool value) const {
211  uint8_t offset = RegisterType::getOffset(reg);
212  if( offset != 0xff ) {
213  return setBit(offset,0x01<<bitnum,value);
214  }
215  return false;
216  }
217 
218  uint8_t readRegister (uint8_t reg,uint8_t value=0) const {
219  uint8_t offset = RegisterType::getOffset(reg);
220  if( offset != 0xff ) {
221  value = getByte(offset);
222  }
223  return value;
224  }
225  uint8_t readRegister (uint8_t reg,uint8_t mask,uint8_t shift,uint8_t value=0) const {
226  uint8_t offset = RegisterType::getOffset(reg);
227  if( offset != 0xff ) {
228  value = getByte(offset,mask<<shift,shift);
229  }
230  return value;
231  }
232  bool readBit (uint8_t reg,uint8_t bitnum,bool value=false) const {
233  uint8_t offset = RegisterType::getOffset(reg);
234  if( offset != 0xff ) {
235  value = isBitSet(offset,0x01<<bitnum);
236  }
237  return value;
238  }
239 
240  void clear () {
241  BaseList::clear(0,RegisterType::getSize());
242  }
243 
244  void defaults () {
245  clear();
246  }
247 
248  void dump (const char* end = "\n") const {
249 #ifndef NDEBUG
250  for( uint8_t idx=0; idx < size(); ++idx ) {
251  uint8_t reg = getRegister(idx);
252  DHEX(reg);
253  DPRINT(F(":"));
254  DHEX(readRegister(reg));
255  DPRINT(F(" "));
256  }
257  DPRINT(end);
258 #endif
259  }
260 };
261 
262 
263 /*
264 const uint8_t SimpleRegisterRegister[4] PROGMEM = {0x01,0x02,0x55,0x56};
265 class SimpleRegister {
266 public:
267  static uint8_t getOffset(uint8_t reg) { return AskSinRegister::getOffset(reg,SimpleRegisterRegister,getSize()); }
268  static uint8_t getRegister(uint8_t offset) { return AskSinRegister::getRegister(offset,SimpleRegisterRegister,getSize()); }
269  static uint8_t getSize () { return sizeof(SimpleRegisterRegister); }
270 };
271 */
272 
273 /*
274 class ShortLongRegister {
275 public:
276  static uint8_t Register[4];
277  static uint8_t getOffset(uint8_t reg) {
278  if( reg & 0x80 ) {
279  return sizeof(Register) + getOffset(reg & ~0x80);
280  }
281  return AskSinRegister::getOffset(reg,Register,sizeof(Register));
282  }
283  static uint8_t getRegister(uint8_t offset) {
284  if( offset >= sizeof(Register) ) {
285  return getRegister( offset - sizeof(Register) ) | 0x80;
286  }
287  return AskSinRegister::getRegister(offset,Register,sizeof(Register));
288  }
289  static uint8_t getSize () { return 2*sizeof(Register); }
290 };
291 uint8_t ShortLongRegister::Register[] = {DREG_INTKEY,LIST0_REGS};
292 */
293 
294 #define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int))
295 
296 #define DEFREGISTER(rgname,...) const uint8_t __##rgname##Register__[NUMARGS(__VA_ARGS__)] PROGMEM = {__VA_ARGS__}; \
297  class rgname { public: \
298  static uint8_t getOffset(uint8_t reg) { return AskSinRegister::getOffset(reg,__##rgname##Register__,sizeof(__##rgname##Register__)); } \
299  static uint8_t getRegister(uint8_t offset) { return AskSinRegister::getRegister(offset,__##rgname##Register__,sizeof(__##rgname##Register__)); } \
300  static uint8_t getSize () { return sizeof(__##rgname##Register__); } \
301 };
302 
303 /*
304 #define DEFREGISTER2(rgname,...) const uint8_t __##rgname##Register__[NUMARGS(__VA_ARGS__)] PROGMEM = {__VA_ARGS__}; \
305  class rgname { public: \
306  static uint8_t getOffset(uint8_t reg) { \
307  if( reg & 0x80 ) { \
308  return sizeof(__##rgname##Register__) + getOffset(reg & ~0x80); \
309  } \
310  return AskSinRegister::getOffset(reg,__##rgname##Register__,sizeof(__##rgname##Register__)); \
311  } \
312  static uint8_t getRegister(uint8_t offset) { \
313  if( offset >= sizeof(__##rgname##Register__) ) { \
314  return getRegister( offset - sizeof(__##rgname##Register__) ) | 0x80; \
315  } \
316  return AskSinRegister::getRegister(offset,__##rgname##Register__,sizeof(__##rgname##Register__)); \
317  } \
318  static uint8_t getSize () { return 2*sizeof(__##rgname##Register__); } \
319 };
320 */
321 
322 template <class Register>
323 class RegList0 : public RegisterList<Register> {
324 public:
325  RegList0(uint16_t a) : RegisterList<Register>(a) {}
326 
327  bool aesActive () const { return false; }
328 
329  bool burstRx (bool v) const { return this->writeRegister(DREG_BURSTRX,v); }
330  bool burstRx () const { return this->readRegister(DREG_BURSTRX,false); }
331  bool intKeyVisible (bool v) const { return this->writeBit(DREG_INTKEY,7,v); }
332  bool intKeyVisible () const { return this->readBit(DREG_INTKEY,7,false); }
333 
334  HMID masterid () const { return HMID(
335  this->readRegister(DREG_MASTER_ID1),
336  this->readRegister(DREG_MASTER_ID2),
337  this->readRegister(DREG_MASTER_ID3));
338  }
339  void masterid (const HMID& mid) const {
340  this->writeRegister(DREG_MASTER_ID1,mid.id0());
341  this->writeRegister(DREG_MASTER_ID2,mid.id1());
342  this->writeRegister(DREG_MASTER_ID3,mid.id2());
343  };
344 
345  uint8_t powerSupply () const { return this->readRegister(DREG_POWERSUPPLY,0); }
346  bool powerSupply (uint8_t value) const { return this->writeRegister(DREG_POWERSUPPLY,value); }
347 
348  bool wakeupBehaviourStatusSignalizationConfirmation(bool v) const { return this->writeRegister(DREG_WAKEUPBEHAVIOUR,0x01,0,v); }
349  bool wakeupBehaviourStatusSignalizationConfirmation() const { return this->readRegister(DREG_WAKEUPBEHAVIOUR, 0x01,0,false); }
350  bool wakeupBehaviourStatusMsgConfirmation(bool v) const { return this->writeRegister(DREG_WAKEUPBEHAVIOUR,0x01,1,v); }
351  bool wakeupBehaviourStatusMsgConfirmation() const { return this->readRegister(DREG_WAKEUPBEHAVIOUR, 0x01,1,false); }
352  bool wakeupBehaviourStatusMsgResistance(bool v) const { return this->writeRegister(DREG_WAKEUPBEHAVIOUR,0x01,2,v); }
353  bool wakeupBehaviourStatusMsgResistance() const { return this->readRegister(DREG_WAKEUPBEHAVIOUR, 0x01,2,false); }
354 
355  bool displayInverting(bool v) const { return this->writeRegister(DREG_DISPLAY,0x01,6,v); }
356  bool displayInverting() const { return this->readRegister(DREG_DISPLAY, 0x01,6,false); }
357  bool statusMessageTextAlignmentLeftAligned(bool v) const { return this->writeRegister(DREG_DISPLAY,0x01,7,v); }
358  bool statusMessageTextAlignmentLeftAligned() const { return this->readRegister(DREG_DISPLAY, 0x01,7,false); }
359 
360  uint8_t ledMode () const { return this->readRegister(DREG_LEDMODE,0x03,6,1); }
361  bool ledMode (uint8_t value) const { return this->writeRegister(DREG_LEDMODE,0x03,6,value); }
362  bool cycleInfoMsg () const { return this->readRegister(DREG_CYCLICINFOMSG,false); }
363  bool cycleInfoMsg (bool value) const { return this->writeRegister(DREG_CYCLICINFOMSG,value); }
364  uint8_t transmitDevTryMax () const { uint8_t v = this->readRegister(DREG_TRANSMITTRYMAX,6); return v == 0 ? 1 : v; }
365  bool transmitDevTryMax (uint8_t value) const { return this->writeRegister(DREG_TRANSMITTRYMAX,value); }
366  bool sabotageMsg () const { return this->readRegister(DREG_SABOTAGEMSG,true); }
367  bool sabotageMsg (bool value) const { return this->writeRegister(DREG_SABOTAGEMSG,value); }
368  uint8_t cyclicInfoMsgDis () const { return this->readRegister(DREG_CYCLICINFOMSGDIS,0); }
369  bool cyclicInfoMsgDis (uint8_t value) const { return this->writeRegister(DREG_CYCLICINFOMSGDIS,value); }
370  uint8_t lowBatLimit () const { return this->readRegister(DREG_LOWBATLIMIT,0); }
371  bool lowBatLimit (uint8_t value) const { return this->writeRegister(DREG_LOWBATLIMIT,value); }
372  uint8_t tParamSelect () const { return this->readRegister(DREG_TPARAMS,3); }
373  bool tParamSelect (uint8_t value) const { return this->writeRegister(DREG_TPARAMS,value); }
374 
375  uint8_t confButtonTime () const { return this->readRegister(DREG_CONFBUTTONTIME,0); }
376  bool confButtonTime (uint8_t value) const { return this->writeRegister(DREG_CONFBUTTONTIME,value); }
377  bool localResetDisable (bool v) const { return this->writeBit(DREG_LOCALRESETDISABLE,0,v); }
378  bool localResetDisable () const { return this->readBit(DREG_LOCALRESETDISABLE,0,false); }
379 
380  uint8_t backOnTime () const { return this->readRegister(DREG_BACKONTIME,3); }
381  bool backOnTime (uint8_t value) const { return this->writeRegister(DREG_BACKONTIME,value); }
382 
383  uint8_t buttonMode () const { return this->readRegister(DREG_BUTTON_MODE,0); }
384  bool buttonMode (uint8_t value) const { return this->writeRegister(DREG_BUTTON_MODE,value); }
385 
386  bool buzzerEnabled (bool v) const { return this->writeBit(DREG_BUZZER_ENABLED,0,v); }
387  bool buzzerEnabled () const { return this->readBit(DREG_BUZZER_ENABLED,0,false); }
388 };
389 
390 template <class Register>
391 class RegList2 : public RegisterList<Register> {
392 public:
393  RegList2 (uint16_t addr) : RegisterList<Register>(addr) {}
394 
395  bool ADDRESS_SENDER_HIGH_BYTE(uint8_t index,uint8_t value) const { return this->writeRegister(1+(index*7), value); }
396  uint8_t ADDRESS_SENDER_HIGH_BYTE(uint8_t index) const { return this->readRegister (1+(index*7), 0); }
397  bool ADDRESS_SENDER_MID_BYTE (uint8_t index,uint8_t value) const { return this->writeRegister(2+(index*7), value); }
398  uint8_t ADDRESS_SENDER_MID_BYTE (uint8_t index) const { return this->readRegister (2+(index*7), 0); }
399  bool ADDRESS_SENDER_LOW_BYTE (uint8_t index,uint8_t value) const { return this->writeRegister(3+(index*7), value); }
400  uint8_t ADDRESS_SENDER_LOW_BYTE (uint8_t index) const { return this->readRegister (3+(index*7), 0); }
401 
402  bool ADDRESS_RECEIVER_HIGH_BYTE(uint8_t index,uint8_t value) const { return this->writeRegister(4+(index*7), value); }
403  uint8_t ADDRESS_RECEIVER_HIGH_BYTE(uint8_t index) const { return this->readRegister (4+(index*7), 0); }
404  bool ADDRESS_RECEIVER_MID_BYTE (uint8_t index,uint8_t value) const { return this->writeRegister(5+(index*7), value); }
405  uint8_t ADDRESS_RECEIVER_MID_BYTE (uint8_t index) const { return this->readRegister (5+(index*7), 0); }
406  bool ADDRESS_RECEIVER_LOW_BYTE (uint8_t index,uint8_t value) const { return this->writeRegister(6+(index*7), value); }
407  uint8_t ADDRESS_RECEIVER_LOW_BYTE (uint8_t index) const { return this->readRegister (6+(index*7), 0); }
408 
409  bool BROADCAST_BEHAVIOR (uint8_t index,uint8_t value) const { return this->writeRegister(7+(index*7), value); }
410  uint8_t BROADCAST_BEHAVIOR (uint8_t index) const { return this->readRegister (7+(index*7), 0); }
411 };
412 
413 
414 template <class Register>
415 class RegList1 : public RegisterList<Register> {
416 public:
417  RegList1(uint16_t a) : RegisterList<Register>(a) {}
418 
419  bool aesActive(bool v) const { return this->writeRegister(CREG_AES_ACTIVE,0x01,0,v); }
420  bool aesActive() const { return this->readRegister(CREG_AES_ACTIVE,0x01,0,false); }
421 
422  bool msgForPosC(uint8_t v) const { return this->writeRegister(CREG_MSGFORPOS,0x03,2,v); }
423  uint8_t msgForPosC() const { return this->readRegister(CREG_MSGFORPOS,0x03,2,0); }
424  bool msgForPosB(uint8_t v) const { return this->writeRegister(CREG_MSGFORPOS,0x03,4,v); }
425  uint8_t msgForPosB() const { return this->readRegister(CREG_MSGFORPOS,0x03,4,0); }
426  bool msgForPosA(uint8_t v) const { return this->writeRegister(CREG_MSGFORPOS,0x03,6,v); }
427  uint8_t msgForPosA() const { return this->readRegister(CREG_MSGFORPOS,0x03,6,0); }
428 
429  bool eventDelaytime(uint8_t v) const { return this->writeRegister(CREG_EVENTDELAYTIME,v); }
430  uint8_t eventDelaytime() const { return this->readRegister(CREG_EVENTDELAYTIME,0); }
431  bool ledOntime(uint8_t v) const { return this->writeRegister(CREG_LEDONTIME,v); }
432  uint8_t ledOntime() const { return this->readRegister(CREG_LEDONTIME,100); }
433  bool eventFilterTime(uint8_t v) const { return this->writeRegister(CREG_EVENTFILTERTIME,v); }
434  uint8_t eventFilterTime() const { return this->readRegister(CREG_EVENTFILTERTIME,5); }
435  bool transmitTryMax(uint8_t v) const { return this->writeRegister(CREG_TRANSMITTRYMAX,v); }
436  uint8_t transmitTryMax() const { uint8_t v = this->readRegister(CREG_TRANSMITTRYMAX,6); return v == 0 ? 1 : v;}
437  bool loadAppearBehaviour(uint8_t v) const { return this->writeRegister(CREG_LOADAPPEARBEHAVIOUR,v); }
438  uint8_t loadAppearBehaviour() const { uint8_t v = this->readRegister(CREG_LOADAPPEARBEHAVIOUR,0); return v > 3 ? 3 : v;}
439 
440  uint8_t longPressTime () const { return this->readRegister(CREG_LONGPRESSTIME,0x0f,4,1); }
441  bool longPressTime (uint8_t v) const { return this->writeRegister(CREG_LONGPRESSTIME,0x0f,4,v); }
442  uint8_t doublePressTime () const { return this->readRegister(CREG_DOUBLEPRESSTIME,0x0f,0,0); }
443  bool doublePressTime (uint8_t v) const { return this->writeRegister(CREG_DOUBLEPRESSTIME,0x0f,0,v); }
444 
445  bool refRunningTimeTopBottom (uint16_t value) const {
446  return this->writeRegister(CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM_1, (value >> 8) & 0xff) &&
447  this->writeRegister(CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM_2, value & 0xff);
448  }
449  uint16_t refRunningTimeTopBottom () const {
450  return (this->readRegister(CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM_1,0) << 8) +
451  this->readRegister(CREG_REFERENCE_RUNNING_TIME_TOP_BOTTOM_2,0);
452  }
453  bool refRunningTimeBottomTop (uint16_t value) const {
454  return this->writeRegister(CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP_1, (value >> 8) & 0xff) &&
455  this->writeRegister(CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP_2, value & 0xff);
456  }
457  uint16_t refRunningTimeBottomTop () const {
458  return (this->readRegister(CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP_1,0) << 8) +
459  this->readRegister(CREG_REFERENCE_RUNNING_TIME_BOTTOM_TOP_2,0);
460  }
461  bool changeOverDelay(uint8_t v) const { return this->writeRegister(CREG_CHANGE_OVER_DELAY,v); }
462  uint8_t changeOverDelay() const { return this->readRegister(CREG_CHANGE_OVER_DELAY,0); }
463  bool refRunCounter(uint8_t v) const { return this->writeRegister(CREG_REFERENCE_RUN_COUNTER,v); }
464  uint8_t refRunCounter() const { return this->readRegister(CREG_REFERENCE_RUN_COUNTER,0); }
465 
466  uint8_t eventFilterPeriod () const { return this->readRegister(CREG_EVENTFILTER,0x0f,0,1); }
467  bool eventFilterPeriod (uint8_t v) const { return this->writeRegister(CREG_EVENTFILTER,0x0f,0,v); }
468  uint8_t eventFilterNumber () const { return this->readRegister(CREG_EVENTFILTER,0x0f,4,1); }
469  bool eventFilterNumber (uint8_t v) const { return this->writeRegister(CREG_EVENTFILTER,0x0f,4,v); }
470 
471  uint8_t minInterval () const { return this->readRegister(CREG_INTERVAL,0x07,0,4); }
472  bool minInterval (uint8_t v) const { return this->writeRegister(CREG_INTERVAL,0x07,0,v); }
473  bool captureWithinInterval () const { return this->readBit(CREG_INTERVAL,3,false); }
474  bool captureWithinInterval (bool v) const { return this->writeBit(CREG_INTERVAL,3,v); }
475  uint8_t brightnessFilter () const { return this->readRegister(CREG_INTERVAL,0x0f,4,7); }
476  bool brightnessFilter (uint8_t v) const { return this->writeRegister(CREG_INTERVAL,0x0f,4,v); }
477 
478  bool powerUpAction () const { return this->readBit(CREG_POWERUPACTION,0,false); }
479  bool powerUpAction (bool v) const { return this->writeBit(CREG_POWERUPACTION,0,v); }
480 
481  uint8_t statusInfoMinDly () const { return this->readRegister(CREG_STATUSINFO,0x1f,0,4); }
482  bool statusInfoMinDly (uint8_t v) { return this->writeRegister(CREG_STATUSINFO,0x1f,0,v); }
483  uint8_t statusInfoRandom () const { return this->readRegister(CREG_STATUSINFO,0x07,5,1); }
484  bool statusInfoRandom (uint8_t v) { return this->writeRegister(CREG_STATUSINFO,0x07,5,v); }
485 
486  uint8_t overTempLevel () const { return this->readRegister(CREG_OVERTEMPLEVEL,80); }
487  bool overTempLevel (uint8_t v) const { return this->writeRegister(CREG_OVERTEMPLEVEL,v); }
488  uint8_t reduceTempLevel () const { return this->readRegister(CREG_REDUCETEMPLEVEL,75); }
489  bool reduceTempLevel (uint8_t v) const { return this->writeRegister(CREG_REDUCETEMPLEVEL,v); }
490  uint8_t reduceLevel () const { return this->readRegister(CREG_REDUCELEVEL,80); }
491  bool reduceLevel (uint8_t v) const { return this->writeRegister(CREG_REDUCELEVEL,v); }
492 
493  bool characteristic () const { return this->readBit(CREG_CHARACTERISTIC,0,true); }
494  bool characteristic (bool v) const { return this->writeBit(CREG_CHARACTERISTIC,0,v); }
495  uint8_t logicCombination () const { return this->readRegister(CREG_LOGICCOMBINATION,0x1f,0,1); }
496  bool logicCombination (uint8_t v) { return this->writeRegister(CREG_LOGICCOMBINATION,0x1f,0,v); }
497 
498  uint8_t txMindelay () const { return this->readRegister(CREG_TX_MINDELAY,0x7f,0,8); }
499  bool txMindelay (uint8_t v) { return this->writeRegister(CREG_TX_MINDELAY,0x7f,0,v); }
500  uint8_t txThresholdPercent () const { return this->readRegister(CREG_TX_THRESHOLD_PERCENT,0); }
501  bool txThresholdPercent (uint8_t v) const { return this->writeRegister(CREG_TX_THRESHOLD_PERCENT,v); }
502  uint8_t waterUpperThreshold () const { return this->readRegister(CREG_WATER_UPPER_THRESHOLD_CH,0xff); }
503  bool waterUpperThreshold (uint8_t v) const { return this->writeRegister(CREG_WATER_UPPER_THRESHOLD_CH,v); }
504 
505  uint8_t waterLowerThreshold () const { return this->readRegister(CREG_WATER_LOWER_THRESHOLD_CH,0xff); }
506  bool waterLowerThreshold (uint8_t v) const { return this->writeRegister(CREG_WATER_LOWER_THRESHOLD_CH,v); }
507 
508  uint8_t caseDesign () const { return this->readRegister(CREG_CASE_DESIGN,0); }
509  bool caseDesign (uint8_t v) const { return this->writeRegister(CREG_CASE_DESIGN,v); }
510 
511  bool caseHigh (uint16_t value) const {
512  return this->writeRegister(CREG_CASE_HIGH_1, (value >> 8) & 0xff) &&
513  this->writeRegister(CREG_CASE_HIGH_2, value & 0xff);
514  }
515  uint16_t caseHigh () const {
516  return (this->readRegister(CREG_CASE_HIGH_1,0) << 8) +
517  this->readRegister(CREG_CASE_HIGH_2,0);
518  }
519 
520  bool caseWidth (uint16_t value) const {
521  return this->writeRegister(CREG_CASE_WIDTH_1, (value >> 8) & 0xff) &&
522  this->writeRegister(CREG_CASE_WIDTH_2, value & 0xff);
523  }
524  uint16_t caseWidth () const {
525  return (this->readRegister(CREG_CASE_WIDTH_1,0) << 8) +
526  this->readRegister(CREG_CASE_WIDTH_2,0);
527  }
528 
529  bool caseLength (uint16_t value) const {
530  return this->writeRegister(CREG_CASE_LENGTH_1, (value >> 8) & 0xff) &&
531  this->writeRegister(CREG_CASE_LENGTH_2, value & 0xff);
532  }
533  uint16_t caseLength () const {
534  return (this->readRegister(CREG_CASE_LENGTH_1,0) << 8) +
535  this->readRegister(CREG_CASE_LENGTH_2,0);
536  }
537 
538  bool measureLength (uint16_t value) const {
539  return this->writeRegister(CREG_MEASURE_LENGTH_1, (value >> 8) & 0xff) &&
540  this->writeRegister(CREG_MEASURE_LENGTH_2, value & 0xff);
541  }
542  uint16_t measureLength () const {
543  return (this->readRegister(CREG_MEASURE_LENGTH_1,0) << 8) +
544  this->readRegister(CREG_MEASURE_LENGTH_2,0);
545  }
546 
547  bool fillLevel (uint16_t value) const {
548  return this->writeRegister(CREG_FILL_LEVEL_1, (value >> 8) & 0xff) &&
549  this->writeRegister(CREG_FILL_LEVEL_2, value & 0xff);
550  }
551  uint16_t fillLevel () const {
552  return (this->readRegister(CREG_FILL_LEVEL_1,0) << 8) +
553  this->readRegister(CREG_FILL_LEVEL_2,0);
554  }
555 
556  bool useCustomCalibration () const { return this->readBit(CREG_USE_CUSTOM_CALIBRATION,0,true); }
557  bool useCustomCalibration (bool v) const { return this->writeBit(CREG_USE_CUSTOM_CALIBRATION,0,v); }
558 
559  uint8_t averaging () const { return this->readRegister(CREG_AVERAGING,0); }
560  bool averaging (uint8_t v) const { return this->writeRegister(CREG_AVERAGING,v); }
561 
562  bool txThresholdPower (uint32_t value) const {
563  return
564  this->writeRegister(CREG_TX_THRESHOLD_POWER_1, (value >> 16) & 0xff) &&
565  this->writeRegister(CREG_TX_THRESHOLD_POWER_2, (value >> 8) & 0xff) &&
566  this->writeRegister(CREG_TX_THRESHOLD_POWER_3, (value ) & 0xff);
567  }
568  uint32_t txThresholdPower () const {
569  return
570  ((uint32_t)this->readRegister(CREG_TX_THRESHOLD_POWER_1,0) << 16) |
571  ((uint32_t)this->readRegister(CREG_TX_THRESHOLD_POWER_2,0) << 8) |
572  ((uint32_t)this->readRegister(CREG_TX_THRESHOLD_POWER_3,0) );
573  }
574 
575  bool txThresholdCurrent (uint16_t value) const {
576  return
577  this->writeRegister(CREG_TX_THRESHOLD_CURRENT_1, (value >> 8) & 0xff) &&
578  this->writeRegister(CREG_TX_THRESHOLD_CURRENT_2, (value ) & 0xff);
579  }
580  uint16_t txThresholdCurrent () const {
581  return
582  (this->readRegister(CREG_TX_THRESHOLD_CURRENT_1,0) << 8) |
583  (this->readRegister(CREG_TX_THRESHOLD_CURRENT_2,0) );
584  }
585 
586  bool txThresholdVoltage (uint16_t value) const {
587  return
588  this->writeRegister(CREG_TX_THRESHOLD_VOLTAGE_1, (value >> 8) & 0xff) &&
589  this->writeRegister(CREG_TX_THRESHOLD_VOLTAGE_2, (value ) & 0xff);
590  }
591  uint16_t txThresholdVoltage () const {
592  return
593  (this->readRegister(CREG_TX_THRESHOLD_VOLTAGE_1,0) << 8) |
594  (this->readRegister(CREG_TX_THRESHOLD_VOLTAGE_2,0) );
595  }
596 
597  uint8_t txThresholdFrequency () const { return this->readRegister(CREG_TX_THRESHOLD_FREQUENCY,0); }
598  bool txThresholdFrequency (uint8_t v) const { return this->writeRegister(CREG_TX_THRESHOLD_FREQUENCY,v); }
599 
600  uint8_t condTxDecisionAbove () const { return this->readRegister(CREG_COND_TX_DECISION_ABOVE,0xff); }
601  bool condTxDecisionAbove (uint8_t v) const { return this->writeRegister(CREG_COND_TX_DECISION_ABOVE,v); }
602 
603  uint8_t condTxDecisionBelow () const { return this->readRegister(CREG_COND_TX_DECISION_BELOW,0xff); }
604  bool condTxDecisionBelow (uint8_t v) const { return this->writeRegister(CREG_COND_TX_DECISION_BELOW,v); }
605 
606  bool condTxFalling () const { return this->readRegister(CREG_COND_TX,0x01,0,false); }
607  bool condTxFalling (uint8_t v) { return this->writeRegister(CREG_COND_TX,0x01,0,v); }
608 
609  bool condTxRising () const { return this->readRegister(CREG_COND_TX,0x02,0,false); }
610  bool condTxRising (uint8_t v) { return this->writeRegister(CREG_COND_TX,0x02,0,v); }
611 
612  bool condTxCyclicBelow () const { return this->readRegister(CREG_COND_TX,0x04,0,false); }
613  bool condTxCyclicBelow (uint8_t v) { return this->writeRegister(CREG_COND_TX,0x04,0,v); }
614 
615  bool condTxCyclicAbove () const { return this->readRegister(CREG_COND_TX,0x08,0,false); }
616  bool condTxCyclicAbove (uint8_t v) { return this->writeRegister(CREG_COND_TX,0x08,0,v); }
617 
618  bool condTxThresholdHi (uint32_t value) const {
619  return
620  this->writeRegister(CREG_COND_TX_THRESHOLD_HI_1, (value >> 24) & 0xff) &&
621  this->writeRegister(CREG_COND_TX_THRESHOLD_HI_2, (value >> 16) & 0xff) &&
622  this->writeRegister(CREG_COND_TX_THRESHOLD_HI_3, (value >> 8) & 0xff) &&
623  this->writeRegister(CREG_COND_TX_THRESHOLD_HI_4, (value ) & 0xff);
624  }
625  uint32_t condTxThresholdHi () const {
626  return
627  ((uint32_t)this->readRegister(CREG_COND_TX_THRESHOLD_HI_1,0) << 24) |
628  ((uint32_t)this->readRegister(CREG_COND_TX_THRESHOLD_HI_2,0) << 16) |
629  ((uint32_t)this->readRegister(CREG_COND_TX_THRESHOLD_HI_3,0) << 8) |
630  ((uint32_t)this->readRegister(CREG_COND_TX_THRESHOLD_HI_4,0) );
631  }
632 
633  bool condTxThresholdLo (uint32_t value) const {
634  return
635  this->writeRegister(CREG_COND_TX_THRESHOLD_LO_1, (value >> 24) & 0xff) &&
636  this->writeRegister(CREG_COND_TX_THRESHOLD_LO_2, (value >> 16) & 0xff) &&
637  this->writeRegister(CREG_COND_TX_THRESHOLD_LO_3, (value >> 8) & 0xff) &&
638  this->writeRegister(CREG_COND_TX_THRESHOLD_LO_4, (value ) & 0xff);
639  }
640  uint32_t condTxThresholdLo () const {
641  return
642  ((uint32_t)this->readRegister(CREG_COND_TX_THRESHOLD_LO_1,0) << 24) |
643  ((uint32_t)this->readRegister(CREG_COND_TX_THRESHOLD_LO_2,0) << 16) |
644  ((uint32_t)this->readRegister(CREG_COND_TX_THRESHOLD_LO_3,0) << 8) |
645  ((uint32_t)this->readRegister(CREG_COND_TX_THRESHOLD_LO_4,0) );
646  }
647 
648  uint8_t dataTransmissionCondtion() const { return this->readRegister(CREG_DATA_TRANSMISSION_CONDITION,0); }
649  bool dataTransmissionCondtion(uint8_t v) const { return this->writeRegister(CREG_DATA_TRANSMISSION_CONDITION,v); }
650 
651  uint8_t dataStabilityFilterTime () const { return this->readRegister(CREG_DATA_STABILITY_FILTER_TIME,0); }
652  bool dataStabilityFilterTime (uint8_t v) const { return this->writeRegister(CREG_DATA_STABILITY_FILTER_TIME,v); }
653 
654  bool dataInputPropertieIn0 () const { return this->readRegister(CREG_DATA_INPUT_PROPERTIES,0x01,0,false); }
655  bool dataInputPropertieIn0 (uint8_t v) { return this->writeRegister(CREG_DATA_INPUT_PROPERTIES,0x01,0,v); }
656 
657  bool dataInputPropertieIn1 () const { return this->readRegister(CREG_DATA_INPUT_PROPERTIES,0x02,0,false); }
658  bool dataInputPropertieIn1 (uint8_t v) { return this->writeRegister(CREG_DATA_INPUT_PROPERTIES,0x02,0,v); }
659 
660  bool dataInputPropertieIn2 () const { return this->readRegister(CREG_DATA_INPUT_PROPERTIES,0x04,0,false); }
661  bool dataInputPropertieIn2 (uint8_t v) { return this->writeRegister(CREG_DATA_INPUT_PROPERTIES,0x04,0,v); }
662 
663  bool dataInputPropertieIn3 () const { return this->readRegister(CREG_DATA_INPUT_PROPERTIES,0x08,0,false); }
664  bool dataInputPropertieIn3 (uint8_t v) { return this->writeRegister(CREG_DATA_INPUT_PROPERTIES,0x08,0,v); }
665 
666  bool dataInputPropertieIn4 () const { return this->readRegister(CREG_DATA_INPUT_PROPERTIES,0x10,0,false); }
667  bool dataInputPropertieIn4 (uint8_t v) { return this->writeRegister(CREG_DATA_INPUT_PROPERTIES,0x10,0,v); }
668 
669  bool dataInputPropertieIn5 () const { return this->readRegister(CREG_DATA_INPUT_PROPERTIES,0x20,0,false); }
670  bool dataInputPropertieIn5 (uint8_t v) { return this->writeRegister(CREG_DATA_INPUT_PROPERTIES,0x20,0,v); }
671 
672  bool dataInputPropertieIn6 () const { return this->readRegister(CREG_DATA_INPUT_PROPERTIES,0x40,0,false); }
673  bool dataInputPropertieIn6 (uint8_t v) { return this->writeRegister(CREG_DATA_INPUT_PROPERTIES,0x40,0,v); }
674 
675  bool dataInputPropertieIn7 () const { return this->readRegister(CREG_DATA_INPUT_PROPERTIES,0x80,0,false); }
676  bool dataInputPropertieIn7 (uint8_t v) { return this->writeRegister(CREG_DATA_INPUT_PROPERTIES,0x80,0,v); }
677 
678  uint8_t channelFunction () const { return this->readRegister(CREG_CHANNEL_FUNCTION,0); }
679  bool channelFunction (uint8_t v) const { return this->writeRegister(CREG_CHANNEL_FUNCTION,v); }
680 };
681 
682 
683 template <class Register>
684 class RegList3 : public RegisterList<Register> {
685 public:
686  RegList3(uint16_t a) : RegisterList<Register>(a) {}
687 
688  uint8_t ctRampOn () const { return this->readRegister(PREG_CTRAMPONOFF,0x0f,0); }
689  bool ctRampOn (uint8_t v) const { return this->writeRegister(PREG_CTRAMPONOFF,0x0f,0,v); }
690  uint8_t ctRampOff () const { return this->readRegister(PREG_CTRAMPONOFF,0x0f,4); }
691  bool ctRampOff (uint8_t v) const { return this->writeRegister(PREG_CTRAMPONOFF,0x0f,4,v); }
692  uint8_t ctDlyOn () const { return this->readRegister(PREG_CTDELAYONOFF,0x0f,0); }
693  bool ctDlyOn (uint8_t v) const { return this->writeRegister(PREG_CTDELAYONOFF,0x0f,0,v); }
694  uint8_t ctDlyOff () const { return this->readRegister(PREG_CTDELAYONOFF,0x0f,4); }
695  bool ctDlyOff (uint8_t v) const { return this->writeRegister(PREG_CTDELAYONOFF,0x0f,4,v); }
696  uint8_t ctOn () const { return this->readRegister(PREG_CTONOFF,0x0f,0); }
697  bool ctOn (uint8_t v) const { return this->writeRegister(PREG_CTONOFF,0x0f,0,v); }
698  uint8_t ctOff () const { return this->readRegister(PREG_CTONOFF,0x0f,4); }
699  bool ctOff (uint8_t v) const { return this->writeRegister(PREG_CTONOFF,0x0f,4,v); }
700  uint8_t ctRepOn () const { return this->readRegister(PREG_CTREPONOFF,0x0f,0); }
701  bool ctRepOn (uint8_t v) const { return this->writeRegister(PREG_CTREPONOFF,0x0f,0,v); }
702  uint8_t ctRepOff () const { return this->readRegister(PREG_CTREPONOFF,0x0f,4); }
703  bool ctRepOff (uint8_t v) const { return this->writeRegister(PREG_CTREPONOFF,0x0f,4,v); }
704 
705  uint8_t ctValLo() const { return this->readRegister(PREG_CONDVALUELOW,0x32); }
706  bool ctValLo(uint8_t v) const { return this->writeRegister(PREG_CONDVALUELOW,v); }
707  uint8_t ctValHi() const { return this->readRegister(PREG_CONDVALUEHIGH,0x64); }
708  bool ctValHi(uint8_t v) const { return this->writeRegister(PREG_CONDVALUEHIGH,v); }
709  uint8_t onDly() const { return this->readRegister(PREG_ONDELAYTIME,0x00); }
710  bool onDly(uint8_t v) const { return this->writeRegister(PREG_ONDELAYTIME,v); }
711  uint8_t onTime() const { return this->readRegister(PREG_ONTIME,0xff); }
712  bool onTime(uint8_t v) const { return this->writeRegister(PREG_ONTIME,v); }
713  uint8_t offDly() const { return this->readRegister(PREG_OFFDELAYTIME,0x00); }
714  bool offDly(uint8_t v) const { return this->writeRegister(PREG_OFFDELAYTIME,v); }
715  uint8_t offTime() const { return this->readRegister(PREG_OFFTIME,0xff); }
716  bool offTime(uint8_t v) const { return this->writeRegister(PREG_OFFTIME,v); }
717 
718  uint8_t actionType() const { return this->readRegister(PREG_ACTIONTYPE,0x0f,0); }
719  bool actionType(uint8_t v) const { return this->writeRegister(PREG_ACTIONTYPE,0x0f,0,v); }
720  bool multiExec() const { return this->readBit(PREG_ACTIONTYPE,5,false); }
721  bool multiExec(bool v) const { return this->writeBit(PREG_ACTIONTYPE,5,v); }
722  bool offTimeMode() const { return this->readBit(PREG_ACTIONTYPE,6,false); }
723  bool offTimeMode(bool v) const { return this->writeBit(PREG_ACTIONTYPE,6,v); }
724  bool onTimeMode() const { return this->readBit(PREG_ACTIONTYPE,7,false); }
725  bool onTimeMode(bool v) const { return this->writeBit(PREG_ACTIONTYPE,7,v); }
726 
727  uint8_t jtOn () const { return this->readRegister(PREG_JTONOFF,0x0f,0,AS_CM_JT_OFFDELAY); }
728  bool jtOn (uint8_t v) const { return this->writeRegister(PREG_JTONOFF,0x0f,0,v); }
729  uint8_t jtOff () const { return this->readRegister(PREG_JTONOFF,0x0f,4,AS_CM_JT_ONDELAY); }
730  bool jtOff (uint8_t v) const { return this->writeRegister(PREG_JTONOFF,0x0f,4,v); }
731  uint8_t jtDlyOn () const { return this->readRegister(PREG_JTDELAYONOFF,0x0f,0,AS_CM_JT_REFON); }
732  bool jtDlyOn (uint8_t v) const { return this->writeRegister(PREG_JTDELAYONOFF,0x0f,0,v); }
733  uint8_t jtDlyOff () const { return this->readRegister(PREG_JTDELAYONOFF,0x0f,4,AS_CM_JT_REFOFF); }
734  bool jtDlyOff (uint8_t v) const { return this->writeRegister(PREG_JTDELAYONOFF,0x0f,4,v); }
735  uint8_t jtRampOn () const { return this->readRegister(PREG_JTRAMPONOFF,0x0f,0,AS_CM_JT_ON); }
736  bool jtRampOn (uint8_t v) const { return this->writeRegister(PREG_JTRAMPONOFF,0x0f,0,v); }
737  uint8_t jtRampOff () const { return this->readRegister(PREG_JTRAMPONOFF,0x0f,4,AS_CM_JT_OFF); }
738  bool jtRampOff (uint8_t v) const { return this->writeRegister(PREG_JTRAMPONOFF,0x0f,4,v); }
739  uint8_t jtRefOn () const { return this->readRegister(PREG_JTREFONOFF,0x0f,0,AS_CM_JT_RAMPON); }
740  bool jtRefOn (uint8_t v) const { return this->writeRegister(PREG_JTREFONOFF,0x0f,0,v); }
741  uint8_t jtRefOff () const { return this->readRegister(PREG_JTREFONOFF,0x0f,4,AS_CM_JT_RAMPOFF); }
742  bool jtRefOff (uint8_t v) const { return this->writeRegister(PREG_JTREFONOFF,0x0f,4,v); }
743 
744  bool offDelayBlink() const { return this->readBit(PREG_DELAYMODE,5,0); }
745  bool offDelayBlink(bool v) const { return this->writeBit(PREG_DELAYMODE,5,v); }
746  bool onLevelPrio() const { return this->readBit(PREG_DELAYMODE,6,0); }
747  bool onLevelPrio(bool v) const { return this->writeBit(PREG_DELAYMODE,6,v); }
748  bool onDelayMode() const { return this->readBit(PREG_DELAYMODE,7,0); }
749  bool onDelayMode(bool v) const { return this->writeBit(PREG_DELAYMODE,7,v); }
750 
751  uint8_t offLevel() const { return this->readRegister(PREG_OFFLEVEL,0x00); }
752  bool offLevel(uint8_t v) const { return this->writeRegister(PREG_OFFLEVEL,v); }
753  uint8_t onMinLevel() const { return this->readRegister(PREG_ONMINLEVEL,20); }
754  bool onMinLevel(uint8_t v) const { return this->writeRegister(PREG_ONMINLEVEL,v); }
755  uint8_t onLevel() const { return this->readRegister(PREG_ONLEVEL,200); }
756  bool onLevel(uint8_t v) const { return this->writeRegister(PREG_ONLEVEL,v); }
757  uint8_t maxTimeFirstDir() const { return this->readRegister(PREG_MAXTIMEFIRSTDIR,254); }
758  bool maxTimeFirstDir(uint8_t v) const { return this->writeRegister(PREG_MAXTIMEFIRSTDIR,v); }
759  uint8_t drivingMode() const { return this->readRegister(PREG_DRIVINGMODE,0); }
760  bool drivingMode(uint8_t v) const { return this->writeRegister(PREG_DRIVINGMODE,v); }
761 
762  uint8_t rampStartStep() const { return this->readRegister(PREG_RAMPSTARTSTEP,10); }
763  bool rampStartStep(uint8_t v) const { return this->writeRegister(PREG_RAMPSTARTSTEP,v); }
764  uint8_t rampOnTime() const { return this->readRegister(PREG_RAMPONTIME,0x00); }
765  bool rampOnTime(uint8_t v) const { return this->writeRegister(PREG_RAMPONTIME,v); }
766  uint8_t rampOffTime() const { return this->readRegister(PREG_RAMPOFFTIME,0x00); }
767  bool rampOffTime(uint8_t v) const { return this->writeRegister(PREG_RAMPOFFTIME,v); }
768  uint8_t dimMinLevel() const { return this->readRegister(PREG_DIMMINLEVEL,0x00); }
769  bool dimMinLevel(uint8_t v) const { return this->writeRegister(PREG_DIMMINLEVEL,v); }
770  uint8_t dimMaxLevel() const { return this->readRegister(PREG_DIMMAXLEVEL,200); }
771  bool dimMaxLevel(uint8_t v) const { return this->writeRegister(PREG_DIMMAXLEVEL,v); }
772  uint8_t dimStep() const { return this->readRegister(PREG_DIMSTEP,0x05); }
773  bool dimStep(uint8_t v) const { return this->writeRegister(PREG_DIMSTEP,v); }
774  uint8_t offDelayStep() const { return this->readRegister(PREG_OFFDELAYSTEP,0x0a); }
775  bool offDelayStep(uint8_t v) const { return this->writeRegister(PREG_OFFDELAYSTEP,v); }
776  uint8_t offDelayNewTime() const { return this->readRegister(PREG_OFFDELAYNEWTIME,0x05); }
777  bool offDelayNewTime(uint8_t v) const { return this->writeRegister(PREG_OFFDELAYNEWTIME,v); }
778  uint8_t offDelayOldTime() const { return this->readRegister(PREG_OFFDELAYOLDTIME,0x05); }
779  bool offDelayOldTime(uint8_t v) const { return this->writeRegister(PREG_OFFDELAYOLDTIME,v); }
780 
781  uint8_t elseActionType() const { return this->readRegister(PREG_ELSEACTIONTYPE,0x0f,0); }
782  bool elseActionType(uint8_t v) const { return this->writeRegister(PREG_ELSEACTIONTYPE,0x0f,0,v); }
783  bool elseOffTimeMode() const { return this->readBit(PREG_ELSEACTIONTYPE,6,false); }
784  bool elseOffTimeMode(bool v) const { return this->writeBit(PREG_ELSEACTIONTYPE,6,v); }
785  bool elseOnTimeMode() const { return this->readBit(PREG_ELSEACTIONTYPE,7,false); }
786  bool elseOnTimeMode(bool v) const { return this->writeBit(PREG_ELSEACTIONTYPE,7,v); }
787 
788  uint8_t elseJtOn () const { return this->readRegister(PREG_ELSEJTONOFF,0x0f,0); }
789  bool elseJtOn (uint8_t v) const { return this->writeRegister(PREG_ELSEJTONOFF,0x0f,0,v); }
790  uint8_t elseJtOff () const { return this->readRegister(PREG_ELSEJTONOFF,0x0f,4); }
791  bool elseJtOff (uint8_t v) const { return this->writeRegister(PREG_ELSEJTONOFF,0x0f,4,v); }
792  uint8_t elseJtDlyOn () const { return this->readRegister(PREG_ELSEJTDELAYONOFF,0x0f,0); }
793  bool elseJtDlyOn (uint8_t v) const { return this->writeRegister(PREG_ELSEJTDELAYONOFF,0x0f,0,v); }
794  uint8_t elseJtDlyOff () const { return this->readRegister(PREG_ELSEJTDELAYONOFF,0x0f,4); }
795  bool elseJtDlyOff (uint8_t v) const { return this->writeRegister(PREG_ELSEJTDELAYONOFF,0x0f,4,v); }
796  uint8_t elseJtRampOn () const { return this->readRegister(PREG_ELSEJTRAMPONOFF,0x0f,0); }
797  bool elseJtRampOn (uint8_t v) const { return this->writeRegister(PREG_ELSEJTRAMPONOFF,0x0f,0,v); }
798  uint8_t elseJtRampOff () const { return this->readRegister(PREG_ELSEJTRAMPONOFF,0x0f,4); }
799  bool elseJtRampOff (uint8_t v) const { return this->writeRegister(PREG_ELSEJTRAMPONOFF,0x0f,4,v); }
800 
801  uint8_t actType() const { return this->readRegister(PREG_ACTTYPE,0x00); }
802  bool actType(uint8_t v) const { return this->writeRegister(PREG_ACTTYPE,v); }
803  uint8_t actNum() const { return this->readRegister(PREG_ACTNUM,0x00); }
804  bool actNum(uint8_t v) const { return this->writeRegister(PREG_ACTNUM,v); }
805  uint8_t actIntens() const { return this->readRegister(PREG_ACTINTENS,0x00); }
806  bool actIntens(uint8_t v) const { return this->writeRegister(PREG_ACTINTENS,v); }
807 
808 };
809 
810 
811 template <class Register>
812 class RegList4 : public RegisterList<Register> {
813 public:
814  RegList4(uint16_t a) : RegisterList<Register>(a) {}
815 
816  bool burst() const { return peerNeedsBurst(); }
817 
818  bool peerNeedsBurst(bool v) const { return this->writeRegister(PREG_BURST_AES,0x01,0,v); }
819  bool peerNeedsBurst() const { return this->readRegister(PREG_BURST_AES,0x01,0,false); }
820 
821  bool expectAES(bool v) const { return this->writeRegister(PREG_BURST_AES,0x01,7,v); }
822  bool expectAES() const { return this->readRegister(PREG_BURST_AES,0x01,7,false); }
823 };
824 
825 
826 template <class PeerListType>
827 class ShortLongList : public BaseList{
828 public:
829  typedef PeerListType PeerList;
830  ShortLongList(uint16_t a) : BaseList(a) {}
831 
832  const PeerList sh () const { return PeerList(this->address()); }
833  const PeerList lg () const { return PeerList(this->address() + PeerList::size() ); }
834 
835  static uint8_t getOffset(uint8_t reg) {
836  if( reg & 0x80 ) {
837  return PeerList::size() + getOffset(reg & ~0x80);
838  }
839  return PeerList::getOffset(reg);
840  }
841  static uint8_t getRegister(uint8_t offset) {
842  if( offset >= PeerList::size() ) {
843  return getRegister( offset - PeerList::size() ) | 0x80;
844  }
845  return PeerList::getRegister(offset);
846  }
847  static uint8_t size () { return 2*PeerList::size(); }
848 
849  operator GenericList () const {
850  return GenericList(address(),size(),getRegister,getOffset);
851  }
852 
853  void dump () {
854  sh().dump(" ");
855  lg().dump();
856  }
857 };
858 
859 DEFREGISTER(DefaultRegisterList0,DREG_INTKEY,MASTERID_REGS)
860 typedef RegList0<DefaultRegisterList0> DefList0;
861 
862 DEFREGISTER(DefaultRegisterList1,CREG_AES_ACTIVE)
863 typedef RegList1<DefaultRegisterList1> DefList1;
864 
865 DEFREGISTER(DefaultRegisterList4,PREG_BURST_AES)
866 typedef RegList4<DefaultRegisterList4> DefList4;
867 
868 }
869 
870 #endif
as::RegList4
Definition: Register.h:812
as::RegList2
Definition: Register.h:391
as::RegList3
Definition: Register.h:684
as::RegisterList
Definition: Register.h:184
as::BaseList
Definition: ChannelList.h:14
as::RegList1
Definition: Register.h:415
as::ShortLongList
Definition: Register.h:827
as::RegList0
Definition: Register.h:323
as::GenericList
Definition: ChannelList.h:72
as::HMID
Definition: HMID.h:14
as::AskSinRegister
Definition: Register.h:164