Improve docs
This commit is contained in:
+52
-2
@@ -177,14 +177,64 @@ typedef struct {
|
|||||||
extern MmrCanTickProvider __mmr_can_tickProvider;
|
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);
|
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);
|
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();
|
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);
|
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);
|
HalStatus MMR_CAN_SendNoTamper(CanHandle *hcan, MmrCanPacket packet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Receives a can message from the network.
|
||||||
|
*/
|
||||||
HalStatus MMR_CAN_Receive(CanHandle *hcan, MmrCanMessage *result);
|
HalStatus MMR_CAN_Receive(CanHandle *hcan, MmrCanMessage *result);
|
||||||
|
|
||||||
#endif /* INC_MMR_CAN_H_ */
|
#endif /* INC_MMR_CAN_H_ */
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ typedef struct {
|
|||||||
#define MMR_CAN_CreateEventList(handlers) \
|
#define MMR_CAN_CreateEventList(handlers) \
|
||||||
(const MmrCanEventList) { handlers, sizeofarray(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);
|
HalStatus MMR_CAN_InitRxHandlers(CanHandle *hcan, const MmrCanEventList *rxEvents);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ bool MMR_CAN_MaybeHandleAck(MmrCanHeader header);
|
|||||||
*
|
*
|
||||||
* This function MUST be called at every loop.
|
* This function MUST be called at every loop.
|
||||||
*
|
*
|
||||||
* @param hcan The interface to use.
|
|
||||||
* @return HalStatus
|
* @return HalStatus
|
||||||
* The result of the operation.
|
* The result of the operation.
|
||||||
* HAL_ERROR should immediately be handled as a safe state.
|
* 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
|
* Send an acknowledgment packet based on the
|
||||||
* given scs header.
|
* given scs header.
|
||||||
*
|
*
|
||||||
* @param hcan The can interface to use.
|
* @param originalHeader The scs header to acknowledge.
|
||||||
* @param originalHeader The scs header to acknowledge.
|
|
||||||
* @return HalStatus The result of the operation.
|
|
||||||
*/
|
*/
|
||||||
HalStatus MMR_CAN_SendAck(
|
HalStatus MMR_CAN_SendAck(
|
||||||
CanHandle *hcan,
|
CanHandle *hcan,
|
||||||
@@ -140,10 +137,8 @@ HalStatus MMR_CAN_SendAck(
|
|||||||
* @brief
|
* @brief
|
||||||
* Sends an Scs message.
|
* Sends an Scs message.
|
||||||
*
|
*
|
||||||
* @param hcan The can interface to use.
|
|
||||||
* @param scsId The MMR_CAN_MESSAGE_ID_SCS_xx id.
|
* @param scsId The MMR_CAN_MESSAGE_ID_SCS_xx id.
|
||||||
* @param senderId The id of this board.
|
* @param senderId The id of this board.
|
||||||
* @return HalStatus The result of the operation.
|
|
||||||
*/
|
*/
|
||||||
HalStatus MMR_CAN_SendScs(
|
HalStatus MMR_CAN_SendScs(
|
||||||
CanHandle *hcan,
|
CanHandle *hcan,
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
MmrCanTickProvider __mmr_can_tickProvider;
|
MmrCanTickProvider __mmr_can_tickProvider;
|
||||||
|
|
||||||
|
|
||||||
void MMR_CAN_Init(MmrCanTickProvider tickProvider) {
|
void MMR_CAN_SetTickProvider(MmrCanTickProvider tickProvider) {
|
||||||
__mmr_can_tickProvider = tickProvider;
|
__mmr_can_tickProvider = tickProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,7 @@ static void __invokeAll(const MmrCanEventList *events, const MmrCanMessage *even
|
|||||||
static void __maybeInvoke(const MmrCanEventHandler handler, const MmrCanMessage *event);
|
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) {
|
HalStatus MMR_CAN_InitRxHandlers(CanHandle *hcan, const MmrCanEventList *rxEvents) {
|
||||||
_rxEvents = rxEvents;
|
_rxEvents = rxEvents;
|
||||||
return HAL_CAN_ActivateNotification(hcan, MMR_CAN_RX_INTERRUPT);
|
return HAL_CAN_ActivateNotification(hcan, MMR_CAN_RX_INTERRUPT);
|
||||||
|
|||||||
Reference in New Issue
Block a user