picofuse

Macros | Typedefs | Enumerations
deviceio.h File Reference

Abstract device I/O interface. More...

#include <stddef.h>
#include <stdint.h>
Include dependency graph for deviceio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HW_DEVICEIO_CAPACITY   8
 Maximum number of open device I/O handles, across every backend (SPI, I2C, ...) combined.
 
#define HW_DEVICEIO_CONTEXT_SIZE   32
 Size in bytes of the per-handle scratch context space embedded in every hw_deviceio_t, for a backend's own private per-device state.
 

Typedefs

typedef struct hw_deviceio_t hw_deviceio_t
 Opaque device I/O handle.
 

Enumerations

enum  hw_deviceio_bus_t { hw_deviceio_i2c, hw_deviceio_spi }
 Which bus backs a device I/O handle.
 

Functions

Lifecycle
void hw_deviceio_deinit (hw_deviceio_t *device)
 Release a device I/O handle. More...
 
Properties
hw_deviceio_bus_t hw_deviceio_bus (const hw_deviceio_t *device)
 Get which bus backs a device I/O handle. More...
 
Methods
size_t hw_deviceio_xfr (hw_deviceio_t *device, void *data, size_t tx, size_t rx, uint32_t timeout_ms)
 Perform a raw, bidirectional transfer. More...
 
size_t hw_deviceio_read_reg (hw_deviceio_t *device, uint8_t reg, void *data, size_t len, uint32_t timeout_ms)
 Read bytes from a register on a device. More...
 
size_t hw_deviceio_write_reg (hw_deviceio_t *device, uint8_t reg, const void *data, size_t len, uint32_t timeout_ms)
 Write bytes to a register on a device. More...
 

Detailed Description

Abstract device I/O interface.

Definition in file deviceio.h.