mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 00:36:00 +00:00
Completed getPendingRxFifos
This commit is contained in:
parent
22dd70cb70
commit
e8f7261030
@ -80,7 +80,7 @@ namespace sta
|
||||
void disableFilter(uint8_t idx) override;
|
||||
void clearFilters() override;
|
||||
|
||||
// TODO
|
||||
// Return pending RX FIFOs as iterable container
|
||||
CanPendingRxFifos getPendingRxFifos() override;
|
||||
|
||||
// Const getters
|
||||
|
@ -170,13 +170,22 @@ namespace sta
|
||||
}
|
||||
|
||||
CanPendingRxFifos STM32CanController::getPendingRxFifos(){
|
||||
CanPendingRxFifos pendingFifos(42, 3);
|
||||
|
||||
// Example implementation:
|
||||
//pendingFifos.fifo0Pending = HAL_CAN_GetRxFifoFillLevel(handle_, CAN_RX_FIFO0) != 0;
|
||||
//pendingFifos.fifo1Pending = HAL_CAN_GetRxFifoFillLevel(handle_, CAN_RX_FIFO1) != 0;
|
||||
|
||||
return pendingFifos;
|
||||
uint32_t rxFlags = 0;
|
||||
|
||||
// Conditions to set the least significant bits
|
||||
if (HAL_CAN_GetRxFifoFillLevel(handle_, CAN_RX_FIFO0) != 0) {
|
||||
// Set the first least significant bit
|
||||
rxFlags |= 0x01; // 0x01 is 00000001 in binary (LSB set, others cleared)
|
||||
}
|
||||
|
||||
if (HAL_CAN_GetRxFifoFillLevel(handle_, CAN_RX_FIFO1) != 0) {
|
||||
// Set the second least significant bit
|
||||
rxFlags |= 0x02; // 0x02 is 00000010 in binary (2nd LSB set, others cleared)
|
||||
}
|
||||
|
||||
return CanPendingRxFifos(rxFlags, MAX_FIFO_COUNT);;
|
||||
}
|
||||
|
||||
uint8_t STM32CanController::maxFilterCount() const{
|
||||
|
Loading…
x
Reference in New Issue
Block a user