SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
satnogs::comms::lib::bsp::i2c Class Referenceabstract

I2C device abstraction. More...

#include <i2c.hpp>

Inheritance diagram for satnogs::comms::lib::bsp::i2c:
satnogs::comms::i2c_bsp

Public Member Functions

 i2c ()
 Construct a new I2C object.
 ~i2c ()
virtual void read (uint16_t addr, uint8_t *rx, size_t rxlen, const uint8_t *tx, size_t txlen)=0
 Performs an I2C read operation.
virtual void read (uint16_t addr, uint8_t start_addr, uint8_t *rx, size_t len)=0
 Simplified I2C read operation.
virtual void write (uint16_t addr, const uint8_t *tx, size_t len)=0
 Performs an I2C write operation.
virtual void write (uint16_t addr, uint8_t start_addr, const uint8_t *tx, size_t len)=0
 Performs an I2C write operation.

Detailed Description

I2C device abstraction.

This class provides a generic I2C communication abstraction.

Warning
Depending on the target platform/RTOS users are expected to define a class that inherits this one and implement at least the pure virtual methods

Definition at line 39 of file i2c.hpp.

Constructor & Destructor Documentation

◆ i2c()

satnogs::comms::lib::bsp::i2c::i2c ( )
inline

Construct a new I2C object.

Definition at line 45 of file i2c.hpp.

◆ ~i2c()

satnogs::comms::lib::bsp::i2c::~i2c ( )
inline

Definition at line 46 of file i2c.hpp.

Member Function Documentation

◆ read() [1/2]

virtual void satnogs::comms::lib::bsp::i2c::read ( uint16_t addr,
uint8_t * rx,
size_t rxlen,
const uint8_t * tx,
size_t txlen )
pure virtual

Performs an I2C read operation.

Parameters
addraddress of the I2C device
rxthe receive buffer. Should be at least rxlen bytes in size
txthe transmit buffer. Should be at least txlen bytes in size
rxlennumber of bytes to received after the write operation
txlennumber of bytes to transmit from the tx buffer

Implemented in satnogs::comms::i2c_bsp.

◆ read() [2/2]

virtual void satnogs::comms::lib::bsp::i2c::read ( uint16_t addr,
uint8_t start_addr,
uint8_t * rx,
size_t len )
pure virtual

Simplified I2C read operation.

Parameters
addraddress of the I2C device
start_addrthe peripheral internal address to start reading
rxthe receive buffer. Should be at least len bytes in size
lennumber of bytes to receive

Implemented in satnogs::comms::i2c_bsp.

◆ write() [1/2]

virtual void satnogs::comms::lib::bsp::i2c::write ( uint16_t addr,
const uint8_t * tx,
size_t len )
pure virtual

Performs an I2C write operation.

Parameters
addraddress of the I2C device
txthe transmit buffer. Should be at least len bytes in size
lennumber of bytes to be transmitted

Implemented in satnogs::comms::i2c_bsp.

◆ write() [2/2]

virtual void satnogs::comms::lib::bsp::i2c::write ( uint16_t addr,
uint8_t start_addr,
const uint8_t * tx,
size_t len )
pure virtual

Performs an I2C write operation.

Parameters
addraddress of the I2C device
start_addrthe peripheral internal address to start writing
txthe transmit buffer. Should be at least len bytes in size
lennumber of bytes to be transmitted

Implemented in satnogs::comms::i2c_bsp.


The documentation for this class was generated from the following file:
  • libsatnogs-comms/include/satnogs-comms-lib/bsp/i2c.hpp