![]() |
TMF8829 Universal Driver 0.1.0
|
Platform callback table (tmf8829_ops_t) for bus, time, and GPIO. More...
#include "tmf8829_types.h"Go to the source code of this file.
Data Structures | |
| struct | tmf8829_ops |
| Set of platform callbacks required by tmf8829_init. More... | |
Typedefs | |
| typedef int(* | tmf8829_read_fn) (tmf8829_driver_t *drv, uint8_t reg, uint8_t *buf, uint16_t len) |
Read len bytes from register reg into buf. | |
| typedef int(* | tmf8829_write_fn) (tmf8829_driver_t *drv, uint8_t reg, const uint8_t *buf, uint16_t len) |
Write len bytes from buf starting at register reg. | |
| typedef void(* | tmf8829_delay_us_fn) (uint32_t us) |
Busy-wait for at least us microseconds (resolution is host-defined). | |
| typedef uint32_t(* | tmf8829_systick_us_fn) (void) |
| Free-running microsecond tick (32-bit wrap allowed; only differences are used). | |
| typedef void(* | tmf8829_write_pin_enable_fn) (tmf8829_driver_t *drv, int high) |
Drive the sensor enable pin: low if high is zero, else high. | |
| typedef int(* | tmf8829_read_pin_int_fn) (tmf8829_driver_t *drv) |
| Optional: read the IRQ GPIO level for this instance. | |
Platform callback table (tmf8829_ops_t) for bus, time, and GPIO.
One table is typically static const and shared by all tmf8829_driver_t instances on the same board.
| typedef void(* tmf8829_delay_us_fn) (uint32_t us) |
Busy-wait for at least us microseconds (resolution is host-defined).
| typedef int(* tmf8829_read_fn) (tmf8829_driver_t *drv, uint8_t reg, uint8_t *buf, uint16_t len) |
Read len bytes from register reg into buf.
Implementations map drv->bus, drv->i2c_addr, and drv->user_ctx to the underlying transfer (e.g. I2C memory read at sub-address reg).
buf to contain only the requested payload bytes, so platform tmf8829_read_fn implementations must consume/discard that first byte. If the platform does not strip it, all register reads will be shifted by one byte (garbage data). Refer to datasheet section 7.11.2 "SPI read transaction" for more details.| [in] | reg | First register address on the device. |
| [out] | buf | Destination buffer. |
| [in] | len | Bytes to read. |
0 on success, negative on failure. | typedef int(* tmf8829_read_pin_int_fn) (tmf8829_driver_t *drv) |
Optional: read the IRQ GPIO level for this instance.
May be NULL if the host polls TMF8829_REG_INT_STATUS only.
1 if the interrupt line is asserted, 0 if deasserted, negative on error. | typedef uint32_t(* tmf8829_systick_us_fn) (void) |
Free-running microsecond tick (32-bit wrap allowed; only differences are used).
| typedef int(* tmf8829_write_fn) (tmf8829_driver_t *drv, uint8_t reg, const uint8_t *buf, uint16_t len) |
Write len bytes from buf starting at register reg.
0 on success, negative on failure. | typedef void(* tmf8829_write_pin_enable_fn) (tmf8829_driver_t *drv, int high) |
Drive the sensor enable pin: low if high is zero, else high.
Pin mux / mode must be configured before tmf8829_init.
May be NULL if the enable pin is permanently tied high in hardware (not controllable via GPIO). When NULL, tmf8829_enable skips the power-on toggle and only polls for CPU readiness, and tmf8829_disable becomes a no-op returning TMF8829_E_NOT_IMPLEMENTED.