hal
Hardware Abstraction Layer
i2c_transaction_queue.c File Reference

Implementation for the transaction queue. More...

Include dependency graph for i2c_transaction_queue.c:

Classes

struct  i2c_transaction_queue_t
 A queue that holds references to the transactions to be processed. More...
 

Functions

i2c_queue_status_t i2c_transaction_queue_add (hal_i2c_txn_t *txn)
 Add a transaction to the queue. More...
 
i2c_queue_status_t i2c_transaction_queue_get_next (hal_i2c_txn_t **txn)
 Get the next transaction from the queue. Removes the transaction from the queue. More...
 
void i2c_transaction_queue_reset ()
 Resets the queue. More...
 

Detailed Description

Implementation for the transaction queue.

Copyright (c) 2025 Cory McKiel. Licensed under the MIT License. See LICENSE file in the project root.

Function Documentation

◆ i2c_transaction_queue_add()

i2c_queue_status_t i2c_transaction_queue_add ( hal_i2c_txn_t txn)

Add a transaction to the queue.

Parameters
txnA reference to the transaction to queue.
Warning
Clients are responsible for maintaining the memory for their transactions. This merely queues a handle.
Returns
The status of the request. SUCCESS is the only return value indicating the request was queued.

◆ i2c_transaction_queue_get_next()

i2c_queue_status_t i2c_transaction_queue_get_next ( hal_i2c_txn_t **  txn)

Get the next transaction from the queue. Removes the transaction from the queue.

Parameters
txnA reference to a handle type for a transaction.
Note
txn is a double pointer because the client is meant to pass in a null handle that they want set to point to the next transaction to process. But to actually set a param, there needs to be a reference to it, hence, the double pointer.
Returns
The status of the request. SUCCESS is the only return value indicating the next transaction was properly dequeued.

◆ i2c_transaction_queue_reset()

void i2c_transaction_queue_reset ( )

Resets the queue.

It resets all internal variables that manage the queue so it will be "like new".