From faed3a8e49c28222bb06ed124ec7a211d52c96a4 Mon Sep 17 00:00:00 2001 From: trilu Date: Sun, 23 Mar 2014 17:31:44 +0100 Subject: [PATCH] some adjustments --- examples/HM_LC_SW1_BA_PCB/HM_LC_SW1_BA_PCB.ino | 18 +++++++++++++++++- examples/HM_LC_SW1_BA_PCB/Register.h | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/examples/HM_LC_SW1_BA_PCB/HM_LC_SW1_BA_PCB.ino b/examples/HM_LC_SW1_BA_PCB/HM_LC_SW1_BA_PCB.ino index 10d592d..064eea0 100644 --- a/examples/HM_LC_SW1_BA_PCB/HM_LC_SW1_BA_PCB.ino +++ b/examples/HM_LC_SW1_BA_PCB/HM_LC_SW1_BA_PCB.ino @@ -60,7 +60,8 @@ void setup() { button[0].config(8, NULL); // configure button on specific pin and handover a function pointer to the main sketch relay[0].regInHM(1,&hm); // register relay class in HM to respective channel - relay[0].config(0,3,0,5,5); // configure the relay to monostable, therefore only one HW pin needed + //relay[0].config(0,3,0,5,5); // configure the relay to monostable, therefore only one HW pin needed + relay[0].config(&initRelay,&switchRelay,2,2); // init function, switch function, min delay, random delay for transmitting status message Serial << "\npair: " << pHex(regs.ch0.l0.pairCentral,3) << '\n'; } @@ -71,6 +72,21 @@ void loop() { } +void initRelay() { + digitalWrite(5,0); + pinMode(5,OUTPUT); +} +void switchRelay(uint8_t on) { + if (on) { + digitalWrite(5,1); + + } else { + digitalWrite(5,0); + + } +} + + //- HM functions ---------------------------------------------------------------------------------------------------------- void HM_Status_Request(uint8_t *data, uint8_t len) { // Serial << F("status request, data: ") << pHex(data,len) << '\n'; diff --git a/examples/HM_LC_SW1_BA_PCB/Register.h b/examples/HM_LC_SW1_BA_PCB/Register.h index cb60211..dbc51dc 100644 --- a/examples/HM_LC_SW1_BA_PCB/Register.h +++ b/examples/HM_LC_SW1_BA_PCB/Register.h @@ -17,6 +17,10 @@ HM::s_devParm dParm = { /* pointer to serial */ devParam, }; +HM::s_modtable modTbl[] = { + {0,0,(s_mod_dlgt)NULL}, + {0,0,(s_mod_dlgt)NULL}, +}; // 24 byte //- ---------------------------------------------------------------------------------------------------------------------- //- channel slice definition ---------------------------------------------------------------------------------------------