APM:Libraries
|
#include <I2CDevice.h>
Public Member Functions | |
I2CDevice (uint8_t bus, uint8_t address) | |
~I2CDevice () | |
void | set_address (uint8_t address) override |
void | set_retries (uint8_t retries) override |
bool | transfer (const uint8_t *send, uint32_t send_len, uint8_t *recv, uint32_t recv_len) override |
bool | read_registers_multiple (uint8_t first_reg, uint8_t *recv, uint32_t recv_len, uint8_t times) |
bool | set_speed (enum AP_HAL::Device::Speed speed) override |
F4Light::Semaphore * | get_semaphore () override |
AP_HAL::Device::PeriodicHandle | register_periodic_callback (uint32_t period_usec, Device::PeriodicCb proc) override |
bool | adjust_periodic_callback (AP_HAL::Device::PeriodicHandle h, uint32_t period_usec) override |
bool | unregister_callback (PeriodicHandle h) override |
void | register_completion_callback (Handler h) |
void | register_completion_callback (AP_HAL::MemberProc proc) |
void | register_completion_callback (AP_HAL::Proc proc) |
uint32_t | get_error_count () |
uint8_t | get_last_error () |
uint8_t | get_last_error_state () |
uint8_t | get_bus () |
uint8_t | get_addr () |
void | do_bus_reset () |
Public Member Functions inherited from AP_HAL::I2CDevice | |
I2CDevice () | |
virtual void | set_split_transfers (bool set) |
Public Member Functions inherited from AP_HAL::Device | |
FUNCTOR_TYPEDEF (PeriodicCb, void) | |
Device (enum BusType type) | |
enum BusType | bus_type (void) const |
uint8_t | bus_num (void) const |
uint32_t | get_bus_id (void) const |
uint8_t | get_bus_address (void) const |
void | set_device_type (uint8_t devtype) |
virtual | ~Device () |
bool | read_registers (uint8_t first_reg, uint8_t *recv, uint32_t recv_len) |
bool | write_register (uint8_t reg, uint8_t val, bool checked=false) |
void | set_checked_register (uint8_t reg, uint8_t val) |
bool | setup_checked_registers (uint8_t num_regs, uint8_t frequency=10) |
bool | check_next_register (void) |
bool | read (uint8_t *recv, uint32_t recv_len) |
virtual PeriodicHandle | register_periodic_callback (uint32_t period_usec, PeriodicCb)=0 |
virtual bool | set_chip_select (bool set) |
void | set_read_flag (uint8_t flag) |
uint32_t | get_bus_id_devtype (uint8_t devtype) |
Static Public Member Functions | |
static void | lateInit () |
static uint8_t | get_dev_count () |
static F4Light::I2CDevice * | get_device (uint8_t i) |
Static Public Member Functions inherited from AP_HAL::Device | |
static uint32_t | make_bus_id (enum BusType bus_type, uint8_t bus, uint8_t address, uint8_t devtype) |
static uint32_t | change_bus_id (uint32_t old_id, uint8_t devtype) |
Private Member Functions | |
void | init () |
uint32_t | i2c_read (uint8_t addr, const uint8_t *tx_buff, uint8_t txlen, uint8_t *rx_buff, uint8_t rxlen) |
uint32_t | i2c_write (uint8_t addr, const uint8_t *tx_buff, uint8_t len) |
void | isr_ev () |
uint32_t | wait_stop_done (bool v) |
void | finish_transfer () |
void | _do_bus_reset () |
Private Attributes | |
uint8_t | _bus |
uint16_t | _offs |
uint8_t | _address |
uint8_t | _retries |
uint32_t | _lockup_count |
bool | _initialized |
uint8_t | last_error |
uint8_t | last_error_state |
bool | _slow |
bool | _failed |
bool | need_reset |
void * | _task |
const i2c_dev * | _dev |
Soft_I2C * | s_i2c |
Handler | _completion_cb |
uint8_t | _state |
volatile uint8_t | _error |
uint8_t | _addr |
const uint8_t * | _tx_buff |
uint8_t | _tx_len |
uint8_t * | _rx_buff |
uint8_t | _rx_len |
Static Private Attributes | |
static F4Light::Semaphore | _semaphores [3] |
static const timer_dev * | _timers [3] |
static F4Light::I2CDevice * | devices [MAX_I2C_DEVICES] |
static uint8_t | dev_count |
static bool | lateInitDone =false |
Additional Inherited Members | |
Public Types inherited from AP_HAL::Device | |
enum | BusType { BUS_TYPE_UNKNOWN = 0, BUS_TYPE_I2C = 1, BUS_TYPE_SPI = 2, BUS_TYPE_UAVCAN = 3 } |
enum | Speed { SPEED_HIGH, SPEED_LOW } |
typedef void * | PeriodicHandle |
Protected Member Functions inherited from AP_HAL::Device | |
void | set_device_address (uint8_t address) |
void | set_device_bus (uint8_t bus) |
Protected Attributes inherited from AP_HAL::Device | |
uint8_t | _read_flag = 0 |
union DeviceId | _bus_id |
Definition at line 63 of file I2CDevice.h.
I2CDevice::I2CDevice | ( | uint8_t | bus, |
uint8_t | address | ||
) |
Definition at line 47 of file I2CDevice.cpp.
|
virtual |
Reimplemented from AP_HAL::I2CDevice.
Definition at line 66 of file I2CDevice.cpp.
|
private |
Definition at line 384 of file I2CDevice.cpp.
Referenced by do_bus_reset(), init(), register_completion_callback(), and transfer().
|
inlineoverridevirtual |
Implements AP_HAL::I2CDevice.
Definition at line 106 of file I2CDevice.h.
void I2CDevice::do_bus_reset | ( | ) |
Definition at line 377 of file I2CDevice.cpp.
Referenced by transfer().
|
private |
Definition at line 709 of file I2CDevice.cpp.
Referenced by i2c_read(), i2c_write(), and isr_ev().
|
inline |
Definition at line 129 of file I2CDevice.h.
Referenced by F4Light::Scheduler::_print_stats(), and F4Light::I2CDeviceManager::get_device().
|
inline |
Definition at line 128 of file I2CDevice.h.
Referenced by F4Light::Scheduler::_print_stats(), and F4Light::I2CDeviceManager::get_device().
|
inlinestatic |
Definition at line 131 of file I2CDevice.h.
Referenced by F4Light::Scheduler::_print_stats(), and F4Light::I2CDeviceManager::get_device().
|
inlinestatic |
Definition at line 132 of file I2CDevice.h.
Referenced by F4Light::Scheduler::_print_stats(), and F4Light::I2CDeviceManager::get_device().
|
inline |
Definition at line 125 of file I2CDevice.h.
Referenced by F4Light::Scheduler::_print_stats().
|
inline |
Definition at line 126 of file I2CDevice.h.
Referenced by F4Light::Scheduler::_print_stats().
|
inline |
Definition at line 127 of file I2CDevice.h.
Referenced by F4Light::Scheduler::_print_stats().
|
inlineoverridevirtual |
Implements AP_HAL::I2CDevice.
Definition at line 96 of file I2CDevice.h.
|
private |
Definition at line 476 of file I2CDevice.cpp.
Referenced by transfer().
|
private |
Definition at line 431 of file I2CDevice.cpp.
Referenced by transfer().
|
private |
Definition at line 75 of file I2CDevice.cpp.
Referenced by transfer(), and wait_stop_done().
|
private |
Definition at line 546 of file I2CDevice.cpp.
Referenced by i2c_read(), and i2c_write().
|
static |
Definition at line 42 of file I2CDevice.cpp.
|
virtual |
Implements AP_HAL::I2CDevice.
Definition at line 399 of file I2CDevice.cpp.
void I2CDevice::register_completion_callback | ( | Handler | h | ) |
Definition at line 205 of file I2CDevice.cpp.
Referenced by transfer().
|
inlinevirtual |
Reimplemented from AP_HAL::Device.
Definition at line 116 of file I2CDevice.h.
|
inlinevirtual |
Reimplemented from AP_HAL::Device.
Definition at line 120 of file I2CDevice.h.
|
inlineoverridevirtual |
Implements AP_HAL::I2CDevice.
Definition at line 99 of file I2CDevice.h.
|
inlineoverridevirtual |
Reimplemented from AP_HAL::Device.
Definition at line 75 of file I2CDevice.h.
|
inlineoverridevirtual |
Reimplemented from AP_HAL::Device.
Definition at line 78 of file I2CDevice.h.
|
inlineoverridevirtual |
Implements AP_HAL::I2CDevice.
Definition at line 93 of file I2CDevice.h.
|
overridevirtual |
Implements AP_HAL::I2CDevice.
Definition at line 217 of file I2CDevice.cpp.
|
inlineoverridevirtual |
Reimplemented from AP_HAL::Device.
Definition at line 112 of file I2CDevice.h.
|
private |
Definition at line 728 of file I2CDevice.cpp.
Referenced by i2c_read(), and i2c_write().
|
private |
Definition at line 172 of file I2CDevice.h.
Referenced by i2c_read(), i2c_write(), and isr_ev().
|
private |
Definition at line 147 of file I2CDevice.h.
Referenced by transfer().
|
private |
Definition at line 145 of file I2CDevice.h.
Referenced by do_bus_reset(), init(), and transfer().
|
private |
Definition at line 168 of file I2CDevice.h.
Referenced by finish_transfer(), i2c_read(), i2c_write(), register_completion_callback(), and transfer().
|
private |
Definition at line 158 of file I2CDevice.h.
Referenced by _do_bus_reset(), finish_transfer(), i2c_read(), i2c_write(), init(), isr_ev(), transfer(), and wait_stop_done().
|
private |
Definition at line 171 of file I2CDevice.h.
Referenced by i2c_read(), i2c_write(), and isr_ev().
|
private |
Definition at line 154 of file I2CDevice.h.
Referenced by _do_bus_reset(), init(), and transfer().
|
private |
Definition at line 150 of file I2CDevice.h.
Referenced by init(), transfer(), and wait_stop_done().
|
private |
Definition at line 149 of file I2CDevice.h.
Referenced by transfer(), and wait_stop_done().
|
private |
Definition at line 146 of file I2CDevice.h.
Referenced by init().
|
private |
Definition at line 148 of file I2CDevice.h.
Referenced by transfer().
|
private |
Definition at line 175 of file I2CDevice.h.
Referenced by i2c_read(), and isr_ev().
|
private |
Definition at line 176 of file I2CDevice.h.
Referenced by i2c_read(), i2c_write(), and isr_ev().
|
staticprivate |
Definition at line 161 of file I2CDevice.h.
Referenced by do_bus_reset().
|
private |
Definition at line 153 of file I2CDevice.h.
Referenced by init().
|
private |
Definition at line 170 of file I2CDevice.h.
Referenced by i2c_read(), i2c_write(), isr_ev(), and transfer().
|
private |
Definition at line 156 of file I2CDevice.h.
Referenced by finish_transfer(), i2c_read(), and i2c_write().
|
staticprivate |
|
private |
Definition at line 173 of file I2CDevice.h.
Referenced by i2c_read(), i2c_write(), and isr_ev().
|
private |
Definition at line 174 of file I2CDevice.h.
Referenced by i2c_read(), i2c_write(), and isr_ev().
|
staticprivate |
Definition at line 165 of file I2CDevice.h.
Referenced by I2CDevice(), and ~I2CDevice().
|
staticprivate |
Definition at line 164 of file I2CDevice.h.
Referenced by I2CDevice(), and ~I2CDevice().
|
private |
Definition at line 151 of file I2CDevice.h.
Referenced by transfer(), and wait_stop_done().
|
private |
Definition at line 152 of file I2CDevice.h.
Referenced by transfer().
|
staticprivate |
Definition at line 166 of file I2CDevice.h.
Referenced by init(), and lateInit().
|
private |
Definition at line 155 of file I2CDevice.h.
Referenced by _do_bus_reset(), init(), transfer(), and wait_stop_done().
|
private |
Definition at line 159 of file I2CDevice.h.
Referenced by init(), and transfer().