APM:Libraries
Public Member Functions | List of all members
AP_HAL::SPIDevice Class Referenceabstract

#include <SPIDevice.h>

Inheritance diagram for AP_HAL::SPIDevice:
[legend]
Collaboration diagram for AP_HAL::SPIDevice:
[legend]

Public Member Functions

 SPIDevice ()
 
virtual ~SPIDevice ()
 
virtual bool set_speed (Device::Speed speed) override=0
 
virtual bool transfer (const uint8_t *send, uint32_t send_len, uint8_t *recv, uint32_t recv_len) override=0
 
virtual bool transfer_fullduplex (const uint8_t *send, uint8_t *recv, uint32_t len)=0
 
virtual bool clock_pulse (uint32_t len)
 
virtual Semaphoreget_semaphore () override=0
 
virtual Device::PeriodicHandle register_periodic_callback (uint32_t period_usec, Device::PeriodicCb) override=0
 
virtual bool adjust_periodic_callback (PeriodicHandle h, uint32_t period_usec) override
 
- 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 ()
 
virtual void set_address (uint8_t address)
 
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 unregister_callback (PeriodicHandle h)
 
virtual void register_completion_callback (AP_HAL::MemberProc proc)
 
virtual void register_completion_callback (AP_HAL::Proc proc)
 
virtual bool set_chip_select (bool set)
 
void set_read_flag (uint8_t flag)
 
uint32_t get_bus_id_devtype (uint8_t devtype)
 
virtual void set_retries (uint8_t retries)
 

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
 
- 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)
 
- 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
 

Detailed Description

Definition at line 27 of file SPIDevice.h.

Constructor & Destructor Documentation

◆ SPIDevice()

AP_HAL::SPIDevice::SPIDevice ( )
inline

Definition at line 29 of file SPIDevice.h.

Referenced by Linux::SPIDeviceManager::_create_device(), F4Light::SPIDeviceManager::_get_device(), PX4::SPIDeviceManager::get_device(), VRBRAIN::SPIDeviceManager::get_device(), and ChibiOS::SPIDeviceManager::get_device().

Here is the caller graph for this function:

◆ ~SPIDevice()

virtual AP_HAL::SPIDevice::~SPIDevice ( )
inlinevirtual

Reimplemented in F4Light::SPIDevice, ChibiOS::SPIDevice, PX4::SPIDevice, VRBRAIN::SPIDevice, Empty::SPIDevice, and Linux::SPIDevice.

Definition at line 31 of file SPIDevice.h.

Here is the call graph for this function:

Member Function Documentation

◆ adjust_periodic_callback()

virtual bool AP_HAL::SPIDevice::adjust_periodic_callback ( PeriodicHandle  h,
uint32_t  period_usec 
)
inlineoverridevirtual

Implements AP_HAL::Device.

Reimplemented in F4Light::SPIDevice, ChibiOS::SPIDevice, PX4::SPIDevice, VRBRAIN::SPIDevice, and Linux::SPIDevice.

Definition at line 62 of file SPIDevice.h.

◆ clock_pulse()

virtual bool AP_HAL::SPIDevice::clock_pulse ( uint32_t  len)
inlinevirtual

Reimplemented in ChibiOS::SPIDevice.

Definition at line 52 of file SPIDevice.h.

Referenced by sdcard_stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_semaphore()

virtual Semaphore* AP_HAL::SPIDevice::get_semaphore ( )
overridepure virtual

◆ register_periodic_callback()

virtual Device::PeriodicHandle AP_HAL::SPIDevice::register_periodic_callback ( uint32_t  period_usec,
Device::PeriodicCb   
)
overridepure virtual

Referenced by clock_pulse(), AP_OpticalFlow_Pixart::setup_sensor(), AP_InertialSensor_LSM9DS0::start(), AP_InertialSensor_LSM9DS1::start(), and AP_InertialSensor_RST::start().

Here is the caller graph for this function:

◆ set_speed()

virtual bool AP_HAL::SPIDevice::set_speed ( Device::Speed  speed)
overridepure virtual

◆ transfer()

virtual bool AP_HAL::SPIDevice::transfer ( const uint8_t *  send,
uint32_t  send_len,
uint8_t *  recv,
uint32_t  recv_len 
)
overridepure virtual

◆ transfer_fullduplex()

virtual bool AP_HAL::SPIDevice::transfer_fullduplex ( const uint8_t *  send,
uint8_t *  recv,
uint32_t  len 
)
pure virtual

Implemented in F4Light::SPIDevice, ChibiOS::SPIDevice, PX4::SPIDevice, VRBRAIN::SPIDevice, Empty::SPIDevice, and Linux::SPIDevice.

Referenced by Linux::SPIUARTDriver::_read_fd(), Linux::SPIUARTDriver::_write_fd(), and ~SPIDevice().

Here is the caller graph for this function:

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