diff options
author | sago35 <[email protected]> | 2024-05-10 22:35:36 +0900 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-05-10 18:45:06 +0200 |
commit | 6e58c44390303261af4a721df522affbc99c88ad (patch) | |
tree | a485e30e4226eeb97f49054e12bd6ae5088df536 | |
parent | 7d6b667bba801205e32c5ff3b460100b0409fda2 (diff) | |
download | tinygo-6e58c44390303261af4a721df522affbc99c88ad.tar.gz tinygo-6e58c44390303261af4a721df522affbc99c88ad.zip |
machine: add TxFifoFreeLevel() for CAN
-rw-r--r-- | src/machine/machine_atsame5x_can.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/machine/machine_atsame5x_can.go b/src/machine/machine_atsame5x_can.go index 498646980..bf38cd898 100644 --- a/src/machine/machine_atsame5x_can.go +++ b/src/machine/machine_atsame5x_can.go @@ -221,6 +221,11 @@ func (can *CAN) TxFifoIsFull() bool { return (can.Bus.TXFQS.Get() & sam.CAN_TXFQS_TFQF_Msk) == sam.CAN_TXFQS_TFQF_Msk } +// TxFifoFreeLevel returns how many messages can still be set in the TxFifo. +func (can *CAN) TxFifoFreeLevel() int { + return int(can.Bus.GetTXFQS_TFFL()) +} + // TxRaw sends a CAN Frame according to CANTxBufferElement. func (can *CAN) TxRaw(e *CANTxBufferElement) { putIndex := (can.Bus.TXFQS.Get() & sam.CAN_TXFQS_TFQPI_Msk) >> sam.CAN_TXFQS_TFQPI_Pos |