Abstract class for character device on I2C.
More...
#include <I2C.hpp>
|
static unsigned int | _bus_clocks [BOARD_NUMBER_I2C_BUSES] = BOARD_I2C_BUS_CLOCK_INIT |
|
|
| I2C (const char *name, const char *devname, const int bus, const uint16_t address, const uint32_t frequency) |
| @ Constructor More...
|
|
virtual | ~I2C () |
|
virtual int | probe () |
| Check for the presence of the device on the bus. More...
|
|
int | transfer (const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len) |
| Perform an I2C transaction to the device. More...
|
|
virtual bool | external () const override |
|
| I2C (const char *name, const char *devname, const int bus, const uint16_t address, const uint32_t frequency) |
| @ Constructor More...
|
|
virtual | ~I2C () |
|
virtual int | probe () |
| Check for the presence of the device on the bus. More...
|
|
int | transfer (const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len) |
| Perform an I2C transaction to the device. More...
|
|
virtual bool | external () const override |
|
| I2C (const char *name, const char *devname, const int bus, const uint16_t address, const uint32_t frequency) |
| @ Constructor More...
|
|
virtual | ~I2C () |
|
virtual int | probe () |
| Check for the presence of the device on the bus. More...
|
|
int | transfer (const uint8_t *send, const unsigned send_len, uint8_t *recv, const unsigned recv_len) |
| Perform an I2C transaction to the device. More...
|
|
virtual bool | external () const override |
|
|
uint8_t | _retries {0} |
| The number of times a read or write operation will be retried on error. More...
|
|
Abstract class for character device on I2C.
Definition at line 57 of file I2C.hpp.
◆ I2C() [1/9]
__EXPORT::I2C::I2C |
( |
const I2C & |
| ) |
|
|
delete |
◆ I2C() [2/9]
__EXPORT::I2C::I2C |
( |
I2C && |
| ) |
|
|
delete |
◆ I2C() [3/9]
__EXPORT::I2C::I2C |
( |
const char * |
name, |
|
|
const char * |
devname, |
|
|
const int |
bus, |
|
|
const uint16_t |
address, |
|
|
const uint32_t |
frequency |
|
) |
| |
|
protected |
@ Constructor
- Parameters
-
name | Driver name |
devname | Device node name |
bus | I2C bus on which the device lives |
address | I2C bus address, or zero if set_address will be used |
frequency | I2C bus frequency for the device (currently not used) |
◆ ~I2C() [1/3]
virtual __EXPORT::I2C::~I2C |
( |
| ) |
|
|
protectedvirtual |
◆ I2C() [4/9]
__EXPORT::I2C::I2C |
( |
const I2C & |
| ) |
|
|
delete |
◆ I2C() [5/9]
__EXPORT::I2C::I2C |
( |
I2C && |
| ) |
|
|
delete |
◆ I2C() [6/9]
__EXPORT::I2C::I2C |
( |
const char * |
name, |
|
|
const char * |
devname, |
|
|
const int |
bus, |
|
|
const uint16_t |
address, |
|
|
const uint32_t |
frequency |
|
) |
| |
|
protected |
@ Constructor
- Parameters
-
name | Driver name |
devname | Device node name |
bus | I2C bus on which the device lives |
address | I2C bus address, or zero if set_address will be used |
frequency | I2C bus frequency for the device (currently not used) |
◆ ~I2C() [2/3]
virtual __EXPORT::I2C::~I2C |
( |
| ) |
|
|
protectedvirtual |
◆ I2C() [7/9]
__EXPORT::I2C::I2C |
( |
const I2C & |
| ) |
|
|
delete |
◆ I2C() [8/9]
__EXPORT::I2C::I2C |
( |
I2C && |
| ) |
|
|
delete |
◆ I2C() [9/9]
I2C::I2C |
( |
const char * |
name, |
|
|
const char * |
devname, |
|
|
const int |
bus, |
|
|
const uint16_t |
address, |
|
|
const uint32_t |
frequency |
|
) |
| |
|
protected |
@ Constructor
- Parameters
-
name | Driver name |
devname | Device node name |
bus | I2C bus on which the device lives |
address | I2C bus address, or zero if set_address will be used |
frequency | I2C bus frequency for the device (currently not used) |
Definition at line 54 of file I2C.cpp.
References DEVICE_DEBUG.
◆ ~I2C() [3/3]
◆ external() [1/3]
virtual bool __EXPORT::I2C::external |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ external() [2/3]
virtual bool __EXPORT::I2C::external |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ external() [3/3]
virtual bool __EXPORT::I2C::external |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ init() [1/3]
virtual int __EXPORT::I2C::init |
( |
| ) |
|
|
overridevirtual |
◆ init() [2/3]
virtual int __EXPORT::I2C::init |
( |
| ) |
|
|
overridevirtual |
◆ init() [3/3]
virtual int __EXPORT::I2C::init |
( |
| ) |
|
|
overridevirtual |
◆ operator=() [1/6]
I2C& __EXPORT::I2C::operator= |
( |
const I2C & |
| ) |
|
|
delete |
◆ operator=() [2/6]
I2C& __EXPORT::I2C::operator= |
( |
const I2C & |
| ) |
|
|
delete |
◆ operator=() [3/6]
I2C& __EXPORT::I2C::operator= |
( |
const I2C & |
| ) |
|
|
delete |
◆ operator=() [4/6]
I2C& __EXPORT::I2C::operator= |
( |
I2C && |
| ) |
|
|
delete |
◆ operator=() [5/6]
I2C& __EXPORT::I2C::operator= |
( |
I2C && |
| ) |
|
|
delete |
◆ operator=() [6/6]
I2C& __EXPORT::I2C::operator= |
( |
I2C && |
| ) |
|
|
delete |
◆ probe() [1/3]
virtual int __EXPORT::I2C::probe |
( |
| ) |
|
|
inlineprotectedvirtual |
Check for the presence of the device on the bus.
Definition at line 93 of file I2C.hpp.
References send().
◆ probe() [2/3]
virtual int __EXPORT::I2C::probe |
( |
| ) |
|
|
inlineprotectedvirtual |
Check for the presence of the device on the bus.
Definition at line 93 of file I2C.hpp.
References send().
◆ probe() [3/3]
virtual int __EXPORT::I2C::probe |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ set_bus_clock()
int I2C::set_bus_clock |
( |
unsigned |
bus, |
|
|
unsigned |
clock_hz |
|
) |
| |
|
static |
◆ transfer() [1/3]
int __EXPORT::I2C::transfer |
( |
const uint8_t * |
send, |
|
|
const unsigned |
send_len, |
|
|
uint8_t * |
recv, |
|
|
const unsigned |
recv_len |
|
) |
| |
|
protected |
Perform an I2C transaction to the device.
At least one of send_len and recv_len must be non-zero.
- Parameters
-
send | Pointer to bytes to send. |
send_len | Number of bytes to send. |
recv | Pointer to buffer for bytes received. |
recv_len | Number of bytes to receive. |
- Returns
- OK if the transfer was successful, -errno otherwise.
◆ transfer() [2/3]
int I2C::transfer |
( |
const uint8_t * |
send, |
|
|
const unsigned |
send_len, |
|
|
uint8_t * |
recv, |
|
|
const unsigned |
recv_len |
|
) |
| |
|
protected |
Perform an I2C transaction to the device.
At least one of send_len and recv_len must be non-zero.
- Parameters
-
send | Pointer to bytes to send. |
send_len | Number of bytes to send. |
recv | Pointer to buffer for bytes received. |
recv_len | Number of bytes to receive. |
- Returns
- OK if the transfer was successful, -errno otherwise.
Definition at line 170 of file I2C.cpp.
References _bus_clocks, _dev, _retries, DEVICE_DEBUG, and send().
◆ transfer() [3/3]
int __EXPORT::I2C::transfer |
( |
const uint8_t * |
send, |
|
|
const unsigned |
send_len, |
|
|
uint8_t * |
recv, |
|
|
const unsigned |
recv_len |
|
) |
| |
|
protected |
Perform an I2C transaction to the device.
At least one of send_len and recv_len must be non-zero.
- Parameters
-
send | Pointer to bytes to send. |
send_len | Number of bytes to send. |
recv | Pointer to buffer for bytes received. |
recv_len | Number of bytes to receive. |
- Returns
- OK if the transfer was successful, -errno otherwise.
◆ _bus_clocks
unsigned int I2C::_bus_clocks = BOARD_I2C_BUS_CLOCK_INIT |
|
static |
◆ _dev
px4_i2c_dev_t* __EXPORT::I2C::_dev {nullptr} |
|
private |
◆ _fd
int __EXPORT::I2C::_fd {-1} |
|
private |
◆ _frequency
uint32_t __EXPORT::I2C::_frequency {0} |
|
private |
◆ _retries
uint8_t __EXPORT::I2C::_retries {0} |
|
protected |
The number of times a read or write operation will be retried on error.
Definition at line 79 of file I2C.hpp.
Referenced by transfer().
The documentation for this class was generated from the following files:
- src/lib/drivers/device/nuttx/I2C.hpp
- src/lib/drivers/device/nuttx/I2C.cpp