Skip to content

Commit e7acdc4

Browse files
committed
rtos: fix astyle
1 parent 140f3e2 commit e7acdc4

File tree

10 files changed

+88
-56
lines changed

10 files changed

+88
-56
lines changed

rtos/EventFlags.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ namespace rtos {
3636
* \defgroup rtos_EventFlags EventFlags class
3737
* @{
3838
*/
39-
39+
4040
/** The EventFlags class is used to control event flags or wait for event flags other threads control.
4141
42-
@note
42+
@note
4343
EventFlags support 31 flags. The MSB flag is ignored. It is used to return an error code (@a osFlagsError).
4444
4545
@note

rtos/Mail.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace rtos {
4242
* \defgroup rtos_Mail Mail class
4343
* @{
4444
*/
45-
45+
4646
/** The Mail class allow to control, send, receive, or wait for mail.
4747
A mail is a memory block that is send to a thread or interrupt service routine.
4848
@tparam T data type of a single message element.
@@ -67,7 +67,8 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
6767
*
6868
* @note You may call this function from ISR context.
6969
*/
70-
bool empty() const {
70+
bool empty() const
71+
{
7172
return _queue.empty();
7273
}
7374

@@ -77,7 +78,8 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
7778
*
7879
* @note You may call this function from ISR context.
7980
*/
80-
bool full() const {
81+
bool full() const
82+
{
8183
return _queue.full();
8284
}
8385

@@ -87,7 +89,8 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
8789
8890
@note You may call this function from ISR context if the millisec parameter is set to 0.
8991
*/
90-
T* alloc(uint32_t millisec=0) {
92+
T *alloc(uint32_t millisec = 0)
93+
{
9194
return _pool.alloc();
9295
}
9396

@@ -97,7 +100,8 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
97100
98101
@note You may call this function from ISR context if the millisec parameter is set to 0.
99102
*/
100-
T* calloc(uint32_t millisec=0) {
103+
T *calloc(uint32_t millisec = 0)
104+
{
101105
return _pool.calloc();
102106
}
103107

@@ -107,7 +111,8 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
107111
108112
@note You may call this function from ISR context.
109113
*/
110-
osStatus put(T *mptr) {
114+
osStatus put(T *mptr)
115+
{
111116
return _queue.put(mptr);
112117
}
113118

@@ -117,7 +122,8 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
117122
118123
@note You may call this function from ISR context if the millisec parameter is set to 0.
119124
*/
120-
osEvent get(uint32_t millisec=osWaitForever) {
125+
osEvent get(uint32_t millisec = osWaitForever)
126+
{
121127
osEvent evt = _queue.get(millisec);
122128
if (evt.status == osEventMessage) {
123129
evt.status = osEventMail;
@@ -131,7 +137,8 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
131137
132138
@note You may call this function from ISR context.
133139
*/
134-
osStatus free(T *mptr) {
140+
osStatus free(T *mptr)
141+
{
135142
return _pool.free(mptr);
136143
}
137144

rtos/MemoryPool.h

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace rtos {
3737
* \defgroup rtos_MemoryPool MemoryPool class
3838
* @{
3939
*/
40-
40+
4141
/** Define and manage fixed-size memory pools of objects of a given type.
4242
@tparam T data type of a single object (element).
4343
@tparam queue_sz maximum number of objects (elements) in the memory pool.
@@ -48,13 +48,14 @@ namespace rtos {
4848
*/
4949
template<typename T, uint32_t pool_sz>
5050
class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
51-
MBED_STATIC_ASSERT(pool_sz > 0, "Invalid memory pool size. Must be greater than 0.");
51+
MBED_STATIC_ASSERT(pool_sz > 0, "Invalid memory pool size. Must be greater than 0.");
5252
public:
5353
/** Create and Initialize a memory pool.
5454
*
5555
* @note You cannot call this function from ISR context.
5656
*/
57-
MemoryPool() {
57+
MemoryPool()
58+
{
5859
memset(_pool_mem, 0, sizeof(_pool_mem));
5960
memset(&_obj_mem, 0, sizeof(_obj_mem));
6061
osMemoryPoolAttr_t attr = { 0 };
@@ -70,7 +71,8 @@ class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
7071
*
7172
* @note You cannot call this function from ISR context.
7273
*/
73-
~MemoryPool() {
74+
~MemoryPool()
75+
{
7476
osMemoryPoolDelete(_id);
7577
}
7678

@@ -79,17 +81,19 @@ class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
7981
8082
@note You may call this function from ISR context.
8183
*/
82-
T* alloc(void) {
83-
return (T*)osMemoryPoolAlloc(_id, 0);
84+
T *alloc(void)
85+
{
86+
return (T *)osMemoryPoolAlloc(_id, 0);
8487
}
8588

8689
/** Allocate a memory block of type T from a memory pool and set memory block to zero.
8790
@return address of the allocated memory block or NULL in case of no memory available.
8891
8992
@note You may call this function from ISR context.
9093
*/
91-
T* calloc(void) {
92-
T *item = (T*)osMemoryPoolAlloc(_id, 0);
94+
T *calloc(void)
95+
{
96+
T *item = (T *)osMemoryPoolAlloc(_id, 0);
9397
if (item != NULL) {
9498
memset(item, 0, sizeof(T));
9599
}
@@ -104,8 +108,9 @@ class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
104108
105109
@note You may call this function from ISR context.
106110
*/
107-
osStatus free(T *block) {
108-
return osMemoryPoolFree(_id, (void*)block);
111+
osStatus free(T *block)
112+
{
113+
return osMemoryPoolFree(_id, (void *)block);
109114
}
110115

111116
private:

rtos/Mutex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ typedef mbed::ScopedLock<Mutex> ScopedMutexLock;
5252
* \defgroup rtos_Mutex Mutex class
5353
* @{
5454
*/
55-
55+
5656
/** The Mutex class is used to synchronize the execution of threads.
5757
This is, for example, used to protect access to a shared resource.
5858

rtos/Queue.h

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace rtos {
3838
* \defgroup rtos_Queue Queue class
3939
* @{
4040
*/
41-
41+
4242
/** The Queue class allow to control, send, receive, or wait for messages.
4343
A message can be a integer or pointer value to a certain type T that is send
4444
to a thread or interrupt service routine.
@@ -56,21 +56,23 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
5656
*
5757
* @note You cannot call this function from ISR context.
5858
*/
59-
Queue() {
59+
Queue()
60+
{
6061
memset(&_obj_mem, 0, sizeof(_obj_mem));
6162
osMessageQueueAttr_t attr = { 0 };
6263
attr.mq_mem = _queue_mem;
6364
attr.mq_size = sizeof(_queue_mem);
6465
attr.cb_mem = &_obj_mem;
6566
attr.cb_size = sizeof(_obj_mem);
66-
_id = osMessageQueueNew(queue_sz, sizeof(T*), &attr);
67+
_id = osMessageQueueNew(queue_sz, sizeof(T *), &attr);
6768
MBED_ASSERT(_id);
6869
}
6970
/** Queue destructor
7071
*
7172
* @note You cannot call this function from ISR context.
7273
*/
73-
~Queue() {
74+
~Queue()
75+
{
7476
osMessageQueueDelete(_id);
7577
}
7678

@@ -80,7 +82,8 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
8082
*
8183
* @note You may call this function from ISR context.
8284
*/
83-
bool empty() const {
85+
bool empty() const
86+
{
8487
return osMessageQueueGetCount(_id) == 0;
8588
}
8689

@@ -90,7 +93,8 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
9093
*
9194
* @note You may call this function from ISR context.
9295
*/
93-
bool full() const {
96+
bool full() const
97+
{
9498
return osMessageQueueGetSpace(_id) == 0;
9599
}
96100

@@ -106,7 +110,8 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
106110
107111
@note You may call this function from ISR context if the millisec parameter is set to 0.
108112
*/
109-
osStatus put(T* data, uint32_t millisec=0, uint8_t prio=0) {
113+
osStatus put(T *data, uint32_t millisec = 0, uint8_t prio = 0)
114+
{
110115
return osMessageQueuePut(_id, &data, prio, millisec);
111116
}
112117

@@ -121,7 +126,8 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
121126
122127
@note You may call this function from ISR context if the millisec parameter is set to 0.
123128
*/
124-
osEvent get(uint32_t millisec=osWaitForever) {
129+
osEvent get(uint32_t millisec = osWaitForever)
130+
{
125131
osEvent event;
126132
T *data = NULL;
127133
osStatus_t res = osMessageQueueGet(_id, &data, NULL, millisec);
@@ -149,7 +155,7 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
149155

150156
private:
151157
osMessageQueueId_t _id;
152-
char _queue_mem[queue_sz * (sizeof(T*) + sizeof(mbed_rtos_storage_message_t))];
158+
char _queue_mem[queue_sz * (sizeof(T *) + sizeof(mbed_rtos_storage_message_t))];
153159
mbed_rtos_storage_msg_queue_t _obj_mem;
154160
};
155161
/** @}*/

rtos/RtosTimer.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828

2929
namespace rtos {
3030

31-
void RtosTimer::constructor(mbed::Callback<void()> func, os_timer_type type) {
31+
void RtosTimer::constructor(mbed::Callback<void()> func, os_timer_type type)
32+
{
3233
_function = func;
3334
memset(&_obj_mem, 0, sizeof(_obj_mem));
3435
osTimerAttr_t attr = { 0 };
@@ -38,15 +39,18 @@ void RtosTimer::constructor(mbed::Callback<void()> func, os_timer_type type) {
3839
MBED_ASSERT(_id);
3940
}
4041

41-
osStatus RtosTimer::start(uint32_t millisec) {
42+
osStatus RtosTimer::start(uint32_t millisec)
43+
{
4244
return osTimerStart(_id, millisec);
4345
}
4446

45-
osStatus RtosTimer::stop(void) {
47+
osStatus RtosTimer::stop(void)
48+
{
4649
return osTimerStop(_id);
4750
}
4851

49-
RtosTimer::~RtosTimer() {
52+
RtosTimer::~RtosTimer()
53+
{
5054
osTimerDelete(_id);
5155
}
5256

rtos/RtosTimer.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace rtos {
3737
* \defgroup rtos_RtosTimer RtosTimer class
3838
* @{
3939
*/
40-
40+
4141
/** The RtosTimer class allow creating and and controlling of timer functions in the system.
4242
A timer function is called when a time period expires whereby both on-shot and
4343
periodic timers are possible. A timer can be started, restarted, or stopped.
@@ -97,13 +97,14 @@ class RtosTimer : private mbed::NonCopyable<RtosTimer> {
9797
@note You cannot call this function from ISR context.
9898
*/
9999
MBED_DEPRECATED_SINCE("mbed-os-5.1",
100-
"Replaced with RtosTimer(Callback<void()>, os_timer_type)")
100+
"Replaced with RtosTimer(Callback<void()>, os_timer_type)")
101101
MBED_DEPRECATED_SINCE("mbed-os-5.2",
102-
"The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details")
103-
RtosTimer(void (*func)(void const *argument), os_timer_type type=osTimerPeriodic, void *argument=NULL) {
102+
"The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details")
103+
RtosTimer(void (*func)(void const *argument), os_timer_type type = osTimerPeriodic, void *argument = NULL)
104+
{
104105
constructor(mbed::callback((void (*)(void *))func, argument), type);
105106
}
106-
107+
107108
/** Create timer.
108109
@param func function to be executed by this timer.
109110
@param type osTimerOnce for one-shot or osTimerPeriodic for periodic behaviour. (default: osTimerPeriodic)
@@ -113,11 +114,12 @@ class RtosTimer : private mbed::NonCopyable<RtosTimer> {
113114
@note You cannot call this function from ISR context.
114115
*/
115116
MBED_DEPRECATED_SINCE("mbed-os-5.2",
116-
"The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details")
117-
RtosTimer(mbed::Callback<void()> func, os_timer_type type=osTimerPeriodic) {
117+
"The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details")
118+
RtosTimer(mbed::Callback<void()> func, os_timer_type type = osTimerPeriodic)
119+
{
118120
constructor(func, type);
119121
}
120-
122+
121123
/** Create timer.
122124
@param obj pointer to the object to call the member function on.
123125
@param method member function to be executed by this timer.
@@ -132,11 +134,12 @@ class RtosTimer : private mbed::NonCopyable<RtosTimer> {
132134
*/
133135
template <typename T, typename M>
134136
MBED_DEPRECATED_SINCE("mbed-os-5.1",
135-
"The RtosTimer constructor does not support cv-qualifiers. Replaced by "
136-
"RtosTimer(callback(obj, method), os_timer_type).")
137+
"The RtosTimer constructor does not support cv-qualifiers. Replaced by "
138+
"RtosTimer(callback(obj, method), os_timer_type).")
137139
MBED_DEPRECATED_SINCE("mbed-os-5.2",
138-
"The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details")
139-
RtosTimer(T *obj, M method, os_timer_type type=osTimerPeriodic) {
140+
"The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details")
141+
RtosTimer(T *obj, M method, os_timer_type type = osTimerPeriodic)
142+
{
140143
constructor(mbed::callback(obj, method), type);
141144
}
142145

0 commit comments

Comments
 (0)