summaryrefslogtreecommitdiff
path: root/libhw/w5500.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-29 21:03:04 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-29 21:03:04 -0600
commit26361be59c08917c47718bcd4114b8028aaf7810 (patch)
treeb05dfad7baa755da4592a3d47412f1e062560a5e /libhw/w5500.c
parent3c3e9e2c62ad9a83ab9b0e1255204d57894c20ff (diff)
libhw: Tidy
Diffstat (limited to 'libhw/w5500.c')
-rw-r--r--libhw/w5500.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libhw/w5500.c b/libhw/w5500.c
index 0d9cd01..603863a 100644
--- a/libhw/w5500.c
+++ b/libhw/w5500.c
@@ -67,12 +67,15 @@
* SPDX-License-Identifier: MIT
*/
-#include <pico/time.h> /* for sleep_ms() */
+/* TODO: Write a <libhw/generic/gpio.h> to avoid w5500.c being
+ * pico-sdk-specific. */
#include <hardware/gpio.h> /* pico-sdk:hardware_gpio */
#include <libcr/coroutine.h> /* for cr_yield() */
#include <libmisc/vcall.h> /* for VCALL_SELF() */
+#include <libhw/generic/alarmclock.h> /* for sleep_*() */
+
#define IMPLEMENTATION_FOR_LIBHW_W5500_H YES
#include <libhw/w5500.h>
@@ -265,11 +268,10 @@ static inline void w5500_post_reset(struct w5500 *chip) {
}
void w5500_hard_reset(struct w5500 *chip) {
- /* TODO: Replace blocking sleep_ms() with something libcr-friendly. */
gpio_put(chip->pin_reset, 0);
- sleep_ms(1); /* minimum of 500us */
+ sleep_for_ms(1); /* minimum of 500us */
gpio_put(chip->pin_reset, 1);
- sleep_ms(2); /* minimum of 1ms */
+ sleep_for_ms(2); /* minimum of 1ms */
w5500_post_reset(chip);
}