Add Pico 2 W C firmware with Soft-AP and LED blink.

Bring up a minimal cyw43 Soft-AP (powersave disabled) plus USB serial blink example, with Makefile flash/monitor helpers and build ignore.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jimmyandCursor committed 2026-07-20 21:18:17 +12:00
1 parent 47c17dba36
commit b783d97f13
10 files changed
+699 -1

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include "cyw43.h"
#include "lwip/ip_addr.h"
#include "ap.h"
#include "dhcpserver.h"
static dhcp_server_t dhcp_server;
bool ap_start(void) {
cyw43_arch_enable_ap_mode(AP_SSID, AP_PASS, CYW43_AUTH_WPA2_AES_PSK);
cyw43_wifi_pm(&cyw43_state, CYW43_NONE_PM);
ip_addr_t gw, mask;
gw.addr = PP_HTONL(CYW43_DEFAULT_IP_AP_ADDRESS);
mask.addr = PP_HTONL(CYW43_DEFAULT_IP_MASK);
dhcp_server_init(&dhcp_server, &gw, &mask);
printf("AP up: SSID=%s pass=%s ip=%s\n",
AP_SSID, AP_PASS, ipaddr_ntoa(&gw));
return true;
}
+12
View File
@@ -0,0 +1,12 @@
#ifndef AP_H
#define AP_H
#include <stdbool.h>
#define AP_SSID "hoop"
#define AP_PASS "hoop-1234"
// Start soft-AP + DHCP. cyw43_arch_init() must already have succeeded.
bool ap_start(void);
#endif
+35
View File
@@ -0,0 +1,35 @@
#include <stdio.h>
#include "pico/stdlib.h"
// Minimal example: initialize cyw43 and blink its onboard LED.
// (On `pico2_w` the LED lives on the wireless chip, not the main RP pin.)
#include "pico/cyw43_arch.h"
#include "ap.h"
int main() {
stdio_init_all();
sleep_ms(200);
while (cyw43_arch_init()) {
if (stdio_usb_connected()) {
printf("cyw43_arch_init failed; retrying...\n");
}
sleep_ms(1000);
}
printf("LED blink example starting\n");
unsigned int count = 0;
ap_start();
while (true) {
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
if (stdio_usb_connected() || count % 10 == 0) {
printf("count=%u\n", count);
}
count++;
sleep_ms(500);
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
sleep_ms(500);
}
}