Skip to content

Commit

Permalink
machine: add TxFifoFreeLevel() for CAN
Browse files Browse the repository at this point in the history
  • Loading branch information
sago35 authored and deadprogram committed May 10, 2024
1 parent 7d6b667 commit 6e58c44
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/machine/machine_atsame5x_can.go
Expand Up @@ -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
Expand Down

0 comments on commit 6e58c44

Please sign in to comment.