APM:Libraries
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
VRBRAIN::SPIDevice Class Reference

#include <SPIDevice.h>

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

Public Member Functions

 SPIDevice (SPIBus &_bus, SPIDesc &_device_desc)
 
virtual ~SPIDevice ()
 
bool set_speed (AP_HAL::Device::Speed speed) override
 
void do_transfer (const uint8_t *send, uint8_t *recv, uint32_t len)
 
bool transfer (const uint8_t *send, uint32_t send_len, uint8_t *recv, uint32_t recv_len) override
 
bool transfer_fullduplex (const uint8_t *send, uint8_t *recv, uint32_t len) override
 
AP_HAL::Semaphoreget_semaphore () override
 
AP_HAL::Device::PeriodicHandle register_periodic_callback (uint32_t period_usec, AP_HAL::Device::PeriodicCb) override
 
bool adjust_periodic_callback (AP_HAL::Device::PeriodicHandle h, uint32_t period_usec) override
 
bool set_chip_select (bool set) override
 
- Public Member Functions inherited from AP_HAL::SPIDevice
 SPIDevice ()
 
virtual bool clock_pulse (uint32_t len)
 
virtual Device::PeriodicHandle register_periodic_callback (uint32_t period_usec, Device::PeriodicCb) override=0
 
- 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)
 
void set_read_flag (uint8_t flag)
 
uint32_t get_bus_id_devtype (uint8_t devtype)
 
virtual void set_retries (uint8_t retries)
 

Static Private Member Functions

static void * spi_thread (void *arg)
 

Private Attributes

SPIBusbus
 
SPIDescdevice_desc
 
uint32_t frequency
 
perf_counter_t perf
 
char * pname
 
bool cs_forced
 

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 55 of file SPIDevice.h.

Constructor & Destructor Documentation

◆ SPIDevice()

VRBRAIN::SPIDevice::SPIDevice ( SPIBus _bus,
SPIDesc _device_desc 
)

Definition at line 149 of file SPIDevice.cpp.

Here is the call graph for this function:

◆ ~SPIDevice()

VRBRAIN::SPIDevice::~SPIDevice ( )
virtual

Reimplemented from AP_HAL::SPIDevice.

Definition at line 167 of file SPIDevice.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ adjust_periodic_callback()

bool VRBRAIN::SPIDevice::adjust_periodic_callback ( AP_HAL::Device::PeriodicHandle  h,
uint32_t  period_usec 
)
overridevirtual

Reimplemented from AP_HAL::SPIDevice.

Definition at line 271 of file SPIDevice.cpp.

Here is the call graph for this function:

◆ do_transfer()

void VRBRAIN::SPIDevice::do_transfer ( const uint8_t *  send,
uint8_t *  recv,
uint32_t  len 
)

Definition at line 191 of file SPIDevice.cpp.

Referenced by transfer(), and transfer_fullduplex().

Here is the caller graph for this function:

◆ get_semaphore()

AP_HAL::Semaphore * VRBRAIN::SPIDevice::get_semaphore ( )
overridevirtual

Implements AP_HAL::SPIDevice.

Definition at line 260 of file SPIDevice.cpp.

◆ register_periodic_callback()

AP_HAL::Device::PeriodicHandle VRBRAIN::SPIDevice::register_periodic_callback ( uint32_t  period_usec,
AP_HAL::Device::PeriodicCb  cb 
)
override

Definition at line 266 of file SPIDevice.cpp.

Here is the call graph for this function:

◆ set_chip_select()

bool VRBRAIN::SPIDevice::set_chip_select ( bool  set)
overridevirtual

Reimplemented from AP_HAL::Device.

Definition at line 279 of file SPIDevice.cpp.

◆ set_speed()

bool VRBRAIN::SPIDevice::set_speed ( AP_HAL::Device::Speed  speed)
overridevirtual

Implements AP_HAL::SPIDevice.

Definition at line 175 of file SPIDevice.cpp.

Referenced by SPIDevice().

Here is the caller graph for this function:

◆ spi_thread()

static void* VRBRAIN::SPIDevice::spi_thread ( void *  arg)
staticprivate

◆ transfer()

bool VRBRAIN::SPIDevice::transfer ( const uint8_t *  send,
uint32_t  send_len,
uint8_t *  recv,
uint32_t  recv_len 
)
overridevirtual

Implements AP_HAL::SPIDevice.

Definition at line 229 of file SPIDevice.cpp.

Here is the call graph for this function:

◆ transfer_fullduplex()

bool VRBRAIN::SPIDevice::transfer_fullduplex ( const uint8_t *  send,
uint8_t *  recv,
uint32_t  len 
)
overridevirtual

Implements AP_HAL::SPIDevice.

Definition at line 251 of file SPIDevice.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ bus

SPIBus& VRBRAIN::SPIDevice::bus
private

◆ cs_forced

bool VRBRAIN::SPIDevice::cs_forced
private

Definition at line 93 of file SPIDevice.h.

Referenced by do_transfer(), and set_chip_select().

◆ device_desc

SPIDesc& VRBRAIN::SPIDevice::device_desc
private

Definition at line 89 of file SPIDevice.h.

Referenced by do_transfer(), set_chip_select(), set_speed(), SPIDevice(), and ~SPIDevice().

◆ frequency

uint32_t VRBRAIN::SPIDevice::frequency
private

Definition at line 90 of file SPIDevice.h.

Referenced by do_transfer(), set_speed(), and SPIDevice().

◆ perf

perf_counter_t VRBRAIN::SPIDevice::perf
private

Definition at line 91 of file SPIDevice.h.

Referenced by do_transfer(), SPIDevice(), and ~SPIDevice().

◆ pname

char* VRBRAIN::SPIDevice::pname
private

Definition at line 92 of file SPIDevice.h.

Referenced by SPIDevice(), and ~SPIDevice().


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