Adafruit Bus IO Library
Public Member Functions | List of all members
Adafruit_BusIO_RegisterBits Class Reference

The class which defines a slice of bits from within a device register (a location to read/write data from) More...

#include <Adafruit_BusIO_Register.h>

Public Member Functions

 Adafruit_BusIO_RegisterBits (Adafruit_BusIO_Register *reg, uint8_t bits, uint8_t shift)
 Create a slice of the register that we can address without touching other bits. More...
 
bool write (uint32_t value)
 Write 4 bytes of data to the register. More...
 
uint32_t read (void)
 Read 4 bytes of data from the register. More...
 

Detailed Description

The class which defines a slice of bits from within a device register (a location to read/write data from)

Constructor & Destructor Documentation

◆ Adafruit_BusIO_RegisterBits()

Adafruit_BusIO_RegisterBits::Adafruit_BusIO_RegisterBits ( Adafruit_BusIO_Register reg,
uint8_t  bits,
uint8_t  shift 
)

Create a slice of the register that we can address without touching other bits.

Parameters
regThe Adafruit_BusIO_Register which defines the bus/register
bitsThe number of bits wide we are slicing
shiftThe number of bits that our bit-slice is shifted from LSB

Member Function Documentation

◆ write()

bool Adafruit_BusIO_RegisterBits::write ( uint32_t  data)

Write 4 bytes of data to the register.

Parameters
dataThe 4 bytes to write
Returns
True on successful write (only really useful for I2C as SPI is uncheckable)

◆ read()

uint32_t Adafruit_BusIO_RegisterBits::read ( void  )

Read 4 bytes of data from the register.

Returns
data The 4 bytes to read

The documentation for this class was generated from the following files: