From: andre Ebersold Date: Sat, 18 Nov 2023 08:33:30 +0000 (+0100) Subject: Simplified ParameterHandling. Same Class for all application X-Git-Url: https://git.ebersold.fr/?a=commitdiff_plain;h=9b6efcdb0034de4dd9404a79f44417c3d19af2d3;p=atmel%2Favr.git Simplified ParameterHandling. Same Class for all application --- diff --git a/Application/DCMotor/main.cpp b/Application/DCMotor/main.cpp index 3d14737..ace3bc2 100644 --- a/Application/DCMotor/main.cpp +++ b/Application/DCMotor/main.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -165,7 +165,7 @@ void init(IParameterHandler *m_Param) int main(void) { Timer1 lCounter; - DCMotorParameterHandler gParam; + ParameterHandler gParam; #if defined (__AVR_ATmega32U4__) Led0 led(&PORTC, &DDRC, PINB7,&gParam); AvrPwm pwmA; diff --git a/Application/PowerSwitch/main.cpp b/Application/PowerSwitch/main.cpp index 6ede18c..4f337dc 100644 --- a/Application/PowerSwitch/main.cpp +++ b/Application/PowerSwitch/main.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -152,7 +152,7 @@ void init(IParameterHandler *m_Param) */ int main(void) { - PowerswitchParameterHandler gParam; + ParameterHandler gParam; #if defined (__AVR_ATmega32U4__) Led0 led(&PORTC, &DDRC, PINB7,&gParam); #else diff --git a/Application/ShutterCtrl/main.cpp b/Application/ShutterCtrl/main.cpp index e0ee6d3..12ea68c 100644 --- a/Application/ShutterCtrl/main.cpp +++ b/Application/ShutterCtrl/main.cpp @@ -24,7 +24,7 @@ //#include #include #include -#include +#include #include #include @@ -168,7 +168,7 @@ void init(IParameterHandler *m_Param) int main(void) { Timer1 lCounter; - ShutterCtrlParameterHandler gParam; + ParameterHandler gParam; Led0 led(&PORTB, &DDRB, PINB5,&gParam); AvrUart uart(IUart::BAUD_9600,IUart::PARITY_NONE,IUart::STB_ONE); AvrEeprom gEeprom; diff --git a/Application/WorkhourMeter/CMakeLists.txt b/Application/WorkhourMeter/CMakeLists.txt index 705607d..4f90315 100644 --- a/Application/WorkhourMeter/CMakeLists.txt +++ b/Application/WorkhourMeter/CMakeLists.txt @@ -6,6 +6,7 @@ add_avr_executable( main.cpp Led0.cpp WorkMeterHandler.cpp + Scheduler.cpp ) target_link_libraries( diff --git a/Application/WorkhourMeter/Scheduler.cpp b/Application/WorkhourMeter/Scheduler.cpp new file mode 100644 index 0000000..b54d580 --- /dev/null +++ b/Application/WorkhourMeter/Scheduler.cpp @@ -0,0 +1,124 @@ +#include +#include + +#include +#include +#include +#include +#include +#include +#include "Abstract/RFID/IPN532Interface.h" +#include +#include +#include +#include +#include +#include + +#include "Led0.h" + +#include "Scheduler.h" + + + +Scheduler::Scheduler( Led0 *_led,IProtocolLayer2 *_net + , ITask *_com + , ITask *_argRtc + , ITask *_Storage + , ITask *_RFIDReader + ) + : + m_Led(_led) + , m_Netstring(_net) + , m_Com(_com) + , m_WorkMeter(_argRtc) + , m_Storage(_Storage) + , m_RFIDReader(_RFIDReader) + , m_CurrentTimeslot(FIRST_TIME_SLOT) + , m_CurrentTask(TASK1) + { + } +// main entry point +void Scheduler::schedule() +{ + +static const Scheduler::pFunction_t task[3] = { + &Scheduler::doTask1 + , &Scheduler::doTask2 + , &Scheduler::doTask3 +}; + + + waitForTimeslot(); + m_Com->run(); +#if 1 + (this->*(task[m_CurrentTask]))(); +#else + switch (m_CurrentTask) + { + case TASK1: + //m_Adc->run(); + m_WorkMeter->run(); + //m_Led->tick(); + break; + case TASK2: + m_Led->tick(); + m_RFIDReader->run(); + break; + case TASK3: + m_Led->tick(); + m_Storage->run(); + break; + default: + ; + + } +#endif + m_CurrentTask = gTasks[m_CurrentTask].m_NextTask; +} + +void Scheduler::doTask1() +{ + m_WorkMeter->run(); +} +void Scheduler::doTask2() +{ + m_Led->tick(); + m_RFIDReader->run(); +} +void Scheduler::doTask3() +{ + m_Led->tick(); + m_Storage->run(); +} + +// called by the interrupt timer handler +void Scheduler::tick() +{ + m_CurrentTimeslot = (m_CurrentTimeslot < LAST_TIME_SLOT) + ? (TIME_SLOTS)(m_CurrentTimeslot+1) + : (FIRST_TIME_SLOT); + m_Netstring->tick(); +} + +void Scheduler::waitForTimeslot( void ) +{ + /// prevent instant scheduling + while (m_CurrentTimeslot == gTasks[m_CurrentTask].m_FirstTimeslot ) + { + ; + } + // beginning of the timeslot + while (m_CurrentTimeslot != gTasks[m_CurrentTask].m_FirstTimeslot ) + { + ; + } +} + + +Scheduler::Task_type Scheduler::gTasks[TASK_COUNT] = { + { FIRST_TIME_SLOT , TASK2 } + , { BLOCK2_FIRST_TIME_SLOT, TASK3 } + , { BLOCK3_FIRST_TIME_SLOT, TASK1 } +}; + diff --git a/Application/WorkhourMeter/Scheduler.h b/Application/WorkhourMeter/Scheduler.h new file mode 100644 index 0000000..eec15ad --- /dev/null +++ b/Application/WorkhourMeter/Scheduler.h @@ -0,0 +1,69 @@ +#ifndef __SCHEDULER_H__ +#define __SCHEDULER_H__ + +/** + * @brief the scheduler will still slice the execution + * flow. The whole cycle is now 40 ticks ! + * 40 * + * 250ns * 4 = 1us * 10 = 10 us. On fast devices. + * + * 16MHz / 8 / 256 = 100us each tick + * + */ +class Scheduler : public IInterruptActivity +{ + typedef void (Scheduler::*pFunction_t)(); + private: + enum TIME_SLOTS { + FIRST_TIME_SLOT = 0, + BLOCK2_FIRST_TIME_SLOT = 30, + BLOCK3_FIRST_TIME_SLOT = 60, + LAST_TIME_SLOT = 99, + TIME_SLOT_COUNT = 99 // :( not used + }; + enum ETASK_ID { + TASK1 = 0, + TASK2 = 1, + TASK3 = 2, + TASK_COUNT = 3 + }; + typedef struct Task_t { + TIME_SLOTS m_FirstTimeslot; + ETASK_ID m_NextTask; + } Task_type ; + + static Task_type gTasks[TASK_COUNT]; + private: + Led0 *m_Led; + IProtocolLayer2 *m_Netstring; + ITask *m_Com; + ITask *m_WorkMeter; + ITask *m_Storage; + ITask *m_RFIDReader; + volatile TIME_SLOTS m_CurrentTimeslot; + ETASK_ID m_CurrentTask; + RtcTime_t m_Time; + private: + void doTask1(); + + void doTask2(); + void doTask3(); + public: + Scheduler( Led0 *_led,IProtocolLayer2 *_net + , ITask *_com + , ITask *_argRtc + , ITask *_Storage + , ITask *_RFIDReader + ); + + // main entry point + void schedule(); + + // called by the interrupt timer handler + virtual void tick(); + + private: + void waitForTimeslot( void ) ; +}; + +#endif diff --git a/Application/WorkhourMeter/main.cpp b/Application/WorkhourMeter/main.cpp index 6f4b2b4..6fe2c25 100644 --- a/Application/WorkhourMeter/main.cpp +++ b/Application/WorkhourMeter/main.cpp @@ -41,10 +41,8 @@ #include #include "Led0.h" #include "WorkMeterHandler.h" -#if 0 -#include "Switch.h" -#include "PowerswitchHandler.h" -#endif +#include "Scheduler.h" + /** * @brief the scheduler will still slice the execution * flow. The whole cycle is now 40 ticks ! @@ -54,144 +52,6 @@ * 16MHz / 8 / 256 = 100us each tick * */ -class Scheduler : public IInterruptActivity -{ - typedef void (Scheduler::*pFunction_t)(); - private: - enum TIME_SLOTS { - FIRST_TIME_SLOT = 0, - BLOCK2_FIRST_TIME_SLOT = 30, - BLOCK3_FIRST_TIME_SLOT = 60, - LAST_TIME_SLOT = 99, - TIME_SLOT_COUNT = 99 // :( not used - }; - enum ETASK_ID { - TASK1 = 0, - TASK2 = 1, - TASK3 = 2, - TASK_COUNT = 3 - }; - typedef struct Task_t { - TIME_SLOTS m_FirstTimeslot; - ETASK_ID m_NextTask; - } Task_type ; - - static Task_type gTasks[TASK_COUNT]; - private: - Led0 *m_Led; - IProtocolLayer2 *m_Netstring; - CommunicationHandler *m_Com; - ITask *m_WorkMeter; - ITask *m_Storage; - ITask *m_RFIDReader; - volatile TIME_SLOTS m_CurrentTimeslot; - ETASK_ID m_CurrentTask; - RtcTime_t m_Time; - private: - void doTask1() - { - m_WorkMeter->run(); - } - void doTask2() - { - m_Led->tick(); - m_RFIDReader->run(); - } - void doTask3() - { - m_Led->tick(); - m_Storage->run(); - } - public: - Scheduler( Led0 *_led,IProtocolLayer2 *_net - , CommunicationHandler *_com - , ITask *_argRtc - , ITask *_Storage - , ITask *_RFIDReader - ) - : - m_Led(_led) - , m_Netstring(_net) - , m_Com(_com) - , m_WorkMeter(_argRtc) - , m_Storage(_Storage) - , m_RFIDReader(_RFIDReader) - , m_CurrentTimeslot(FIRST_TIME_SLOT) - , m_CurrentTask(TASK1) - { - } - // main entry point - void schedule() - { - - static const Scheduler::pFunction_t task[3] = { - &Scheduler::doTask1 - , &Scheduler::doTask2 - , &Scheduler::doTask3 - }; - - - waitForTimeslot(); - m_Com->run(); -#if 1 - (this->*(task[m_CurrentTask]))(); -#else - switch (m_CurrentTask) - { - case TASK1: - //m_Adc->run(); - m_WorkMeter->run(); - //m_Led->tick(); - break; - case TASK2: - m_Led->tick(); - m_RFIDReader->run(); - break; - case TASK3: - m_Led->tick(); - m_Storage->run(); - break; - default: - ; - - } -#endif - m_CurrentTask = gTasks[m_CurrentTask].m_NextTask; - } - - // called by the interrupt timer handler - virtual void tick() - { - m_CurrentTimeslot = (m_CurrentTimeslot < LAST_TIME_SLOT) - ? (TIME_SLOTS)(m_CurrentTimeslot+1) - : (FIRST_TIME_SLOT); - m_Netstring->tick(); - } - - private: - void waitForTimeslot( void ) - { - /// prevent instant scheduling - while (m_CurrentTimeslot == gTasks[m_CurrentTask].m_FirstTimeslot ) - { - ; - } - // beginning of the timeslot - while (m_CurrentTimeslot != gTasks[m_CurrentTask].m_FirstTimeslot ) - { - ; - } - } - - -}; - -Scheduler::Task_type Scheduler::gTasks[TASK_COUNT] = { - { FIRST_TIME_SLOT , TASK2 } - , { BLOCK2_FIRST_TIME_SLOT, TASK3 } - , { BLOCK3_FIRST_TIME_SLOT, TASK1 } -}; - /** * \brief Init database .... */ @@ -212,7 +72,7 @@ int main(void) #else Led0 led(&PORTB, &DDRB, PINB5,&gParam); #endif - AvrUart uart(IUart::BAUD_9600,IUart::PARITY_NONE,IUart::STB_ONE); + AvrUart uart(IUart::BAUD_19200,IUart::PARITY_NONE,IUart::STB_ONE); AvrI2C gI2c; DS3231 gRtc(&gI2c); LiquidCrystal lcd(&gI2c @@ -257,7 +117,7 @@ int main(void) msg[0]= static_cast( (ver >>16 & 0xFF) + 48 ); msg[1]= static_cast( (ver >>8 & 0xFF ) + 48 ); lcd.print(msg); - nfc.setPassiveActivationRetries(0x01); + nfc.setPassiveActivationRetries(0x03); nfc.SAMConfig(); lTimer.init(); init(&gParam); diff --git a/Communication/CommunicationHandler.cpp b/Communication/CommunicationHandler.cpp index 4fbaeb8..d9468d5 100644 --- a/Communication/CommunicationHandler.cpp +++ b/Communication/CommunicationHandler.cpp @@ -6,6 +6,8 @@ #include // To be removed #endif #include +#include +#include #include CommunicationHandler::CommunicationHandler(IProtocolLayer2 *_l2,IParameterHandler *_p) @@ -51,17 +53,17 @@ CommunicationHandler::run() #endif case 'M': { - parse_msg(msg,len ,IParameterHandler::TYPE_U16); + parse_msg(msg,len ,TYPE_U16); } break; case 'L': { - parse_msg(msg,len ,IParameterHandler::TYPE_U32); + parse_msg(msg,len ,TYPE_U32); } break; case 'F': { - parse_msg(msg,len ,IParameterHandler::TYPE_FLOAT); + parse_msg(msg,len ,TYPE_FLOAT); } break; default: @@ -73,7 +75,7 @@ CommunicationHandler::run() #define OUTPUT_BUFFER_SIZE 32 void -CommunicationHandler::parse_msg(const Uint8_t *_msg,const Uint8_t len,IParameterHandler::eParameterType _eType) +CommunicationHandler::parse_msg(const Uint8_t *_msg,const Uint8_t len,eParameterType _eType) { uint32_t nv = 0; uint32_t val = 0; @@ -88,7 +90,7 @@ CommunicationHandler::parse_msg(const Uint8_t *_msg,const Uint8_t len,IParameter } if ( _msg[pos] == '=' ) { - if (_eType == IParameterHandler::TYPE_FLOAT) + if (_eType == TYPE_FLOAT) { Float32_t result; result = atof((const char *)(_msg+1+pos)); @@ -104,13 +106,13 @@ CommunicationHandler::parse_msg(const Uint8_t *_msg,const Uint8_t len,IParameter { char l_OutBuffer[OUTPUT_BUFFER_SIZE]; for (Uint8_t i = 0 ; i < OUTPUT_BUFFER_SIZE; i++) l_OutBuffer[i] = '\0'; - if (_eType == IParameterHandler::TYPE_FLOAT) + if (_eType == TYPE_FLOAT) { Float32_t fval; m_Params->readValue(nv,fval); //dtostre(fval,(char *)l_OutBuffer,4,0); dtostrf(fval,8,4,(char *)l_OutBuffer); - } else if (_eType == IParameterHandler::TYPE_U32) + } else if (_eType == TYPE_U32) { m_Params->readValue(nv,val); ltoa(val,(char *)l_OutBuffer,10); diff --git a/Communication/CommunicationHandler.h b/Communication/CommunicationHandler.h index 54563cc..ebcad76 100644 --- a/Communication/CommunicationHandler.h +++ b/Communication/CommunicationHandler.h @@ -2,14 +2,14 @@ #define __COMMUNICATIONHANDLER_H__ class CommunicationHandler -/* : public ITask */ + : public ITask { public: CommunicationHandler(IProtocolLayer2 *_l2,IParameterHandler *_p); virtual void run(); private: - void parse_msg(const Uint8_t *_msg,const Uint8_t len,IParameterHandler::eParameterType _eT); + void parse_msg(const Uint8_t *_msg,const Uint8_t len,eParameterType _eT); /// void parse_num(const Uint8_t *_msg,const Uint8_t len, Uint32_t &_out); private: diff --git a/HAL/Abstract/IUart.h b/HAL/Abstract/IUart.h index f308173..1835ebf 100644 --- a/HAL/Abstract/IUart.h +++ b/HAL/Abstract/IUart.h @@ -22,8 +22,9 @@ class IUart enum Baudrate_t { BAUD_2400 = 0 ,BAUD_9600 = 1 ,BAUD_19200 = 2 + ,BAUD_33600 = 3 ,BAUD_57600 = 4 - ,BAUD_115200 = 6 + ,BAUD_115200 = 5 }; #endif diff --git a/Metadata/CMakeLists.txt b/Metadata/CMakeLists.txt index f6cb12b..dd5f5af 100644 --- a/Metadata/CMakeLists.txt +++ b/Metadata/CMakeLists.txt @@ -6,18 +6,36 @@ add_avr_library( PowerswitchParameterTable.cpp ) +set_target_properties( + avrPowerswitchParameters${MCU_TYPE_FOR_FILENAME} PROPERTIES + COMPILE_DEFINITIONS POWERSWITCH_PARAMETERS + ) add_avr_library( avrDCMotorParameters DCMotorParameterTable.cpp ) +set_target_properties( + avrDCMotorParameters${MCU_TYPE_FOR_FILENAME} PROPERTIES + COMPILE_DEFINITIONS DCMOTOR_PARAMETERS + ) + add_avr_library( avrShutterCtrlParameters ShutterCtrlParameterTable.cpp ) +set_target_properties( + avrShutterCtrlParameters${MCU_TYPE_FOR_FILENAME} PROPERTIES + COMPILE_DEFINITIONS SHUTTERCTRL_PARAMETERS + ) + add_avr_library( avrWorkMeterParameters WorkMeterParameterTable.cpp ) +set_target_properties( + avrWorkMeterParameters${MCU_TYPE_FOR_FILENAME} PROPERTIES + COMPILE_DEFINITIONS WORKMETER_PARAMETERS + ) diff --git a/Metadata/Metadata.h b/Metadata/Metadata.h index e630bec..3809bf0 100644 --- a/Metadata/Metadata.h +++ b/Metadata/Metadata.h @@ -1,6 +1,28 @@ #ifndef __METADATA_H__ #define __METADATA_H__ +enum eParameterType { + TYPE_U8 = 0 + , TYPE_U16 = 1 + , TYPE_U32 = 2 + , TYPE_I8 = 4 + , TYPE_I16 = 4 + , TYPE_I32 = 5 + , TYPE_FLOAT = 6 +}; + +enum eParameterLevel { + ALL + ,EUP = 1 + ,SUP = 2 + ,FUP = 3 +}; +enum eParameterAcess { + NONE = 0 + ,RO = 1 + ,WO = 2 + ,RW = 3 +}; /* Forward declaration */ class IParameterListener; @@ -17,5 +39,14 @@ typedef struct _ParameterValue_t Float32_t m_Float; } u; IParameterListener *m_Listener; +#if defined(WORKMETER_PARAMETERS) + union ParameterAttributes + { + uint8_t m_AllAttributes; + uint8_t m_Type:4; + uint8_t m_AccessLevel:2; + uint8_t m_AccessRight:2; + } a; +#endif } ParameterValue; #endif diff --git a/Metadata/ShutterCtrlParamIds.h b/Metadata/ShutterCtrlParamIds.h index 84a9c7d..fd03f44 100644 --- a/Metadata/ShutterCtrlParamIds.h +++ b/Metadata/ShutterCtrlParamIds.h @@ -1,5 +1,5 @@ -#ifndef __DCMOTORPARAMIDS_H__ -#define __DCMOTORPARAMIDS_H__ +#ifndef __SHUTTERCTRLPARAMIDS_H__ +#define __SHUTTERCTRLPARAMIDS_H__ /** diff --git a/Metadata/WorkMeterParameterTable.cpp b/Metadata/WorkMeterParameterTable.cpp index a2cdf6b..14bb05f 100644 --- a/Metadata/WorkMeterParameterTable.cpp +++ b/Metadata/WorkMeterParameterTable.cpp @@ -5,25 +5,29 @@ #include "WorkMeterParamIds.h" #include "ParameterTable.h" - +#if 0 + uint8_t m_Type:4; + uint8_t m_AccessLevel:2; + uint8_t m_AccessRight:2; +#endif ParameterValue m_Values[PID_MAX] = { - {0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} - ,{0,NULL} + {0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_I32<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} + ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)} }; diff --git a/Platform/CMakeLists.txt b/Platform/CMakeLists.txt index c225ef8..9a78286 100644 --- a/Platform/CMakeLists.txt +++ b/Platform/CMakeLists.txt @@ -3,7 +3,7 @@ ##################################################################### add_avr_library( avrPtf - DCMotorParameterHandler.cpp + ParameterHandler.cpp PersistentStorage.cpp ) @@ -17,12 +17,12 @@ set_target_properties( # add_avr_library( avrPS-Ptf - PowerswitchParameterHandler.cpp + ParameterHandler.cpp PersistentStorage.cpp ) set_target_properties( - avrPtf${MCU_TYPE_FOR_FILENAME} PROPERTIES + avrPS-Ptf${MCU_TYPE_FOR_FILENAME} PROPERTIES COMPILE_DEFINITIONS POWERSWITCH_PARAMETERS ) # @@ -30,12 +30,12 @@ set_target_properties( # add_avr_library( avrSC-Ptf - ShutterCtrlParameterHandler.cpp + ParameterHandler.cpp PersistentStorage.cpp ) set_target_properties( - avrPtf${MCU_TYPE_FOR_FILENAME} PROPERTIES + avrSC-Ptf${MCU_TYPE_FOR_FILENAME} PROPERTIES COMPILE_DEFINITIONS SHUTTERCTRL_PARAMETERS ) diff --git a/Platform/IParameterHandler.h b/Platform/IParameterHandler.h index f6dc391..7fe580f 100644 --- a/Platform/IParameterHandler.h +++ b/Platform/IParameterHandler.h @@ -1,6 +1,8 @@ #ifndef __IPARAMETER_HANDLER_H__ #define __IPARAMETER_HANDLER_H__ +#include "Metadata/Metadata.h" + /** * \brief interface to be implemented by * objects that need to be informed that a parameter @@ -25,12 +27,17 @@ class IParameterListener class IParameterHandler { public: +#if 0 enum eParameterType { TYPE_U8 = 0 , TYPE_U16 = 1 , TYPE_U32 = 2 - , TYPE_FLOAT = 3 + , TYPE_I8 = 4 + , TYPE_I16 = 4 + , TYPE_I32 = 5 + , TYPE_FLOAT = 6 }; +#endif public: IParameterHandler() {}; @@ -51,5 +58,11 @@ class IParameterHandler virtual void writeValue(const uint8_t paramID,const Float32_t _val) = 0; /// virtual void registerListener(const uint8_t paramID,IParameterListener *_val) = 0; + + // get Parameter ID value as string + virtual Bool_t toString(const uint8_t paramID, eParameterType _eType,Uint8_t *buffer) = 0 ; + // set Parameter ID value from string + // In case of type mismatch, return fail and don't assign the value + virtual Bool_t fromString(const uint8_t paramID, eParameterType _eType,Uint8_t *buffer) = 0 ; }; #endif diff --git a/Platform/ParameterHandler.cpp b/Platform/ParameterHandler.cpp index ab461a6..5715633 100644 --- a/Platform/ParameterHandler.cpp +++ b/Platform/ParameterHandler.cpp @@ -4,6 +4,12 @@ #ifdef POWERSWITCH_PARAMETERS #include #include +#elif defined(DCMOTOR_PARAMETERS) +#include +#include +#elif defined(SHUTTERCTRL_PARAMETERS) +#include +#include #elif defined(WORKMETER_PARAMETERS) #include #include @@ -120,3 +126,22 @@ ParameterHandler::registerListener(const uint8_t paramID,IParameterListener *_va } } + + +// get Parameter ID value as string +Bool_t ParameterHandler::toString(const uint8_t paramID + , eParameterType _eType + , Uint8_t *buffer) +{ + return true; +} +// set Parameter ID value from string +// In case of type mismatch, return fail and don't assign the value +Bool_t ParameterHandler::fromString(const uint8_t paramID + , eParameterType _eType + , Uint8_t *buffer) +{ + return true; +} + + diff --git a/Platform/ParameterHandler.h b/Platform/ParameterHandler.h index 2255498..d34b611 100644 --- a/Platform/ParameterHandler.h +++ b/Platform/ParameterHandler.h @@ -30,6 +30,15 @@ class ParameterHandler : public IParameterHandler /// virtual void registerListener(const uint8_t paramID,IParameterListener *_val); + // get Parameter ID value as string + Bool_t toString(const uint8_t paramID + , eParameterType _eType + , Uint8_t *buffer) ; + // set Parameter ID value from string + // In case of type mismatch, return fail and don't assign the value + Bool_t fromString(const uint8_t paramID + , eParameterType _eType + , Uint8_t *buffer) ; private: };