mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-06-18 20:35:57 +02:00
Fix when setting options and taking VIDPID values.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -76,6 +76,11 @@
|
|||||||
#define PHY_OPTS 0x6
|
#define PHY_OPTS 0x6
|
||||||
|
|
||||||
#define PHY_OPT_WCID 0x1
|
#define PHY_OPT_WCID 0x1
|
||||||
|
#define PHY_OPT_VPID 0x2
|
||||||
|
#define PHY_OPT_GPIO 0x4
|
||||||
|
#define PHY_OPT_LED 0x8
|
||||||
|
|
||||||
|
#define PHY_OPT_MASK 0x1
|
||||||
|
|
||||||
#define PHY_MAX_SIZE 8
|
#define PHY_MAX_SIZE 8
|
||||||
|
|
||||||
|
|||||||
@@ -432,8 +432,10 @@ int main(void) {
|
|||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
uint8_t gpio = GPIO_NUM_48;
|
uint8_t gpio = GPIO_NUM_48;
|
||||||
if (file_has_data(ef_phy)) {
|
if (file_has_data(ef_phy)) {
|
||||||
|
if (file_read_uint8_offset(ef_phy, PHY_OPTS + 1) & PHY_OPT_GPIO) {
|
||||||
gpio = file_get_data(ef_phy)[PHY_LED_GPIO];
|
gpio = file_get_data(ef_phy)[PHY_LED_GPIO];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
neopixel = neopixel_Init(1, gpio);
|
neopixel = neopixel_Init(1, gpio);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -169,16 +169,17 @@ void usb_init() {
|
|||||||
uint16_t usb_vid = USB_VID, usb_pid = USB_PID;
|
uint16_t usb_vid = USB_VID, usb_pid = USB_PID;
|
||||||
if (file_has_data(ef_phy)) {
|
if (file_has_data(ef_phy)) {
|
||||||
uint8_t *data = file_get_data(ef_phy);
|
uint8_t *data = file_get_data(ef_phy);
|
||||||
if (file_get_size(ef_phy) >= 4) {
|
uint16_t opts = 0;
|
||||||
usb_vid = (data[PHY_VID] << 8) | data[PHY_VID+1];
|
|
||||||
usb_pid = (data[PHY_PID] << 8) | data[PHY_PID+1];
|
|
||||||
}
|
|
||||||
if (file_get_size(ef_phy) >= 8) {
|
if (file_get_size(ef_phy) >= 8) {
|
||||||
uint16_t opts = (data[PHY_OPTS] << 8) | data[PHY_OPTS+1];
|
opts = (data[PHY_OPTS] << 8) | data[PHY_OPTS+1];
|
||||||
if (opts & PHY_OPT_WCID) {
|
if (opts & PHY_OPT_WCID) {
|
||||||
enable_wcid = true;
|
enable_wcid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (file_get_size(ef_phy) >= 4 && opts & PHY_OPT_VPID) {
|
||||||
|
usb_vid = (data[PHY_VID] << 8) | data[PHY_VID+1];
|
||||||
|
usb_pid = (data[PHY_PID] << 8) | data[PHY_PID+1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
desc_device.idVendor = usb_vid;
|
desc_device.idVendor = usb_vid;
|
||||||
desc_device.idProduct = usb_pid;
|
desc_device.idProduct = usb_pid;
|
||||||
|
|||||||
Reference in New Issue
Block a user