Coding style updated/fixed
Indentations of class definitions and preprocessor statements were not uniform throughout the code. This commit cleans up indentations as well as the order of include statements. Style conventions see: https://github.com/LibreSolar/coding-style
This commit is contained in:
+23
-12
@@ -6,55 +6,66 @@
|
||||
|
||||
#if defined(__MBED__) && !defined(UNIT_TEST)
|
||||
|
||||
#include "ext/can_msg_queue.h"
|
||||
|
||||
#include "mbed.h"
|
||||
|
||||
#ifdef STM32F0 // STM32L0 does not have CAN
|
||||
|
||||
#include "can_msg_queue.h"
|
||||
|
||||
bool CANMsgQueue::full() {
|
||||
bool CANMsgQueue::full()
|
||||
{
|
||||
return _length == CAN_QUEUE_SIZE;
|
||||
}
|
||||
|
||||
bool CANMsgQueue::empty() {
|
||||
bool CANMsgQueue::empty()
|
||||
{
|
||||
return _length == 0;
|
||||
}
|
||||
|
||||
void CANMsgQueue::enqueue(CANMessage msg) {
|
||||
void CANMsgQueue::enqueue(CANMessage msg)
|
||||
{
|
||||
if (!full()) {
|
||||
_queue[(_first + _length) % CAN_QUEUE_SIZE] = msg;
|
||||
_length++;
|
||||
}
|
||||
}
|
||||
|
||||
int CANMsgQueue::dequeue() {
|
||||
int CANMsgQueue::dequeue()
|
||||
{
|
||||
if (!empty()) {
|
||||
_first = (_first + 1) % CAN_QUEUE_SIZE;
|
||||
_length--;
|
||||
return 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int CANMsgQueue::dequeue(CANMessage& msg) {
|
||||
int CANMsgQueue::dequeue(CANMessage& msg)
|
||||
{
|
||||
if (!empty()) {
|
||||
msg = _queue[_first];
|
||||
_first = (_first + 1) % CAN_QUEUE_SIZE;
|
||||
_length--;
|
||||
return 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int CANMsgQueue::first(CANMessage& msg) {
|
||||
int CANMsgQueue::first(CANMessage& msg)
|
||||
{
|
||||
if (!empty()) {
|
||||
msg = _queue[_first];
|
||||
return 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* STM32F0 */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user