Monado OpenXR Runtime
Loading...
Searching...
No Matches
esp570.h
Go to the documentation of this file.
1// Copyright 2014-2020, Philipp Zabel
2// Copyright 2017, TheOnlyJoey
3// Copyright 2025, Jan Schmidt
4// Copyright 2025-2026, Beyley Cardellio
5// SPDX-License-Identifier: BSL-1.0
6/*!
7 * @file
8 * @brief Implementation of esp570 sensor initialization
9 * @author Philipp Zabel <philipp.zabel@gmail.com>
10 * @author TheOnlyJoey <joeyferweda@gmail.com>
11 * @author Jan Schmidt <jan@centricular.com>
12 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
13 * @ingroup drv_rift_sensor
14 */
15
16#pragma once
17
18#include "xrt/xrt_defines.h"
19
20#include <libusb.h>
21
22
23/*!
24 * Performs a 16-bit read operation on the I2C bus.
25 *
26 * @param[in] devh libusb device handle
27 * @param[in] addr I2C address
28 * @param[in] reg Register to read from
29 * @param[out] val Value read
30 * @return 0 on success, negative error code on failure
31 */
32int
33esp570_i2c_read(libusb_device_handle *devh, uint8_t addr, uint8_t reg, uint16_t *val);
34
35/*!
36 * Performs a 16-bit write operation on the I2C bus.
37 *
38 * @param[in] devh libusb device handle
39 * @param[in] addr I2C address
40 * @param[in] reg Register to write to
41 * @param[in] val Value to write
42 * @return 0 on success, negative error code on failure
43 */
44int
45esp570_i2c_write(libusb_device_handle *devh, uint8_t addr, uint8_t reg, uint16_t val);
46
47/*!
48 * Reads a buffer from the Microchip 24AA128 EEPROM.
49 *
50 * @param[in] devh libusb device handle
51 * @param[in] addr Address to read from
52 * @param[out] buf Buffer to read into
53 * @param[in] len Number of bytes to read (max 32)
54 * @return 0 on success, negative error code on failure
55 */
56int
57esp570_eeprom_read(libusb_device_handle *devh, uint16_t addr, uint8_t *buf, uint8_t len);
58
59/*!
60 * Calls SET_CUR and GET_CUR on the extension unit's selector 3 with values
61 * captured from the Oculus Windows drivers to setup the device. I have no idea what these mean.
62 *
63 * @param[in] devh libusb device handle
64 * @return 0 on success, negative error code on failure
65 */
66int
67esp570_setup_unknown_3(libusb_device_handle *devh);
int esp570_eeprom_read(libusb_device_handle *devh, uint16_t addr, uint8_t *buf, uint8_t len)
Reads a buffer from the Microchip 24AA128 EEPROM.
Definition esp570.c:63
int esp570_i2c_read(libusb_device_handle *devh, uint8_t addr, uint8_t reg, uint16_t *val)
Performs a 16-bit read operation on the I2C bus.
Definition esp570.c:87
int esp570_setup_unknown_3(libusb_device_handle *devh)
Calls SET_CUR and GET_CUR on the extension unit's selector 3 with values captured from the Oculus Win...
Definition esp570.c:129
int esp570_i2c_write(libusb_device_handle *devh, uint8_t addr, uint8_t reg, uint16_t val)
Performs a 16-bit write operation on the I2C bus.
Definition esp570.c:107
Common defines and enums for XRT.