Skip to content

Commit

Permalink
Update to PICO-SDK version 1.2.0 (#207)
Browse files Browse the repository at this point in the history
Minor rev to the tinyUSB version used, new ID function.
  • Loading branch information
earlephilhower authored Jun 11, 2021
1 parent bedfbda commit 08b6748
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
24 changes: 9 additions & 15 deletions cores/rp2040/RP2040USB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ static uint8_t *GetDescHIDReport(int *len) {
// Invoked when received GET HID REPORT DESCRIPTOR
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
uint8_t const * tud_hid_descriptor_report_cb(void) {
uint8_t const * tud_hid_descriptor_report_cb(uint8_t instance) {
(void) instance;
return GetDescHIDReport(nullptr);
}

Expand All @@ -177,7 +178,7 @@ const uint8_t *tud_descriptor_configuration_cb(uint8_t index) {
uint8_t hid_itf = __USBInstallSerial ? 2 : 0;
static uint8_t hid_desc[TUD_HID_DESC_LEN] = {
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
TUD_HID_DESCRIPTOR(hid_itf, 0, HID_PROTOCOL_NONE, hid_report_len, EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
TUD_HID_DESCRIPTOR(hid_itf, 0, HID_ITF_PROTOCOL_NONE, hid_report_len, EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
};

uint8_t midi_itf = hid_itf + (hasHID ? 1 : 0);
Expand Down Expand Up @@ -230,15 +231,7 @@ const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
};

if (!idString[0]) {
// Get ID string into human readable serial number on the first pass
pico_unique_board_id_t id;
pico_get_unique_board_id(&id);
idString[0] = 0;
for (auto i = 0; i < PICO_UNIQUE_BOARD_ID_SIZE_BYTES; i++) {
char hx[3];
sprintf(hx, "%02X", id.id[i]);
strcat(idString, hx);
}
pico_get_unique_board_id_string(idString, sizeof(idString));
}

uint8_t len;
Expand Down Expand Up @@ -296,8 +289,9 @@ void __USBStart() {
// Invoked when received GET_REPORT control request
// Application must fill buffer report's content and return its length.
// Return zero will cause the stack to STALL request
uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen) {
// TODO not Implemented
extern "C" uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen) {
// TODO not implemented
(void) instance;
(void) report_id;
(void) report_type;
(void) buffer;
Expand All @@ -308,13 +302,13 @@ uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type,

// Invoked when received SET_REPORT control request or
// received data on OUT endpoint ( Report ID = 0, Type = 0 )
void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) {
extern "C" void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) {
// TODO set LED based on CAPLOCK, NUMLOCK etc...
(void) instance;
(void) report_id;
(void) report_type;
(void) buffer;
(void) bufsize;
}

#endif

2 changes: 1 addition & 1 deletion cores/rp2040/SerialUSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int SerialUSB::peek() {
}

uint8_t c;
return tud_cdc_peek(0, &c) ? (int) c : -1;
return tud_cdc_peek(&c) ? (int) c : -1;
}

int SerialUSB::read() {
Expand Down
Binary file modified lib/libpico.a
Binary file not shown.
6 changes: 3 additions & 3 deletions lib/pico_base/pico/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#define _PICO_VERSION_H

#define PICO_SDK_VERSION_MAJOR 1
#define PICO_SDK_VERSION_MINOR 1
#define PICO_SDK_VERSION_REVISION 2
#define PICO_SDK_VERSION_STRING "1.1.2"
#define PICO_SDK_VERSION_MINOR 2
#define PICO_SDK_VERSION_REVISION 0
#define PICO_SDK_VERSION_STRING "1.2.0"

#endif
2 changes: 1 addition & 1 deletion pico-sdk
Submodule pico-sdk updated 184 files

0 comments on commit 08b6748

Please sign in to comment.