Improve docs

This commit is contained in:
Stefano Calabretti
2022-02-23 18:50:53 +01:00
parent f5c8353245
commit 86475b1153
5 changed files with 63 additions and 16 deletions
+52 -2
View File
@@ -177,14 +177,64 @@ typedef struct {
extern MmrCanTickProvider __mmr_can_tickProvider;
void MMR_CAN_Init(MmrCanTickProvider tickProvider);
/**
* @brief
* Sets the tick provider.
*
* @param tickProvider
* The function to use when fetching the current tick.
*/
void MMR_CAN_SetTickProvider(MmrCanTickProvider tickProvider);
/**
* @brief
* Configures the filters with the default configuration
* and starts the can interface.
*/
HalStatus MMR_CAN_BasicSetupAndStart(CanHandle *hcan);
/**
* @brief
* Configures the filters.
*
* @param hcan The interface to use.
* @param settings The settings to use when configuring the filters.
* @return HalStatus The result of the operation.
*/
HalStatus MMR_CAN_FilterConfig(CanHandle *hcan, MmrCanFilterSettings settings);
CanFilterMask MMR_CAN_AlignStandardMask(CanFilterMask baseMask);
/**
* @brief
* Provides the default configuration for
* the filters.
*/
MmrCanFilterSettings MMR_CAN_GetDefaultFilterSettings();
/**
* @brief
* Sends a can packet over the network.
* Based on the data length, the packet may be split
* into multiple frames.
*
* It is not recommended to send more than 8 bytes, as the
* 'multiple frames' feature has not been fully implemented yet.
*/
HalStatus MMR_CAN_Send(CanHandle *hcan, MmrCanPacket packet);
/**
* @brief
* Sends a can packet over the network as is, without
* changing the data that is provided.
*
* This can prevent the sudden change of the header's message type when
* using MMR_CAN_Send.
*/
HalStatus MMR_CAN_SendNoTamper(CanHandle *hcan, MmrCanPacket packet);
/**
* @brief
* Receives a can message from the network.
*/
HalStatus MMR_CAN_Receive(CanHandle *hcan, MmrCanMessage *result);
#endif /* INC_MMR_CAN_H_ */
+8
View File
@@ -25,6 +25,14 @@ typedef struct {
#define MMR_CAN_CreateEventList(handlers) \
(const MmrCanEventList) { handlers, sizeofarray(handlers) }
/**
* @brief
* Activates the CAN rx interrupts
*
* When one is fired, the callbacks provided inside the
* MmrCanEventList will be invoked
*/
HalStatus MMR_CAN_InitRxHandlers(CanHandle *hcan, const MmrCanEventList *rxEvents);
+1 -6
View File
@@ -115,7 +115,6 @@ bool MMR_CAN_MaybeHandleAck(MmrCanHeader header);
*
* This function MUST be called at every loop.
*
* @param hcan The interface to use.
* @return HalStatus
* The result of the operation.
* HAL_ERROR should immediately be handled as a safe state.
@@ -127,9 +126,7 @@ HalStatus MMR_CAN_HandleNextScs(CanHandle *hcan);
* Send an acknowledgment packet based on the
* given scs header.
*
* @param hcan The can interface to use.
* @param originalHeader The scs header to acknowledge.
* @return HalStatus The result of the operation.
* @param originalHeader The scs header to acknowledge.
*/
HalStatus MMR_CAN_SendAck(
CanHandle *hcan,
@@ -140,10 +137,8 @@ HalStatus MMR_CAN_SendAck(
* @brief
* Sends an Scs message.
*
* @param hcan The can interface to use.
* @param scsId The MMR_CAN_MESSAGE_ID_SCS_xx id.
* @param senderId The id of this board.
* @return HalStatus The result of the operation.
*/
HalStatus MMR_CAN_SendScs(
CanHandle *hcan,
+1 -1
View File
@@ -5,7 +5,7 @@
MmrCanTickProvider __mmr_can_tickProvider;
void MMR_CAN_Init(MmrCanTickProvider tickProvider) {
void MMR_CAN_SetTickProvider(MmrCanTickProvider tickProvider) {
__mmr_can_tickProvider = tickProvider;
}
+1 -7
View File
@@ -10,13 +10,7 @@ static void __invokeAll(const MmrCanEventList *events, const MmrCanMessage *even
static void __maybeInvoke(const MmrCanEventHandler handler, const MmrCanMessage *event);
/**
* @brief
* Activates the CAN rx interrupts
*
* When one is fired, the callbacks provided inside the
* MmrCanEventList will be invoked
*/
HalStatus MMR_CAN_InitRxHandlers(CanHandle *hcan, const MmrCanEventList *rxEvents) {
_rxEvents = rxEvents;
return HAL_CAN_ActivateNotification(hcan, MMR_CAN_RX_INTERRUPT);