Skip to content

Commit 6edc76b

Browse files
committed
Refactor: Renames to avoid naming collisions
1 parent b388127 commit 6edc76b

File tree

3 files changed

+127
-129
lines changed

3 files changed

+127
-129
lines changed

include/QuarkTS.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Read the API reference here ; https://kmilo17pet.github.io/QuarkTS/
5656
#include "qcoroutine.h"
5757
#include "qioutils.h"
5858
#include "qtrace.h"
59+
#include "qinput.h"
5960

6061
#if ( Q_MEMORY_MANAGER == 1 )
6162
#include "qmemmang.h"

include/qinput.h

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,29 @@ extern "C" {
3838
* @brief An enum with all the possible events that can be detected by the
3939
* watcher structure for a specified input-channel.
4040
*/
41-
typedef enum qEvent_t {
42-
NONE = 0,
43-
EXCEPTION, /**< Error due a bad reading or channel configuration .*/
44-
ON_CHANGE, /**< Event on any input-channel change when crossing the thresholds*/
45-
FALLING_EDGE, /**< Event on falling-edge( high to low ) of the digital input-channel*/
46-
RISING_EDGE, /**< Event on rising-edge( low to high ) of the digital input-channel*/
47-
PULSATION_DOUBLE, /**< Event when the digital input is pulsated two times within the interval*/
48-
PULSATION_TRIPLE, /**< Event when the digital input is pulsated three times within the interval*/
49-
PULSATION_MULTI, /**< Event when the digital input is pulsated more than three times within the interval*/
50-
HIGH_THRESHOLD, /**< Event when the analog input-channel reading is above the high threshold*/
51-
LOW_THRESHOLD, /**< Event when the analog input-channel reading is below the low threshold*/
52-
IN_BAND, /**< Event when the analog input-channel reading enters the band defined by the low-high thresholds*/
53-
STEADY_IN_HIGH, /**< Event when the input-channel has been kept on high (or above the high threshold) for the specified time .*/
54-
STEADY_IN_LOW, /**< Event when the input-channel has been kept on low (or below the low threshold) for the specified time .*/
55-
STEADY_IN_BAND, /**< Event when the analog input-channel has remained within the band for the specified time .*/
56-
DELTA, /**< Event when the difference of the last and latest reading of an analog input channel is greater than the defined delta*/
57-
STEP_UP, /**< Event on step reading of the analog-input channel*/
58-
STEP_DOWN, /**< Event on step reading of the analog-input channel*/
41+
typedef enum qInput_Event_t {
42+
QINPUT_NONE = 0,
43+
QINPUT_EXCEPTION, /**< Error due a bad reading or channel configuration .*/
44+
QINPUT_ON_CHANGE, /**< Event on any input-channel change when crossing the thresholds*/
45+
QINPUT_FALLING_EDGE, /**< Event on falling-edge( high to low ) of the digital input-channel*/
46+
QINPUT_RISING_EDGE, /**< Event on rising-edge( low to high ) of the digital input-channel*/
47+
QINPUT_PULSATION_DOUBLE, /**< Event when the digital input is pulsated two times within the interval*/
48+
QINPUT_PULSATION_TRIPLE, /**< Event when the digital input is pulsated three times within the interval*/
49+
QINPUT_PULSATION_MULTI, /**< Event when the digital input is pulsated more than three times within the interval*/
50+
QINPUT_HIGH_THRESHOLD, /**< Event when the analog input-channel reading is above the high threshold*/
51+
QINPUT_LOW_THRESHOLD, /**< Event when the analog input-channel reading is below the low threshold*/
52+
QINPUT_IN_BAND, /**< Event when the analog input-channel reading enters the band defined by the low-high thresholds*/
53+
QINPUT_STEADY_IN_HIGH, /**< Event when the input-channel has been kept on high (or above the high threshold) for the specified time .*/
54+
QINPUT_STEADY_IN_LOW, /**< Event when the input-channel has been kept on low (or below the low threshold) for the specified time .*/
55+
QINPUT_STEADY_IN_BAND, /**< Event when the analog input-channel has remained within the band for the specified time .*/
56+
QINPUT_DELTA, /**< Event when the difference of the last and latest reading of an analog input channel is greater than the defined delta*/
57+
QINPUT_STEP_UP, /**< Event on step reading of the analog-input channel*/
58+
QINPUT_STEP_DOWN, /**< Event on step reading of the analog-input channel*/
5959
/*! @cond */
60-
MAX_EVENTS,
61-
STEP = STEP_UP
60+
QINPUT__MAX_EVENTS,
61+
QINPUT_STEP = QINPUT_STEP_UP
6262
/*! @endcond */
63-
} qEvent_t;
63+
} qInput_Event_t;
6464

6565
/**
6666
* @brief An enum class to define the types of input channels
@@ -108,43 +108,43 @@ typedef void (*qEventCallback_t) (qChannel_t *channel);
108108

109109

110110
/**
111-
* @brief A pointer to the wrapper function
112-
*
111+
* @brief A pointer to the wrapper function
112+
*
113113
* Prototype: @code void updateReading( qBool_t act ) @endcode
114114
*/
115115
typedef void (*qUpdateReading_t)( qBool_t );
116116

117117
/**
118-
* @brief A pointer to the wrapper function
119-
*
118+
* @brief A pointer to the wrapper function
119+
*
120120
* Prototype: @code void evaluateState() @endcode
121121
*/
122122
typedef void (*qEvaluateState_t)( void );
123123

124124

125125
/**
126-
* @brief A pointer to the wrapper function
127-
*
126+
* @brief A pointer to the wrapper function
127+
*
128128
* Prototype: @code qBool_t isValidConfig() @endcode
129129
*/
130130
typedef qBool_t (*qIsValidConfig_t)( void );
131131

132132

133133
/**
134-
* @brief A pointer to the wrapper function
135-
*
134+
* @brief A pointer to the wrapper function
135+
*
136136
* Prototype: @code void setInitalState() @endcode
137137
*/
138138
typedef void (*qSetInitalState_t)( void );
139139

140140
/**
141-
* @brief A pointer to the wrapper function
142-
*
143-
* Prototype: @code void dispatchEvent(qEvent_t e) @endcode
141+
* @brief A pointer to the wrapper function
142+
*
143+
* Prototype: @code void dispatchEvent(qInput_Event_t e) @endcode
144144
*/
145-
typedef void (*qDispatchEvent_t)( qEvent_t );
145+
typedef void (*qDispatchEvent_t)( qInput_Event_t );
146146

147-
/* inline void dispatchEvent( qEvent_t )
147+
/* inline void dispatchEvent( qInput_Event_t )
148148
{
149149
lastEvent = e; --> event = e
150150
callback( *this ); --> callback = dispatchEvent
@@ -161,9 +161,9 @@ typedef qType_t (*qGetType_t)( void );
161161
/**
162162
* @brief Retrieves the last event for the given input channel.
163163
* @return @c The last input-channel event.
164-
* Prototype: @code qEvent_t getEvent( void ) @endcode
164+
* Prototype: @code qInput_Event_t getEvent( void ) @endcode
165165
*/
166-
typedef qEvent_t (*qGetEvent_t)( void );
166+
typedef qInput_Event_t (*qGetEvent_t)( void );
167167

168168

169169
/**
@@ -219,12 +219,12 @@ typedef qBool_t (*qIsShared_t)( void );
219219
* @param[in] e The event where the timeout will be set.
220220
* @param[in] t The value of the timeout.
221221
* @return @c true on success. Otherwise @c false.
222-
* Prototype:
223-
* @code
224-
* qBool_t setTime( const qEvent_t e, const qClock_t t)
222+
* Prototype:
223+
* @code
224+
* qBool_t setTime( const qInput_Event_t e, const qClock_t t)
225225
* @endcode
226226
*/
227-
typedef qBool_t (*qSetTime_t)( const qEvent_t , const qClock_t );
227+
typedef qBool_t (*qSetTime_t)( const qInput_Event_t , const qClock_t );
228228

229229

230230
/**
@@ -234,10 +234,10 @@ typedef qBool_t (*qSetTime_t)( const qEvent_t , const qClock_t );
234234
* @return @c true on success. Otherwise @c false.
235235
* Prototype:
236236
* @code
237-
* qBool_t setParameter( const qEvent_t e, const qAnalogValue_t p )
237+
* qBool_t setParameter( const qInput_Event_t e, const qAnalogValue_t p )
238238
* @endcode
239239
*/
240-
typedef qBool_t (*qSetParameter_t)( const qEvent_t e, const qAnalogValue_t p);
240+
typedef qBool_t (*qSetParameter_t)( const qInput_Event_t e, const qAnalogValue_t p);
241241

242242
/**
243243
* @brief Get pulsation count for the digital input.
@@ -269,7 +269,7 @@ typedef qBool_t (*qUnShare_t)( void );
269269

270270
typedef struct qChannel_t {
271271
qList_Node_t node;
272-
qEvent_t lastEvent;
272+
qInput_Event_t lastEvent;
273273
uint8_t number;
274274
void *userData;
275275

@@ -299,14 +299,13 @@ typedef struct qChannel_t {
299299
qClock_t tChange; //0U
300300
qClock_t tSteadyHigh; // 0xFFFFFFFFU ;
301301
qClock_t tSteadyLow; // 0xFFFFFFFFU ;
302-
303302
} qChannel_t;
304303

305304

306305
#define NULL_CHANNELS_INITIALIZATION \
307306
{\
308307
NULL, NULL, NULL, \
309-
NONE, 0, NULL, \
308+
QINPUT_NONE, 0, NULL, \
310309
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
311310
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\
312311
0U, 0xFFFFFFFFU, 0xFFFFFFFFU \
@@ -316,7 +315,7 @@ typedef struct qChannel_t {
316315

317316
typedef struct _qDigitalChannel_t {
318317
qChannel_t channel;
319-
318+
320319
qDigitalValue_t value;
321320
qDigitalValue_t *ptrValue;
322321
qDigitalReaderFcn_t reader;
@@ -329,7 +328,6 @@ typedef struct _qDigitalChannel_t {
329328
void (*risingEdgeStateFcn)( struct _qDigitalChannel_t * );
330329
void (*steadyInHighStateFcn)( struct _qDigitalChannel_t * );
331330
void (*steadyInLowStateFcn)( struct _qDigitalChannel_t * );
332-
333331
} qDigitalChannel_t;
334332

335333
#define NULL_DIGITAL_CHANNELS_INITIALIZATION \
@@ -341,19 +339,19 @@ typedef struct _qDigitalChannel_t {
341339

342340
typedef struct _qAnalogChannel_t {
343341
qChannel_t channel;
344-
342+
345343
qAnalogValue_t value;
346344
qAnalogValue_t *ptrValue;
347345
qAnalogReaderFcn_t reader;
348346
void (*channelStateFcn)(struct _qAnalogChannel_t *);
349-
qAnalogValue_t high; // 800U
350-
qAnalogValue_t low; //200U
351-
qAnalogValue_t lastStep; //0
352-
qAnalogValue_t lastSampled; //0
353-
qAnalogValue_t delta; //0xFFFFFFFFU
354-
qAnalogValue_t step; //0xFFFFFFFFU
355-
qAnalogValue_t hysteresis; //20U
356-
qClock_t tSteadyBand; //0xFFFFFFFFU
347+
qAnalogValue_t high;
348+
qAnalogValue_t low;
349+
qAnalogValue_t lastStep;
350+
qAnalogValue_t lastSampled;
351+
qAnalogValue_t delta;
352+
qAnalogValue_t step;
353+
qAnalogValue_t hysteresis;
354+
qClock_t tSteadyBand;
357355

358356
void (*lowThresholdStateFcn)( struct _qAnalogChannel_t * );
359357
void (*highThresholdStateFcn)( struct _qAnalogChannel_t * );
@@ -432,7 +430,6 @@ typedef struct _qWatcher_t {
432430
addCallbackDiFcn_t addCallbackDigital;
433431
addCallbackAnFcn_t addCallbackAnalog;
434432
removeFcn_t remove;
435-
436433
} qWatcher_t;
437434

438435

0 commit comments

Comments
 (0)