@@ -93,7 +93,8 @@ namespace qOS {
9393 list coreLists[ Q_PRIORITY_LEVELS + 2 ]; // skipcq: CXX-W2066
9494 list& waitingList; // skipcq: CXX-W2012, CXX-W2010
9595 list& suspendedList; // skipcq: CXX-W2012, CXX-W2010
96- list inputWatchers;
96+ // list inputWatchers;
97+ void (*cpuIdle)(void ){ nullptr };
9798 static const priority_t MAX_PRIORITY_VALUE;
9899 static const uint32_t BIT_INIT;
99100 static const uint32_t BIT_FCALL_IDLE;
@@ -104,8 +105,7 @@ namespace qOS {
104105 void dispatchTaskFillEventInfo ( task *Task ) noexcept ;
105106 void dispatch ( list * const xList ) noexcept ;
106107 void dispatchIdle ( void ) noexcept ;
107- void handleInputWatchers ( void ) noexcept ;
108- core () : waitingList( coreLists[ Q_PRIORITY_LEVELS ] ), suspendedList( coreLists[ Q_PRIORITY_LEVELS + 1 ] ) {}
108+ core () noexcept : waitingList( coreLists[ Q_PRIORITY_LEVELS ] ), suspendedList( coreLists[ Q_PRIORITY_LEVELS + 1 ] ) {}
109109 core ( core &other ) = delete ;
110110 void operator =( const core & ) = delete ;
111111 public:
@@ -131,6 +131,8 @@ namespace qOS {
131131 * @param[in] callbackIdle Callback function to the Idle Task. To
132132 * disable the Idle-Task activities, ignore this parameter of pass
133133 * @c nullptr as argument.
134+ * @param[in] coreIdleFcn The function that sets the CPU into
135+ * low-power or idle state
134136 * @return @c true on success. Otherwise return @c false.
135137 *
136138 * Example : When tick is already provided
@@ -165,7 +167,7 @@ namespace qOS {
165167 * }
166168 * @endcode
167169 */
168- bool init ( const getTickFcn_t tFcn = nullptr , taskFcn_t callbackIdle = nullptr ) noexcept ;
170+ bool init ( const getTickFcn_t tFcn = nullptr , taskFcn_t callbackIdle = nullptr , void (*coreIdleFcn)( void ) = nullptr ) noexcept ;
169171 /* *
170172 * @brief Add a task to the scheduling scheme. The task is scheduled to run
171173 * every @a t time units, @a n times and executing @a callback method on
@@ -262,6 +264,15 @@ namespace qOS {
262264 bool add ( task &Task, commandLineInterface &cli, const priority_t p, void *arg = nullptr ) noexcept ;
263265 /* * @}*/
264266 #endif
267+
268+ /* *
269+ * @brief Add an input-watcher so that its function is executed by
270+ * the kernel
271+ * @note The input-watcher is considered as an always-active task
272+ * @param[in] w The input watcher.
273+ * @return Returns @c true if success, otherwise returns @c false.
274+ */
275+ bool add ( task &Task, input::watcher &w, const priority_t p = HIGHEST_PRIORITY, const taskState s = taskState::ENABLED_STATE, void *arg = nullptr ) noexcept ;
265276 /* *
266277 * @brief Set/Change the callback for the Idle-task
267278 * @param[in] callback A pointer to a void callback method with a qOS::event_t
@@ -277,6 +288,13 @@ namespace qOS {
277288 */
278289 bool setNameIdleTask ( const char *tName ) noexcept ;
279290 /* *
291+ * @brief Set the function that puts the CPU into a low-power or
292+ * idle state until an interrupt occurs.
293+ * @param[in] pFcn The function to put the CPU into low-power or idle-state
294+ * @return @c true on success. Otherwise return @c false.
295+ */
296+ bool setCoreIdleFcn ( void (*pFcn)(void ) ) noexcept ;
297+ /* *
280298 * @brief Disables the kernel scheduling. The main thread will continue
281299 * after the core::run() call.
282300 */
@@ -438,21 +456,6 @@ namespace qOS {
438456 */
439457 globalState getGlobalState ( task &Task ) const noexcept ;
440458 /* *
441- * @brief Add an input-watcher so that its function is executed by
442- * the kernel
443- * @note The input-watcher is considered as an always-active task
444- * @param[in] w The input watcher.
445- * @return Returns @c true if success, otherwise returns @c false.
446- */
447- bool add ( input::watcher &w ) noexcept ;
448- /* *
449- * @brief Remove an input-watcher so that the kernel stops executing
450- * its function
451- * @param[in] w The input-watcher.
452- * @return Returns @c true if success, otherwise returns @c false.
453- */
454- bool remove ( input::watcher &w ) noexcept ;
455- /* *
456459 * @brief Check if the OS instance has been initialized.
457460 * @return @c true if OS instance has been initialized
458461 */
0 commit comments