42 #ifdef PX4_SPIDEV_LPS22HB 45 #define DIR_READ (1<<7) 46 #define DIR_WRITE (0<<7) 50 class LPS22HB_SPI :
public device::SPI
53 LPS22HB_SPI(
int bus, uint32_t
device);
54 virtual ~LPS22HB_SPI() =
default;
57 virtual int read(
unsigned address,
void *
data,
unsigned count);
58 virtual int write(
unsigned address,
void *
data,
unsigned count);
65 return new LPS22HB_SPI(bus, PX4_SPIDEV_LPS22HB);
68 LPS22HB_SPI::LPS22HB_SPI(
int bus, uint32_t
device) : SPI(
"LPS22HB_SPI", nullptr, bus, device,
SPIDEV_MODE3, 10000000)
104 if (
sizeof(buf) < (count + 1)) {
109 memcpy(&buf[1], data, count);
111 return transfer(&buf[0], &buf[0], count + 1);
119 if (
sizeof(buf) < (count + 1)) {
125 int ret = transfer(&buf[0], &buf[0], count + 1);
126 memcpy(data, &buf[1], count);
static constexpr uint8_t LPS22HB_ID_WHO_AM_I
#define DRV_BARO_DEVTYPE_LPS22HB
Namespace encapsulating all device framework classes, functions and data.
static void read(bootloader_app_shared_t *pshared)
void init()
Activates/configures the hardware registers.
device::Device * LPS22HB_SPI_interface(int bus)
static void write(bootloader_app_shared_t *pshared)
Fundamental base class for all physical drivers (I2C, SPI).
#define DEVICE_DEBUG(FMT,...)