Remove anonymous structures

This commit is contained in:
Stefano Calabretti
2022-03-07 00:45:51 +01:00
parent e764a9ba12
commit b1ec65b27f
7 changed files with 11 additions and 14 deletions
+3 -3
View File
@@ -46,7 +46,7 @@ typedef uint32_t (*MmrCanTickProvider)();
typedef uint8_t CanRxBuffer[MMR_CAN_MAX_DATA_LENGTH]; typedef uint8_t CanRxBuffer[MMR_CAN_MAX_DATA_LENGTH];
typedef struct { typedef struct MmrCanFilterSettings {
bool enabled; bool enabled;
/** /**
@@ -113,7 +113,7 @@ typedef struct {
* // 'p' has been sent. * // 'p' has been sent.
* } * }
*/ */
typedef struct { typedef struct MmrCanPacket {
MmrCanHeader header; MmrCanHeader header;
uint8_t *data; uint8_t *data;
uint8_t length; uint8_t length;
@@ -154,7 +154,7 @@ typedef struct {
* // be used. * // be used.
* } * }
*/ */
typedef struct { typedef struct MmrCanMessage {
MmrCanHeader header; MmrCanHeader header;
void *store; void *store;
} MmrCanMessage; } MmrCanMessage;
+1 -1
View File
@@ -17,7 +17,7 @@
typedef void (*MmrCanEventHandler)(const MmrCanMessage *event); typedef void (*MmrCanEventHandler)(const MmrCanMessage *event);
typedef struct { typedef struct MmrCanEventList {
const MmrCanEventHandler *handlers; const MmrCanEventHandler *handlers;
const size_t count; const size_t count;
} MmrCanEventList; } MmrCanEventList;
+3 -3
View File
@@ -27,7 +27,7 @@
* *
* Constants with lower values have an higher priority. * Constants with lower values have an higher priority.
*/ */
typedef enum { typedef enum MmrCanMessageType {
MMR_CAN_MESSAGE_TYPE_SCS = B_(0000), MMR_CAN_MESSAGE_TYPE_SCS = B_(0000),
MMR_CAN_MESSAGE_TYPE_ACK = B_(0001), MMR_CAN_MESSAGE_TYPE_ACK = B_(0001),
MMR_CAN_MESSAGE_TYPE_MULTI_FRAME = B_(0010), MMR_CAN_MESSAGE_TYPE_MULTI_FRAME = B_(0010),
@@ -36,7 +36,7 @@ typedef enum {
} MmrCanMessageType; } MmrCanMessageType;
typedef enum { typedef enum MmrCanMessagePriority {
MMR_CAN_MESSAGE_PRIORITY_LOW = B_(0010), MMR_CAN_MESSAGE_PRIORITY_LOW = B_(0010),
MMR_CAN_MESSAGE_PRIORITY_NORMAL = B_(0001), MMR_CAN_MESSAGE_PRIORITY_NORMAL = B_(0001),
MMR_CAN_MESSAGE_PRIORITY_HIGH = B_(0000), MMR_CAN_MESSAGE_PRIORITY_HIGH = B_(0000),
@@ -48,7 +48,7 @@ typedef enum {
* This struct encodes the values stored inside the * This struct encodes the values stored inside the
* extended id field of a CAN packet. * extended id field of a CAN packet.
*/ */
typedef struct { typedef struct MmrCanHeader {
MmrCanMessagePriority priority : 3; MmrCanMessagePriority priority : 3;
uint16_t messageId : 10; uint16_t messageId : 10;
uint16_t senderId : 10; uint16_t senderId : 10;
-3
View File
@@ -11,11 +11,8 @@
#ifndef INC_MMR_CAN_INCLUDES_H_ #ifndef INC_MMR_CAN_INCLUDES_H_
#define INC_MMR_CAN_INCLUDES_H_ #define INC_MMR_CAN_INCLUDES_H_
#include "stm32f3xx_hal.h"
#ifndef CAN #ifndef CAN
#define CAN #define CAN
#endif #endif
#endif /* INC_MMR_CAN_INCLUDES_H_ */ #endif /* INC_MMR_CAN_INCLUDES_H_ */
+1 -1
View File
@@ -34,7 +34,7 @@
*/ */
typedef enum MmrCanMessageId MmrCanMessageId; typedef enum MmrCanMessageId MmrCanMessageId;
typedef enum { typedef enum MmrCanMessageIdType {
MMR_CAN_MESSAGE_ID_TYPE_SCS = 0, MMR_CAN_MESSAGE_ID_TYPE_SCS = 0,
MMR_CAN_MESSAGE_ID_TYPE_DRIVE = 1, MMR_CAN_MESSAGE_ID_TYPE_DRIVE = 1,
} MmrCanMessageIdType; } MmrCanMessageIdType;
+2 -2
View File
@@ -44,7 +44,7 @@ typedef uint32_t TimerRange;
* Represents the base-struct to manage a single RTR * Represents the base-struct to manage a single RTR
* and allows to interface with the associated SCS's timer * and allows to interface with the associated SCS's timer
*/ */
typedef struct { typedef struct MmrCanScsEntry {
/** /**
* @brief * @brief
* The header used to index this entry. * The header used to index this entry.
@@ -74,7 +74,7 @@ typedef struct {
* @brief * @brief
* The results of an scsCheck operation. * The results of an scsCheck operation.
*/ */
typedef enum { typedef enum MmrCanScsCheckResult {
/** /**
* @brief No timeout error. * @brief No timeout error.
*/ */
+1 -1
View File
@@ -73,7 +73,7 @@
* *
* Asynchronous logic can be easily implemented using State Machines * Asynchronous logic can be easily implemented using State Machines
*/ */
typedef enum { typedef enum MmrAsyncResult {
MMR_ASYNC_RESULT_ERROR, MMR_ASYNC_RESULT_ERROR,
MMR_ASYNC_RESULT_PENDING, MMR_ASYNC_RESULT_PENDING,
MMR_ASYNC_RESULT_COMPLETED, MMR_ASYNC_RESULT_COMPLETED,