-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a picow_blink_fast_clock example (#511)
* Add a picow_blink_fast_clock example We have picow_blink_slow_clock, so we probably need an example of running it faster?
- Loading branch information
1 parent
70222a8
commit 305489f
Showing
3 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (c) 2024 Raspberry Pi (Trading) Ltd. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
#include "pico/stdlib.h" | ||
#include "pico/cyw43_arch.h" | ||
#include "pico/cyw43_driver.h" | ||
#include "hardware/clocks.h" | ||
|
||
int main() { | ||
// Increase sys clock. We have slowed down the cyw43 pio to compensate using CYW43_PIO_CLOCK_DIV_INT=4 CYW43_PIO_CLOCK_DIV_FRAC=0 in the cmake file | ||
// By default the pio used to communicate with cyw43 runs with a clock divisor of 2 | ||
// if you modify the clock you will have to compensate for this | ||
// As an alternative you could specify CYW43_PIO_CLOCK_DIV_DYNAMIC=1 in your cmake file and call cyw43_set_pio_clock_divisor(4, 0) | ||
set_sys_clock_khz(266000, true); | ||
|
||
stdio_init_all(); | ||
if (cyw43_arch_init()) { | ||
printf("Wi-Fi init failed"); | ||
return -1; | ||
} | ||
while (true) { | ||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); | ||
sleep_ms(250); | ||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); | ||
sleep_ms(250); | ||
} | ||
} |