Skip to content

Commit 5f3d124

Browse files
committed
pbio/drv/usb: Rename plugin wait function.
There isn't a charger on all platforms. This is more of generic waiter for the USB driver to be ready for transmissions.
1 parent 2bc5f87 commit 5f3d124

7 files changed

Lines changed: 10 additions & 10 deletions

File tree

lib/pbio/drv/usb/usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static pbio_error_t pbdrv_usb_process_thread(pbio_os_state_t *state, void *conte
281281
for (;;) {
282282

283283
// Run charger detection: wait for USB to become physically plugged in.
284-
PBIO_OS_AWAIT(state, &sub, err = pbdrv_usb_wait_for_charger(&sub));
284+
PBIO_OS_AWAIT(state, &sub, err = pbdrv_usb_wait_until_configured(&sub));
285285

286286
while (pbdrv_usb_process.request != PBIO_OS_PROCESS_REQUEST_TYPE_CANCEL && pbdrv_usb_is_ready()) {
287287

lib/pbio/drv/usb/usb.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ pbio_error_t pbdrv_usb_tx_response(pbio_os_state_t *state, pbio_pybricks_error_t
9696
pbio_error_t pbdrv_usb_tx_reset(pbio_os_state_t *state);
9797

9898
/**
99-
* Waits for USB to be plugged in and detects what charger type is connected.
99+
* Waits for USB to be plugged. Detects what charger type is connected if
100+
* applicable.
100101
*
101102
* @param [in] state Protothread state.
102103
* @return ::PBIO_SUCCESS on completion.
103104
* ::PBIO_ERROR_AGAIN while awaiting.
104-
* ::PBIO_ERROR_NOT_SUPPORTED if platform has no charger.
105105
*/
106-
pbio_error_t pbdrv_usb_wait_for_charger(pbio_os_state_t *state);
106+
pbio_error_t pbdrv_usb_wait_until_configured(pbio_os_state_t *state);
107107

108108
/**
109109
* Tests if USB is ready for communication.
@@ -136,7 +136,7 @@ static inline pbio_error_t pbdrv_usb_tx_reset(pbio_os_state_t *state) {
136136
return PBIO_ERROR_NOT_IMPLEMENTED;
137137
}
138138

139-
static inline pbio_error_t pbdrv_usb_wait_for_charger(pbio_os_state_t *state) {
139+
static inline pbio_error_t pbdrv_usb_wait_until_configured(pbio_os_state_t *state) {
140140
return PBIO_ERROR_NOT_IMPLEMENTED;
141141
}
142142

lib/pbio/drv/usb/usb_ev3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ void pbdrv_usb_init_device(void) {
988988
USBDevConnect(USB0_BASE);
989989
}
990990

991-
pbio_error_t pbdrv_usb_wait_for_charger(pbio_os_state_t *state) {
991+
pbio_error_t pbdrv_usb_wait_until_configured(pbio_os_state_t *state) {
992992
return PBIO_ERROR_NOT_SUPPORTED;
993993
}
994994

lib/pbio/drv/usb/usb_nxt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ void pbdrv_usb_deinit_device(void) {
837837
pbdrv_usb_nxt_deinit();
838838
}
839839

840-
pbio_error_t pbdrv_usb_wait_for_charger(pbio_os_state_t *state) {
840+
pbio_error_t pbdrv_usb_wait_until_configured(pbio_os_state_t *state) {
841841
PBIO_OS_ASYNC_BEGIN(state);
842842

843843
PBIO_OS_AWAIT_UNTIL(state, pbdrv_usb_nxt_state.status == USB_READY);

lib/pbio/drv/usb/usb_simulation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <string.h>
1818
#include <unistd.h>
1919

20-
pbio_error_t pbdrv_usb_wait_for_charger(pbio_os_state_t *state) {
20+
pbio_error_t pbdrv_usb_wait_until_configured(pbio_os_state_t *state) {
2121
return PBIO_ERROR_NOT_SUPPORTED;
2222
}
2323

lib/pbio/drv/usb/usb_simulation_pico.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
static lwrb_t pbdrv_usb_simulation_pico_in_ringbuf;
2727
static volatile bool pbdrv_usb_simulation_tx_ready;
2828

29-
pbio_error_t pbdrv_usb_wait_for_charger(pbio_os_state_t *state) {
29+
pbio_error_t pbdrv_usb_wait_until_configured(pbio_os_state_t *state) {
3030
return PBIO_ERROR_NOT_SUPPORTED;
3131
}
3232

lib/pbio/drv/usb/usb_stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static pbdrv_usb_bcd_t pbdrv_usb_bcd;
5656
*
5757
* @param [in] pt The protothread.
5858
*/
59-
pbio_error_t pbdrv_usb_wait_for_charger(pbio_os_state_t *state) {
59+
pbio_error_t pbdrv_usb_wait_until_configured(pbio_os_state_t *state) {
6060
static pbio_os_timer_t timer;
6161
USB_OTG_GlobalTypeDef *USBx = hpcd.Instance;
6262

0 commit comments

Comments
 (0)