blob: 8b3504c4147a95414a02d2042fee4863fd0ce750 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  | 
#include "config.h"
#include <FreeRTOS.h>
#include <task.h>
#include <pico/stdlib.h>
#include <pico/stdio.h>
#include <pico/cyw43_arch.h>
const unsigned int LED_PIN = CYW43_WL_GPIO_LED_PIN;
void blink_task() {
	while (true) {
		cyw43_arch_gpio_put(LED_PIN, 0);
		vTaskDelay(250 / portTICK_PERIOD_MS);
		cyw43_arch_gpio_put(LED_PIN, 1);
		vTaskDelay(250 / portTICK_PERIOD_MS);
	}
}
int main() {
	stdio_init_all();
	sleep_ms(2000);
	if (cyw43_arch_init_with_country(CONF_NET_COUNTRY)) {
		printf("failed to initialize\n");
		return 1;
	}
	cyw43_arch_gpio_put(LED_PIN, 1);
	printf("initialised\n");
	cyw43_arch_enable_sta_mode();
	if (cyw43_arch_wifi_connect_timeout_ms(CONF_NET_SSID, CONF_NET_PASS, CYW43_AUTH_WPA2_AES_PSK, 10000)) {
		printf("failed to connect\n");
		return 1;
	}
	printf("connected\n");
	xTaskCreate((TaskFunction_t) blink_task, "blink", 128, NULL, 1, NULL);
	vTaskStartScheduler();
}
 
  |