Better parameter handling (#6)

* Add rx event handlers

* Fix compile errors and add constness

* Pass sender id

* Change api interface

* Revert changes

* Add filter fifo

* Add default setup

* Add receive function

* Remove interrupt activation

* Activate RX interrupts

* Merge remote changes

* Add event list constructor

* Fix compilation bug

* Send and receive multiple frames

* Refactor

* Refactor

* Fix compile error

* Use known syntax

* Refactor

* Provide storage

* Add frame end

* Add some documentation

* Turn macros into functions

* Refactor

* Refactor

* Fix compile error

* Use ExtendedIds

* Fix reception bug (fixes #4)

* Add packet headers

* Refactor

Co-authored-by: Riccardo998 <riccardo.storchi98@gmail.com>
This commit is contained in:
Stefano Calabretti
2021-12-20 15:12:57 +01:00
committed by GitHub
parent c0cc853cf8
commit ed2a26fbc9
8 changed files with 147 additions and 73 deletions
+12
View File
@@ -10,12 +10,24 @@ 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);
}
/**
* @brief
* Stores the message inside a byte buffer,
* and then sends it to every registered event handler
*/
static void __handleCanRxInterrupt(CanHandle *hcan) {
static CanRxBuffer buffer = {};
static MmrCanMessage event = {