Skip to content

Commit

Permalink
[rtos] Update processing module for a:FreeRTOS
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Apr 26, 2019
1 parent 5ca7270 commit 578b9e2
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/modm/processing/rtos/freertos/mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ modm::rtos::Mutex::~Mutex()

// ----------------------------------------------------------------------------
bool
modm::rtos::Mutex::acquire(portTickType timeout)
modm::rtos::Mutex::acquire(TickType_t timeout)
{
return (xSemaphoreTake(this->handle, timeout) == pdTRUE);
}
Expand Down
4 changes: 2 additions & 2 deletions src/modm/processing/rtos/freertos/mutex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace modm
~Mutex();

bool
acquire(portTickType timeout = portMAX_DELAY);
acquire(TickType_t timeout = portMAX_DELAY);

void
release();
Expand All @@ -55,7 +55,7 @@ namespace modm
Mutex&
operator = (const Mutex& other);

xSemaphoreHandle handle;
SemaphoreHandle_t handle;
};

/**
Expand Down
8 changes: 4 additions & 4 deletions src/modm/processing/rtos/freertos/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ modm::rtos::QueueBase::~QueueBase()

// ----------------------------------------------------------------------------
bool
modm::rtos::QueueBase::append(const void *item, portTickType timeout)
modm::rtos::QueueBase::append(const void *item, TickType_t timeout)
{
return (xQueueSendToBack(this->handle, item, timeout) == pdTRUE);
}

bool
modm::rtos::QueueBase::prepend(const void *item, portTickType timeout)
modm::rtos::QueueBase::prepend(const void *item, TickType_t timeout)
{
return (xQueueSendToFront(this->handle, item, timeout) == pdTRUE);
}

bool
modm::rtos::QueueBase::peek(void *item, portTickType timeout) const
modm::rtos::QueueBase::peek(void *item, TickType_t timeout) const
{
return (xQueuePeek(this->handle, item, timeout) == pdTRUE);
}

bool
modm::rtos::QueueBase::get(void *item, portTickType timeout)
modm::rtos::QueueBase::get(void *item, TickType_t timeout)
{
return (xQueueReceive(this->handle, item, timeout) == pdTRUE);
}
Expand Down
18 changes: 9 additions & 9 deletions src/modm/processing/rtos/freertos/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ namespace modm
* routine. Use appendFromInterrupt() for this purpose.
*/
bool
append(const void *item, portTickType timeout = portMAX_DELAY);
append(const void *item, TickType_t timeout = portMAX_DELAY);

bool
prepend(const void *item, portTickType timeout = portMAX_DELAY);
prepend(const void *item, TickType_t timeout = portMAX_DELAY);

bool
peek(void *item, portTickType timeout = portMAX_DELAY) const;
peek(void *item, TickType_t timeout = portMAX_DELAY) const;

bool
get(void *item, portTickType timeout = portMAX_DELAY);
get(void *item, TickType_t timeout = portMAX_DELAY);

bool
appendFromInterrupt(const void *item);
Expand All @@ -76,7 +76,7 @@ namespace modm
getFromInterrupt(void *item);

protected:
xQueueHandle handle;
QueueHandle_t handle;

private:
// disable copy constructor
Expand Down Expand Up @@ -105,25 +105,25 @@ namespace modm
using QueueBase::getSize;

inline bool
append(const T& item, portTickType timeout = portMAX_DELAY)
append(const T& item, TickType_t timeout = portMAX_DELAY)
{
return QueueBase::append(&item, timeout);
}

inline bool
prepend(const T& item, portTickType timeout = portMAX_DELAY)
prepend(const T& item, TickType_t timeout = portMAX_DELAY)
{
return QueueBase::prepend(&item, timeout);
}

inline bool
peek(T& item, portTickType timeout = portMAX_DELAY)
peek(T& item, TickType_t timeout = portMAX_DELAY)
{
return QueueBase::peek(&item, timeout);
}

inline bool
get(T& item, portTickType timeout = portMAX_DELAY)
get(T& item, TickType_t timeout = portMAX_DELAY)
{
return QueueBase::get(&item, timeout);
}
Expand Down
2 changes: 1 addition & 1 deletion src/modm/processing/rtos/freertos/scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace modm
}

/// The count of ticks since Scheduler::schedule() was called
static inline portTickType
static inline TickType_t
getTicks()
{
return xTaskGetTickCount();
Expand Down
2 changes: 1 addition & 1 deletion src/modm/processing/rtos/freertos/semaphore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ modm::rtos::SemaphoreBase::~SemaphoreBase()

// ----------------------------------------------------------------------------
bool
modm::rtos::SemaphoreBase::acquire(portTickType timeout)
modm::rtos::SemaphoreBase::acquire(TickType_t timeout)
{

return (xSemaphoreTake(this->handle, timeout) == pdTRUE);
Expand Down
4 changes: 2 additions & 2 deletions src/modm/processing/rtos/freertos/semaphore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace modm
* 'take' or 'wait' in other implementations.
*/
bool
acquire(portTickType timeout = portMAX_DELAY);
acquire(TickType_t timeout = portMAX_DELAY);

/**
* \brief Release the semaphore
Expand All @@ -61,7 +61,7 @@ namespace modm
{
}

xSemaphoreHandle handle;
SemaphoreHandle_t handle;

private:
// disable copy constructor
Expand Down
2 changes: 1 addition & 1 deletion src/modm/processing/rtos/freertos/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ modm::rtos::Thread::Thread(uint32_t priority,
{
xTaskCreate(
&wrapper,
(const signed char*) name,
name ? name : "anon",
(stackDepth / 4) + 1,
this,
priority,
Expand Down
12 changes: 6 additions & 6 deletions src/modm/processing/rtos/freertos/thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
* \ingroup modm_processing_rtos
*/
#define TIME_LOOP(frequency) \
for(portTickType lastTime = xTaskGetTickCount() ; \
for(TickType_t lastTime = xTaskGetTickCount() ; \
vTaskDelayUntil(&lastTime, \
static_cast<portTickType>(frequency)), true ; \
static_cast<TickType_t>(frequency)), true ; \
)

/**
Expand All @@ -61,7 +61,7 @@
*
* For non constant value use the following formula:
* \code
* static_cast<portTickType>((time * configTICK_RATE_HZ) / 1000)
* static_cast<TickType_t>((time * configTICK_RATE_HZ) / 1000)
* \endcode
* The parentheses are important because otherwise the division might be done
* first which will lead to wrong results.
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace modm
*/
Thread(uint32_t priority = 0,
uint16_t stackDepth = minimalStackSize,
const char* name = NULL);
const char* name = nullptr);

/// Delete the thread
virtual ~Thread();
Expand Down Expand Up @@ -182,7 +182,7 @@ namespace modm
* \see MILLISECONDS
*/
static inline void
sleep(portTickType ticks)
sleep(TickType_t ticks)
{
vTaskDelay(ticks);
}
Expand Down Expand Up @@ -220,7 +220,7 @@ namespace modm
Thread&
operator = (const Thread& other);

xTaskHandle handle;
TaskHandle_t handle;
};
}
}
Expand Down

0 comments on commit 578b9e2

Please sign in to comment.