Working WiFi operator.
This commit is contained in:
parent
553345d781
commit
ef0a47827f
|
|
@ -1 +1 @@
|
|||
Subproject commit 6b3d7503bd4da346740a835e464a9bc8399efcd6
|
||||
Subproject commit db81c8ef1bba6bce966b779d1daf011af6c4d59c
|
||||
33
src/main.c
33
src/main.c
|
|
@ -1,5 +1,5 @@
|
|||
#include <pico/stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <pico/cyw43_arch.h>
|
||||
#include "PicoW_WiFi_Operator.h"
|
||||
#include "PicoW_UDP.h"
|
||||
|
||||
|
|
@ -7,7 +7,34 @@ int main(void)
|
|||
{
|
||||
stdio_init_all();
|
||||
|
||||
puts("Hello, World !");
|
||||
if(cyw43_arch_init_with_country(CYW43_COUNTRY_FRANCE)) return PICO_ERROR_GENERIC;
|
||||
|
||||
return 0;
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, true);
|
||||
|
||||
if(wifi_operator_init(WIFI_OPERATOR_MODE_STATION)) return PICO_ERROR_GENERIC;
|
||||
|
||||
while(true)
|
||||
{
|
||||
static uint64_t last_time = 0;
|
||||
uint64_t time = time_us_64();
|
||||
if(time - last_time > 1000 * 1000)
|
||||
{
|
||||
last_time = time;
|
||||
|
||||
static bool led_state = true;
|
||||
led_state = !led_state;
|
||||
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_state);
|
||||
}
|
||||
|
||||
cyw43_arch_poll();
|
||||
|
||||
tight_loop_contents();
|
||||
}
|
||||
|
||||
if(wifi_operator_exit()) return PICO_ERROR_GENERIC;
|
||||
|
||||
cyw43_arch_deinit();
|
||||
|
||||
return PICO_OK;
|
||||
}
|
||||
Loading…
Reference in New Issue