Compare commits

..
14 Commits
Author SHA1 Message Date
Earle F. Philhower, III 34e02aaeb5 Update version 2024-12-02 11:39:24 -08:00
Earle F. Philhower, III 6024e9a7e8 Increase LWIP timeouts to avoid MDNS panics (#2653)
Bump up the LWIP_ARP setting to increase the LWIP timeout pool to
avoid a panic when using SimpleMDNS and TCP clients.

Fixes #2650
2024-11-30 10:43:19 -08:00
Earle F. Philhower, III 633faa18ac Update to Adafruit TinyUSB 3.4.1 (#2647) 2024-11-27 13:04:36 -08:00
Earle F. Philhower, III 90d4841be7 Fix LED pin for Pico 2W (#2646)
Fixes #2644
2024-11-27 12:40:09 -08:00
Linar Yusupov e16c459598 Fix for cyw43_wrappers.h build with C code (#2639) 2024-11-26 00:48:34 -08:00
Earle F. Philhower, III 33b0fd57a0 Fix pinMode for RP2040 PicoW (#2638)
Enable WL_DYNAMIC on the RP2040 lib builds.

Fixes #2637
2024-11-26 00:31:41 -08:00
Earle F. Philhower, III 7add6250e0 Update version 2024-11-25 10:44:58 -08:00
Earle F. Philhower, III 4068601b01 Update to SDK 2.1.0, add Pico 2W (#2629)
Update to Pico SDK 2.1.0, remove XIP and PSRAM workarounds.

Add Pico2W board.
2024-11-25 10:43:55 -08:00
Earle F. Philhower, III 9cea4708c8 Update README.md 2024-11-21 15:31:40 -08:00
Jeff Eplerandladyada 1a41be1eb0 Add Adafruit Floppsy board (#2628)
Co-authored-by: ladyada <limor@ladyada.net>
2024-11-21 15:30:59 -08:00
Earle F. Philhower, III 996c3bfab9 Clean up unused parameter warnings (#2624) 2024-11-19 13:55:00 -08:00
Earle F. Philhower, III 322a1af6da Avoid memory (de)allocation in GPIO ISR handler (#2623)
Replace std::map, which can `new` and `delete` elements of the tree,
with a statically allocated array and housekeeping.

Fixes #2622
2024-11-19 12:26:47 -08:00
Earle F. Philhower, III e25d382732 Support WiFi/BT/BLT with RP2350 CYW43 boards (#2616)
Using pico-sdk develop branch, add in support for CYW43-based
WiFi/BT/BLE boards on the RP2350 such as the
SparkFun Thing Plus RP2350 or the Pimoroni Pico Plus 2W.

Fixes #2608

Rolls in dynamic SPI divider #2600

* Support LED digitalWrite on RP2350+CYW

Also move "special GPIO" to 64 since the Pimoroni Pico 2W uses the
RP2350B with 48 GPIOs.

* Enable CYW43_PIN_WL_DYNAMIC in IDE and P.IO

Allows calling `cyw43_set_pins_wl(cyw43_pin_array);` to redefine the
CYW43 hookup in the variant initialization.
2024-11-19 10:28:12 -08:00
Earle F. Philhower, III bda12cd7e7 WiFiUDP only emit a packet on flush if not ended (#2618)
A flush() on a packet that's already been sent should be a no-op, not
send a 0-byte UDP packet.  Track when an outgoing packet is dirty and
only endPacket()/transmit it when so.

Fixes #2617
2024-11-17 08:58:44 -08:00
86 changed files with 2013 additions and 398 deletions
-6
View File
@@ -29,12 +29,6 @@ jobs:
# add to PATH
echo "$GITHUB_WORKSPACE/system/riscv32-unknown-elf/bin" >> "$GITHUB_PATH"
echo "$GITHUB_WORKSPACE/system/arm-none-eabi/bin" >> "$GITHUB_PATH"
# Needed until we switch to Pico-SDK 2.0.1.
- name: Patch Pico-SDK (Fix Assembly for newer GCC)
run: |
cd pico-sdk
wget https://patch-diff.githubusercontent.com/raw/raspberrypi/pico-sdk/pull/2000.patch
patch -p1 < 2000.patch
- name: Build libpico
run: |
cd tools/libpico
+3
View File
@@ -16,9 +16,11 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* Raspberry Pi Pico
* Raspberry Pi Pico W
* Raspberry Pi Pico 2
* Raspberry Pi Pico 2W
* 0xCB Helios
* Adafruit Feather RP2040
* Adafruit Feather RP2040 SCORPIO
* Adafruit Floppsy RP2040
* Adafruit ItsyBitsy RP2040
* Adafruit KB2040
* Adafruit Macropad RP2040
@@ -72,6 +74,7 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* nullbits Bit-C PRO
* Pimoroni PGA2040
* Pimoroni Pico Plus 2
* Pimoroni Pico Plus 2W
* Pimoroni Plasma2040
* Pimoroni Tiny2040
* Pimoroni Tiny2350
+1081
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -465,7 +465,7 @@ public:
}
bool isPicoW() {
#if !defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if !defined(PICO_CYW43_SUPPORTED)
return false;
#else
extern bool __isPicoW;
+2 -2
View File
@@ -1,5 +1,5 @@
#pragma once
#define ARDUINO_PICO_MAJOR 4
#define ARDUINO_PICO_MINOR 2
#define ARDUINO_PICO_MINOR 3
#define ARDUINO_PICO_REVISION 1
#define ARDUINO_PICO_VERSION_STR "4.2.1"
#define ARDUINO_PICO_VERSION_STR "4.3.1"
+103 -1
View File
@@ -17,7 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
#include <lwip/netif.h>
extern "C" {
@@ -25,6 +25,12 @@ extern "C" {
#include <cyw43_stats.h>
}
#include <pico/cyw43_arch.h>
#include <pico/cyw43_driver.h>
#include <pico/lwip_nosys.h>
#include <hardware/resets.h>
#include <hardware/gpio.h>
#include <hardware/adc.h>
#include <hardware/clocks.h>
#include <Arduino.h>
// From cyw43_ctrl.c
@@ -101,4 +107,100 @@ extern "C" void __wrap_cyw43_cb_tcpip_deinit(cyw43_t *self, int itf) {
(void) itf;
}
#ifndef WIFICC
#define WIFICC CYW43_COUNTRY_WORLDWIDE
#endif
// Taken from https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf
// also discussion in https://github.com/earlephilhower/arduino-pico/issues/849
static bool CheckPicoW() {
#ifdef PICO_RP2040
adc_init();
auto dir = gpio_get_dir(29);
auto fnc = gpio_get_function(29);
adc_gpio_init(29);
adc_select_input(3);
auto adc29 = adc_read();
gpio_set_function(29, fnc);
gpio_set_dir(29, dir);
dir = gpio_get_dir(25);
fnc = gpio_get_function(25);
gpio_init(25);
gpio_set_dir(25, GPIO_IN);
auto gp25 = gpio_get(25);
gpio_set_function(25, fnc);
gpio_set_dir(25, dir);
if (gp25) {
return true; // Can't tell, so assume yes
} else if (adc29 < 200) {
return true; // PicoW
} else {
return false;
}
#else
return true;
#endif
}
bool __isPicoW = true;
extern "C" void init_cyw43_wifi() {
__isPicoW = CheckPicoW();
if (__isPicoW) {
// Fix for overclocked CPU: SPI communication breaks down with default "div by 2" speed
// So, divide clock by 4 for anything including and above 250MHz CPU frequency.
if (clock_get_hz(clk_sys) >= 250000000) {
cyw43_set_pio_clock_divisor(4, 0); // div by 4.0
}
cyw43_arch_init_with_country(WIFICC);
}
}
extern "C" void __lockBluetooth() {
async_context_acquire_lock_blocking(cyw43_arch_async_context());
}
extern "C" void __unlockBluetooth() {
async_context_release_lock(cyw43_arch_async_context());
}
extern "C" void __pinMode(pin_size_t pin, PinMode mode);
extern "C" void __digitalWrite(pin_size_t pin, PinStatus val);
extern "C" PinStatus __digitalRead(pin_size_t pin);
extern "C" void cyw43_pinMode(pin_size_t pin, PinMode mode) {
if (!__isPicoW && (pin == PIN_LED)) {
pin = 25; // Silently swap in the Pico's LED
}
if (pin < 64) {
__pinMode(pin, mode);
} else {
// TBD - There is no GPIO direction control in the driver
}
}
extern "C" void cyw43_digitalWrite(pin_size_t pin, PinStatus val) {
if (!__isPicoW && (pin == PIN_LED)) {
pin = 25; // Silently swap in the Pico's LED
}
if (pin < 64) {
__digitalWrite(pin, val);
} else {
cyw43_arch_gpio_put(pin - 64, val == HIGH ? 1 : 0);
}
}
extern "C" PinStatus cyw43_digitalRead(pin_size_t pin) {
if (!__isPicoW && (pin == PIN_LED)) {
pin = 25; // Silently swap in the Pico's LED
}
if (pin < 64) {
return __digitalRead(pin);
} else {
return cyw43_arch_gpio_get(pin - 64) ? HIGH : LOW;
}
}
#endif
+37
View File
@@ -0,0 +1,37 @@
/*
CYW43 TCP/Ethernet wrappers
Copyright (c) 2023 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include <Arduino.h>
#include <pico/cyw43_driver.h>
extern bool __isPicoW;
#ifdef __cplusplus
extern "C" {
#endif
void init_cyw43_wifi();
void __lockBluetooth();
void __unlockBluetooth();
void cyw43_pinMode(pin_size_t pin, PinMode mode);
void cyw43_digitalWrite(pin_size_t pin, PinStatus val);
PinStatus cyw43_digitalRead(pin_size_t pin);
#ifdef __cplusplus
}
#endif
-95
View File
@@ -1,95 +0,0 @@
/*
Flash wrappers to protect PSRAM access on the RP2350
Copyright (c) 2024 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <Arduino.h>
#include <hardware/flash.h>
#ifdef PICO_RP2350
#include <hardware/structs/qmi.h>
#endif
#if defined(PICO_RP2350) && defined(RP2350_PSRAM_CS)
static void __no_inline_not_in_flash_func(flushcache)() {
// From https://forums.raspberrypi.com/viewtopic.php?t=378249#p2263677
// Perform clean-by-set/way on all lines
for (uint32_t i = 0; i < 2048; ++i) {
// Use the upper 16k of the maintenance space (0x1bffc000 through 0x1bffffff):
*(volatile uint8_t*)(XIP_SRAM_BASE + (XIP_MAINTENANCE_BASE - XIP_BASE) + i * 8u + 0x1u) = 0;
}
}
#elif defined(PICO_RP2350)
static void __no_inline_not_in_flash_func(flushcache)() {
// Null
}
#endif
extern "C" {
extern void __real_flash_range_erase(uint32_t flash_offs, size_t count);
void __wrap_flash_range_erase(uint32_t flash_offs, size_t count) {
#ifdef PICO_RP2350
auto s = qmi_hw->m[1];
flushcache();
#endif
__real_flash_range_erase(flash_offs, count);
#ifdef PICO_RP2350
qmi_hw->m[1] = s;
__compiler_memory_barrier();
#endif
}
extern void __real_flash_range_program(uint32_t flash_offs, const uint8_t *data, size_t count);
void __wrap_flash_range_program(uint32_t flash_offs, const uint8_t *data, size_t count) {
#ifdef PICO_RP2350
auto s = qmi_hw->m[1];
flushcache();
#endif
__real_flash_range_program(flash_offs, data, count);
#ifdef PICO_RP2350
qmi_hw->m[1] = s;
__compiler_memory_barrier();
#endif
}
extern void __real_flash_get_unique_id(uint8_t *id_out);
void __wrap_flash_get_unique_id(uint8_t *id_out) {
#ifdef PICO_RP2350
auto s = qmi_hw->m[1];
flushcache();
#endif
__real_flash_get_unique_id(id_out);
#ifdef PICO_RP2350
qmi_hw->m[1] = s;
__compiler_memory_barrier();
#endif
}
extern void __real_flash_do_cmd(const uint8_t *txbuf, uint8_t *rxbuf, size_t count);
void __wrap_flash_do_cmd(const uint8_t *txbuf, uint8_t *rxbuf, size_t count) {
#ifdef PICO_RP2350
auto s = qmi_hw->m[1];
flushcache();
#endif
__real_flash_do_cmd(txbuf, rxbuf, count);
#ifdef PICO_RP2350
qmi_hw->m[1] = s;
__compiler_memory_barrier();
#endif
}
};
+3 -5
View File
@@ -26,9 +26,7 @@
#include <lwip/dns.h>
#include <lwip/raw.h>
#include <lwip/timeouts.h>
#ifdef PICO_RP2040
#include <pico/cyw43_arch.h>
#endif
#include <pico/mutex.h>
#include <sys/lock.h>
#include "_xoshiro.h"
@@ -46,7 +44,7 @@ public:
if (ethernet_arch_lwip_gpio_mask) {
ethernet_arch_lwip_gpio_mask();
}
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
if (rp2040.isPicoW()) {
cyw43_arch_lwip_begin();
return;
@@ -60,7 +58,7 @@ public:
}
~LWIPMutex() {
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
if (rp2040.isPicoW()) {
cyw43_arch_lwip_end();
} else {
@@ -70,7 +68,7 @@ public:
} else {
recursive_mutex_exit(&__lwipMutex);
}
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
}
#endif
if (ethernet_arch_lwip_gpio_unmask) {
+3
View File
@@ -76,10 +76,13 @@ extern "C" void *pcalloc(size_t count, size_t size) {
#else
// No PSRAM, always fail
extern "C" void *pmalloc(size_t size) {
(void) size;
return nullptr;
}
extern "C" void *pcalloc(size_t count, size_t size) {
(void) count;
(void) size;
return nullptr;
}
#endif
+25 -47
View File
@@ -22,7 +22,6 @@
#include <CoreMutex.h>
#include <hardware/gpio.h>
#include <hardware/sync.h>
#include <map>
#include "_freertos.h"
@@ -59,58 +58,34 @@ extern "C" void noInterrupts() {
}
}
auto_init_mutex(_irqMutex);
static uint64_t _gpioIrqEnabled = 0; // Sized to work with RP2350B, 48 GPIOs
static uint64_t _gpioIrqUseParam;
void *_gpioIrqCB[__GPIOCNT];
void *_gpioIrqCBParam[__GPIOCNT];
// Only 1 GPIO IRQ callback for all pins, so we need to look at the pin it's for and
// dispatch to the real callback manually
auto_init_mutex(_irqMutex);
class CBInfo {
public:
CBInfo(voidFuncPtr cb) : _cb(cb), _useParam(false), _param(nullptr) { };
CBInfo(voidFuncPtrParam cbParam, void *param) : _cbParam(cbParam), _useParam(true), _param(param) { };
void callback() {
if (_useParam && _cbParam) {
_cbParam(_param);
} else if (_cb) {
_cb();
}
}
private:
union {
voidFuncPtr _cb;
voidFuncPtrParam _cbParam;
};
bool _useParam;
void *_param;
};
static std::map<pin_size_t, CBInfo> _map;
void _gpioInterruptDispatcher(uint gpio, uint32_t events) {
(void) events;
// Only need to lock around the std::map check, not the whole IRQ callback
CBInfo *cb;
{
CoreMutex m(&_irqMutex);
if (m) {
auto irq = _map.find(gpio);
if (irq == _map.end()) {
return;
}
cb = &irq->second;
uint64_t mask = 1LL << gpio;
if (_gpioIrqEnabled & mask) {
if (_gpioIrqUseParam & mask) {
voidFuncPtr cb = (voidFuncPtr)_gpioIrqCB[gpio];
cb();
} else {
return;
voidFuncPtrParam cb = (voidFuncPtrParam)_gpioIrqCB[gpio];
cb(_gpioIrqCBParam[gpio]);
}
}
cb->callback();
}
// To be called when appropriately protected w/IRQ and mutex protects
static void _detachInterruptInternal(pin_size_t pin) {
auto irq = _map.find(pin);
if (irq != _map.end()) {
uint64_t mask = 1LL << pin;
if (_gpioIrqEnabled & mask) {
gpio_set_irq_enabled(pin, 0x0f /* all */, false);
_map.erase(pin);
_gpioIrqEnabled &= ~mask;
}
}
@@ -119,7 +94,7 @@ extern "C" void attachInterrupt(pin_size_t pin, voidFuncPtr callback, PinStatus
if (!m) {
return;
}
uint64_t mask = 1LL << pin;
uint32_t events;
switch (mode) {
case LOW: events = 1; break;
@@ -131,8 +106,9 @@ extern "C" void attachInterrupt(pin_size_t pin, voidFuncPtr callback, PinStatus
}
noInterrupts();
_detachInterruptInternal(pin);
CBInfo cb(callback);
_map.insert({pin, cb});
_gpioIrqEnabled |= mask;
_gpioIrqUseParam &= ~mask; // No parameter
_gpioIrqCB[pin] = (void *)callback;
gpio_set_irq_enabled_with_callback(pin, events, true, _gpioInterruptDispatcher);
interrupts();
}
@@ -142,7 +118,7 @@ void attachInterruptParam(pin_size_t pin, voidFuncPtrParam callback, PinStatus m
if (!m) {
return;
}
uint64_t mask = 1LL << pin;
uint32_t events;
switch (mode) {
case LOW: events = 1; break;
@@ -154,8 +130,10 @@ void attachInterruptParam(pin_size_t pin, voidFuncPtrParam callback, PinStatus m
}
noInterrupts();
_detachInterruptInternal(pin);
CBInfo cb(callback, param);
_map.insert({pin, cb});
_gpioIrqEnabled |= mask;
_gpioIrqUseParam &= ~mask; // No parameter
_gpioIrqCB[pin] = (void *)callback;
_gpioIrqCBParam[pin] = param;
gpio_set_irq_enabled_with_callback(pin, events, true, _gpioInterruptDispatcher);
interrupts();
}
+2 -2
View File
@@ -54,9 +54,9 @@ author = u'Earle F. Philhower, III'
# built documents.
#
# The short X.Y version.
version = u'4.2.1'
version = u'4.3.1'
# The full version, including alpha/beta/rc tags.
release = u'4.2.1'
release = u'4.3.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
+1 -2
View File
@@ -29,9 +29,8 @@ extern unsigned long __lwip_rand(void);
#define MEM_SIZE (__LWIP_MEMMULT * 16384)
#define MEMP_NUM_TCP_SEG (32)
#define MEMP_NUM_ARP_QUEUE (10)
//#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 4)
#define PBUF_POOL_SIZE (__LWIP_MEMMULT > 1 ? 32 : 24)
#define LWIP_ARP 5
#define LWIP_ARP 7
#define LWIP_ETHERNET 1
#define LWIP_ICMP 1
#define LWIP_RAW 1
+2 -2
View File
@@ -12,8 +12,8 @@
#define _PICO_VERSION_H
#define PICO_SDK_VERSION_MAJOR 2
#define PICO_SDK_VERSION_MINOR 0
#define PICO_SDK_VERSION_MINOR 1
#define PICO_SDK_VERSION_REVISION 0
#define PICO_SDK_VERSION_STRING "2.0.0"
#define PICO_SDK_VERSION_STRING "2.1.0"
#endif
+2 -2
View File
@@ -12,8 +12,8 @@
#define _PICO_VERSION_H
#define PICO_SDK_VERSION_MAJOR 2
#define PICO_SDK_VERSION_MINOR 0
#define PICO_SDK_VERSION_MINOR 1
#define PICO_SDK_VERSION_REVISION 0
#define PICO_SDK_VERSION_STRING "2.0.0"
#define PICO_SDK_VERSION_STRING "2.1.0"
#endif
+2
View File
@@ -15,6 +15,7 @@
-iwithprefixbefore/pico-sdk/src/common/pico_util/include
-iwithprefixbefore/pico-sdk/src/common/pico_stdlib_headers/include
-iwithprefixbefore/pico-sdk/src/common/pico_usb_reset_interface_headers/include
-iwithprefixbefore/pico-sdk/src/rp2_common/boot_bootrom_headers/include
-iwithprefixbefore/pico-sdk/src/rp2_common/cmsis/include
-iwithprefixbefore/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_adc/include
@@ -47,6 +48,7 @@
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_bootrom/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_double/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_flash/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_float/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_int64_ops/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_lwip/include
-5
View File
@@ -67,8 +67,3 @@
-Wl,--wrap=cyw43_tcpip_link_status
-Wl,--wrap=cyw43_cb_tcpip_init
-Wl,--wrap=cyw43_cb_tcpip_deinit
-Wl,--wrap=flash_range_erase
-Wl,--wrap=flash_range_program
-Wl,--wrap=flash_get_unique_id
-Wl,--wrap=flash_do_cmd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -1,5 +1,6 @@
-DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1
-DCYW43_LWIP=1
-DCYW43_PIO_CLOCK_DIV_DYNAMIC=1
-DCFG_TUSB_MCU=OPT_MCU_RP2040
-DARM_MATH_CM0_FAMILY
-DARM_MATH_CM0_PLUS
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
source [find interface/cmsis-dap.cfg]
adapter speed 5000
source [find target/rp2350-riscv.cfg]
+3
View File
@@ -1,3 +1,6 @@
-DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1
-DCYW43_LWIP=1
-DCYW43_PIO_CLOCK_DIV_DYNAMIC=1
-DCFG_TUSB_MCU=OPT_MCU_RP2040
-DCFG_TUSB_OS=OPT_OS_PICO
-DLIB_BOOT_STAGE2_HEADERS=1
+8
View File
@@ -8,3 +8,11 @@
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_hazard3/include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_sha256/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_sha256/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_btstack/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_cyw43_arch/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_cyw43_driver/include
-iwithprefixbefore/pico-sdk/lib/cyw43-driver/src
-iwithprefixbefore/pico-sdk/lib/btstack/src
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/decoder/include
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/encoder/include
-iwithprefixbefore/pico-sdk/lib/btstack/platform/embedded
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -1,3 +1,6 @@
-DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1
-DCYW43_LWIP=1
-DCYW43_PIO_CLOCK_DIV_DYNAMIC=1
-DCFG_TUSB_MCU=OPT_MCU_RP2040
-DCFG_TUSB_OS=OPT_OS_PICO
-DLIB_BOOT_STAGE2_HEADERS=1
+8
View File
@@ -6,3 +6,11 @@
-iwithprefixbefore/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RP2350/Include
-iwithprefixbefore/pico-sdk/src/rp2_common/hardware_sha256/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_sha256/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_btstack/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_cyw43_arch/include
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_cyw43_driver/include
-iwithprefixbefore/pico-sdk/lib/cyw43-driver/src
-iwithprefixbefore/pico-sdk/lib/btstack/src
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/decoder/include
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/encoder/include
-iwithprefixbefore/pico-sdk/lib/btstack/platform/embedded
@@ -53,7 +53,7 @@ void setup() {
TaskHandle_t blinkTask;
Serial.begin(115200);
xTaskCreate(blink, "BLINK", 256, nullptr, 1, &blinkTask);
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
// The PicoW WiFi chip controls the LED, and only core 0 can make calls to it safely
vTaskCoreAffinitySet(blinkTask, 1 << 0);
#endif
@@ -47,12 +47,12 @@ void setup() {
xSemaphore = xSemaphoreCreateMutexStatic( &xMutexBuffer );
ledOnTask = xTaskCreateStatic(led_ON, "led_ON", STACK_SIZE, NULL, configMAX_PRIORITIES - 1, xStack_A, &xTaskBuffer_A);
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
// The PicoW WiFi chip controls the LED, and only core 0 can make calls to it safely
vTaskCoreAffinitySet(ledOnTask, 1 << 0);
#endif
ledOffTask = xTaskCreateStatic(led_OFF, "led_OFF", STACK_SIZE, NULL, configMAX_PRIORITIES - 1, xStack_B, &xTaskBuffer_B);
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
// The PicoW WiFi chip controls the LED, and only core 0 can make calls to it safely
vTaskCoreAffinitySet(ledOffTask, 1 << 0);
#endif
+5 -5
View File
@@ -29,7 +29,7 @@
// This is the real WiFi network object, we just tickle it to do our magic
#include <LwipEthernet.h>
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
#include <pico/cyw43_arch.h>
static CYW43lwIP _wifi(1);
#elif defined(ESPHOSTSPI)
@@ -204,7 +204,7 @@ uint8_t WiFiClass::beginAP(const char *ssid, const char* passphrase) {
return WL_CONNECTED;
}
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
uint8_t WiFiClass::softAPgetStationNum() {
if (!_apMode || !_wifiHWInitted) {
return 0;
@@ -324,7 +324,7 @@ void WiFiClass::end(void) {
return: pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
*/
uint8_t* WiFiClass::macAddress(uint8_t* mac) {
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
if (!_wifiHWInitted) {
_apMode = false;
cyw43_wifi_set_up(&cyw43_state, _apMode ? 1 : 0, true, CYW43_COUNTRY_WORLDWIDE);
@@ -423,7 +423,7 @@ uint8_t WiFiClass::encryptionType() {
int8_t WiFiClass::scanNetworks(bool async) {
if (!_wifiHWInitted) {
_apMode = false;
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
cyw43_arch_enable_sta_mode();
#endif
_wifiHWInitted = true;
@@ -519,7 +519,7 @@ unsigned long WiFiClass::getTime() {
return millis();
}
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
void WiFiClass::aggressiveLowPowerMode() {
cyw43_wifi_pm(&cyw43_state, CYW43_AGGRESSIVE_PM);
}
+3 -3
View File
@@ -23,7 +23,7 @@
#pragma once
#include <Arduino.h>
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
#include <lwIP_CYW43.h>
#elif defined(ESPHOSTSPI)
#include <lwIP_ESPHost.h>
@@ -158,7 +158,7 @@ public:
return true;
}
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
uint8_t softAPgetStationNum();
#endif
@@ -405,7 +405,7 @@ public:
unsigned long getTime();
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
#if defined(PICO_CYW43_SUPPORTED)
void aggressiveLowPowerMode();
void defaultLowPowerMode();
#endif
+9 -3
View File
@@ -38,7 +38,7 @@ template<>
WiFiUDP* SList<WiFiUDP>::_s_first = 0;
/* Constructor */
WiFiUDP::WiFiUDP() : _ctx(0), _multicast(false) {
WiFiUDP::WiFiUDP() : _ctx(0), _multicast(false), _dirty(false) {
WiFiUDP::_add(this);
}
@@ -49,6 +49,7 @@ WiFiUDP::WiFiUDP(const WiFiUDP& other) {
}
WiFiUDP::_add(this);
_multicast = other._multicast;
_dirty = other._dirty;
}
WiFiUDP& WiFiUDP::operator=(const WiFiUDP& rhs) {
@@ -149,6 +150,7 @@ int WiFiUDP::beginPacket(IPAddress ip, uint16_t port) {
_ctx->setMulticastInterface(IP_ADDR_ANY);
_ctx->setMulticastTTL(255);
}
_dirty = false;
return ret;
}
@@ -164,6 +166,7 @@ int WiFiUDP::beginPacketMulticast(IPAddress multicastAddress, uint16_t port,
}
_ctx->setMulticastInterface(interfaceAddress);
_ctx->setMulticastTTL(ttl);
_dirty = false;
return 1;
}
@@ -171,6 +174,7 @@ int WiFiUDP::endPacket() {
if (!_ctx) {
return 0;
}
_dirty = false;
return (_ctx->send()) ? 1 : 0;
}
@@ -183,7 +187,7 @@ size_t WiFiUDP::write(const uint8_t *buffer, size_t size) {
if (!_ctx) {
return 0;
}
_dirty = true;
return _ctx->append(reinterpret_cast<const char*>(buffer), size);
}
@@ -224,7 +228,9 @@ int WiFiUDP::peek() {
}
void WiFiUDP::flush() {
endPacket();
if (_dirty) {
endPacket();
}
}
IPAddress WiFiUDP::remoteIP() {
+1
View File
@@ -115,4 +115,5 @@ public:
private:
bool _multicast;
bool _dirty;
};
+5 -5
View File
@@ -22,7 +22,7 @@
#include <lwip/timeouts.h>
#include <lwip/dns.h>
#include <pico/mutex.h>
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
#include <pico/cyw43_arch.h>
#endif
#include <pico/async_context_threadsafe_background.h>
@@ -41,7 +41,7 @@ static async_context_t *_context = nullptr;
static std::map<int, std::function<void(void)>> _handlePacketList;
void ethernet_arch_lwip_begin() {
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
if (rp2040.isPicoW()) {
cyw43_arch_lwip_begin();
return;
@@ -51,7 +51,7 @@ void ethernet_arch_lwip_begin() {
}
void ethernet_arch_lwip_end() {
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
if (rp2040.isPicoW()) {
cyw43_arch_lwip_end();
return;
@@ -187,7 +187,7 @@ static void ethernet_timeout_reached(__unused async_context_t *context, __unused
for (auto handlePacket : _handlePacketList) {
handlePacket.second();
}
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
if (!rp2040.isPicoW()) {
sys_check_timeouts();
}
@@ -207,7 +207,7 @@ void __startEthernetContext() {
if (__ethernetContextInitted) {
return;
}
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#if defined(PICO_CYW43_SUPPORTED)
if (rp2040.isPicoW()) {
_context = cyw43_arch_async_context();
} else {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "framework-arduinopico",
"version": "1.40201.0",
"version": "1.40301.0",
"description": "Arduino Wiring-based Framework (RPi Pico RP2040, RP2350)",
"keywords": [
"framework",
+9
View File
@@ -26,6 +26,9 @@
{
"name": "Raspberry Pi Pico 2"
},
{
"name": "Raspberry Pi Pico 2W"
},
{
"name": "0xCB Helios"
},
@@ -80,6 +83,9 @@
{
"name": "Adafruit Feather RP2350 HSTX"
},
{
"name": "Adafruit Floppsy"
},
{
"name": "Amken BunnyBoard"
},
@@ -233,6 +239,9 @@
{
"name": "Pimoroni PicoPlus2"
},
{
"name": "Pimoroni PicoPlus2W"
},
{
"name": "Pimoroni Plasma2040"
},
+1 -1
View File
@@ -20,7 +20,7 @@
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Raspberry Pi RP2040/RP2350 Boards
version=4.2.1
version=4.3.1
# Required discoveries and monitors
# ---------------------------------
+55
View File
@@ -0,0 +1,55 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x239A",
"usb_pid": "0x8151"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-DARDUINO_ADAFRUIT_FLOPPSY_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x239A",
"0x8151"
]
],
"mcu": "rp2040",
"variant": "adafruit_floppsy"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Floppsy",
"upload": {
"maximum_ram_size": 262144,
"maximum_size": 16777216,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "Adafruit"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "none.S",
"usb_vid": "0x2E8A",
"usb_pid": "0x100A"
}
},
"core": "earlephilhower",
"cpu": "cortex-m33",
"extra_flags": "-DARDUINO_PIMORONI_PICO_PLUS_2W -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
"f_cpu": "150000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0x100A"
]
],
"mcu": "rp2350",
"variant": "pimoroni_pico_plus_2w"
},
"debug": {
"jlink_device": "RP2350_0",
"openocd_target": "rp2350.cfg",
"svd_path": "rp2350.svd"
},
"frameworks": [
"arduino"
],
"name": "PicoPlus2W",
"upload": {
"maximum_ram_size": 524288,
"maximum_size": 16777216,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
],
"psram_length": 8388608
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "Pimoroni"
}
+55
View File
@@ -0,0 +1,55 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "none.S",
"usb_vid": "0x2E8A",
"usb_pid": "0xF00F"
}
},
"core": "earlephilhower",
"cpu": "cortex-m33",
"extra_flags": "-DARDUINO_RASPBERRY_PI_PICO_2W -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
"f_cpu": "150000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0xF00F"
]
],
"mcu": "rp2350",
"variant": "rpipico2w"
},
"debug": {
"jlink_device": "RP2350_0",
"openocd_target": "rp2350.cfg",
"svd_path": "rp2350.svd"
},
"frameworks": [
"arduino"
],
"name": "Pico 2W",
"upload": {
"maximum_ram_size": 524288,
"maximum_size": 4194304,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "Raspberry Pi"
}
+1 -1
View File
@@ -9,7 +9,7 @@
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-DARDUINO_RASPBERRY_PI_PICO_W -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
"extra_flags": "-DARDUINO_RASPBERRY_PI_PICO_W -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
"f_cpu": "133000000L",
"hwids": [
[
+1 -1
View File
@@ -9,7 +9,7 @@
},
"core": "earlephilhower",
"cpu": "cortex-m33",
"extra_flags": "-DARDUINO_SPARKFUN_THINGPLUS_RP2350 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
"extra_flags": "-DARDUINO_SPARKFUN_THINGPLUS_RP2350 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
"f_cpu": "150000000L",
"hwids": [
[
+69 -79
View File
@@ -3,20 +3,18 @@ cmake_minimum_required(VERSION 3.12)
set(cpu $ENV{CPU})
message("Building for CPU ${cpu}")
set(PICO_CYW43_SUPPORTED 1)
if (${cpu} MATCHES "rp2040")
# Enable PicoW driver support. Compatible with standard Pico
set(PICO_BOARD pico_w)
set(PICO_PLATFORM rp2040)
set(PICO_CYW43_SUPPORTED 1)
elseif(${cpu} MATCHES "rp2350$")
set(PICO_BOARD solderparty_rp2350_stamp_xl) # Pico2 sets to RP2350A which disables all code for RP2350B
set(PICO_PLATFORM rp2350)
set(PICO_CYW43_SUPPORTED 0)
elseif(${cpu} MATCHES "rp2350-riscv$")
message(INFO "Building RISCV")
set(PICO_BOARD solderparty_rp2350_stamp_xl) # Pico2 sets to RP2350A which disables all code for RP2350B
set(PICO_PLATFORM rp2350-riscv)
set(PICO_CYW43_SUPPORTED 0)
else()
message(FATAL_ERROR "Unknown CPU, '${cpu}'")
endif()
@@ -50,13 +48,10 @@ if (${cpu} MATCHES "rp2040")
PICO_RP2040_B0_SUPPORTED=1
PICO_RP2040_B1_SUPPORTED=1
PICO_RP2040_B2_SUPPORTED=1
PICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1
CYW43_WARN=//
PICO_XOSC_STARTUP_DELAY_MULTIPLIER=64
PICO_FLOAT_SUPPORT_ROM_V1=1
PICO_DOUBLE_SUPPORT_ROM_V1=1
PICO_RP2040=1
PICO_CYW43_SUPPORTED=1)
PICO_RP2040=1)
elseif (${cpu} MATCHES "rp2350")
set(xcd
CFG_TUSB_DEBUG=0
@@ -110,19 +105,20 @@ elseif (${cpu} MATCHES "rp2350")
PICO_RP2040_USB_DEVICE_UFRAME_FIX=1
PICO_RP2350=1
PICO_USE_BLOCKED_RAM=0
${xcda})
endif()
if (${cpu} MATCHES "rp2040")
set(ppp PICO_PLATFORM=rp2040)
elseif(${cpu} MATCHES "rp2350$")
set(ppp PICO_PLATFORM=rp2350)
elseif(${cpu} MATCHES "rp2350-riscv$")
set(ppp PICO_PLATFORM=rp2350-riscv)
CYW43_DEFAULT_PIN_WL_REG_ON=23u
CYW43_DEFAULT_PIN_WL_DATA_OUT=24u
CYW43_DEFAULT_PIN_WL_DATA_IN=24u
CYW43_DEFAULT_PIN_WL_HOST_WAKE=24u
CYW43_DEFAULT_PIN_WL_CLOCK=29u
CYW43_DEFAULT_PIN_WL_CS=25u
${xcda})
endif()
# Use a longer XOSC startup time, to accommodate Adafruit and other boards that may need it.
target_compile_definitions(common-${cpu} INTERFACE
PICO_PLATFORM=${PICO_PLATFORM}
PICO_PRINTF_ALWAYS_INCLUDED=1
PICO_FLASH_SIZE_BYTES=16777216
PICO_NO_BINARY_INFO=1
@@ -130,11 +126,14 @@ target_compile_definitions(common-${cpu} INTERFACE
LWIP_UDP=1
LWIP_IGMP=1
LWIP_CHECKSUM_CTRL_PER_NETIF=1
PICO_CYW43_SUPPORTED=1
PICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1
CYW43_WARN=//
CYW43_PIO_CLOCK_DIV_DYNAMIC=1
CYW43_PIN_WL_DYNAMIC=1
${xcd}
${ppp}
)
target_compile_options(common-${cpu} INTERFACE
-fno-exceptions
-Os
@@ -147,12 +146,6 @@ add_library(pico-${cpu} STATIC)
target_compile_definitions(pico-${cpu} PUBLIC
LWIP_IPV6=0
)
if (${cpu} MATCHES "rp2040")
set(xll1)
elseif(${cpu} MATCHES "rp2350")
set(xll1
pico_sha256)
endif()
target_link_libraries(pico-${cpu}
common-${cpu}
@@ -203,10 +196,15 @@ target_link_libraries(pico-${cpu}
pico_stdlib
pico_unique_id
pico_util
${xll1}
tinyusb
tinyusb_device_unmarked
)
if (${cpu} MATCHES "rp2350")
# RP2350-only peripherals
target_link_libraries(pico-${cpu}
hardware_xip_cache
pico_sha256)
endif()
add_library(ipv4-${cpu} STATIC)
target_compile_definitions(ipv4-${cpu} PUBLIC
@@ -219,16 +217,15 @@ target_compile_definitions(ipv4-big-${cpu} PUBLIC
LWIP_IPV6=0
)
if (${cpu} MATCHES "rp2040")
set(xll pico_cyw43_driver cyw43_driver cyw43_driver_picow pico_cyw43_driver pico_cyw43_arch pico_cyw43_arch_threadsafe_background)
elseif(${cpu} MATCHES "rp2350")
set(xll)
endif()
set(picow_link_libraries
common-${cpu}
cyw43_driver
cyw43_driver_picow
pico_async_context
pico_async_context_threadsafe_background
${xll}
pico_cyw43_driver
pico_cyw43_arch
pico_cyw43_arch_threadsafe_background
pico_lwip
pico_lwip_nosys
pico_lwip_sntp
@@ -263,64 +260,57 @@ target_link_libraries(ipv4-ipv6-big-${cpu}
${picow_link_libraries}
)
if(${cpu} MATCHES "rp2040")
add_library(ipv4-bt-${cpu} STATIC)
target_compile_definitions(ipv4-bt-${cpu} PUBLIC
LWIP_IPV6=0
)
add_library(ipv4-bt-${cpu} STATIC)
target_compile_definitions(ipv4-bt-${cpu} PUBLIC
LWIP_IPV6=0
)
add_library(ipv4-bt-big-${cpu} STATIC)
target_compile_definitions(ipv4-bt-${cpu} PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=0
)
add_library(ipv4-bt-big-${cpu} STATIC)
target_compile_definitions(ipv4-bt-${cpu} PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=0
)
set(picow_bt_link_libraries
pico_btstack_cyw43
pico_btstack_ble
pico_btstack_classic
pico_btstack_sbc_encoder
pico_btstack_sbc_decoder
)
set(picow_bt_link_libraries
pico_btstack_cyw43
pico_btstack_ble
pico_btstack_classic
pico_btstack_sbc_encoder
pico_btstack_sbc_decoder
)
target_link_libraries(ipv4-bt-${cpu}
${picow_link_libraries}
${picow_bt_link_libraries}
)
target_link_libraries(ipv4-bt-${cpu}
${picow_link_libraries}
${picow_bt_link_libraries}
)
target_link_libraries(ipv4-bt-big-${cpu}
${picow_link_libraries}
${picow_bt_link_libraries}
)
target_link_libraries(ipv4-bt-big-${cpu}
${picow_link_libraries}
${picow_bt_link_libraries}
)
add_library(ipv4-ipv6-bt-${cpu} STATIC)
target_compile_definitions(ipv4-ipv6-bt-${cpu} PUBLIC
LWIP_IPV6=1
)
add_library(ipv4-ipv6-bt-${cpu} STATIC)
target_compile_definitions(ipv4-ipv6-bt-${cpu} PUBLIC
LWIP_IPV6=1
)
add_library(ipv4-ipv6-bt-big-${cpu} STATIC)
target_compile_definitions(ipv4-ipv6-bt-big-${cpu} PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=1
)
add_library(ipv4-ipv6-bt-big-${cpu} STATIC)
target_compile_definitions(ipv4-ipv6-bt-big-${cpu} PUBLIC
__LWIP_MEMMULT=2
LWIP_IPV6=1
)
target_link_libraries(ipv4-ipv6-bt-${cpu}
${picow_link_libraries}
${picow_bt_link_libraries}
)
target_link_libraries(ipv4-ipv6-bt-${cpu}
${picow_link_libraries}
${picow_bt_link_libraries}
)
target_link_libraries(ipv4-ipv6-bt-big-${cpu}
${picow_link_libraries}
${picow_bt_link_libraries}
)
endif()
target_link_libraries(ipv4-ipv6-bt-big-${cpu}
${picow_link_libraries}
${picow_bt_link_libraries}
)
if(${cpu} MATCHES "rp2040")
set(tx ipv4-bt ipv4-ipv6-bt ipv4-bt-big ipv4-ipv6-bt-big)
elseif(${cpu} MATCHES "rp2350")
set(tx)
endif()
foreach(tgt pico ipv4 ipv4-ipv6 ipv4-big ipv4-ipv6-big ${tx})
foreach(tgt pico ipv4 ipv4-ipv6 ipv4-big ipv4-ipv6-big ipv4-bt ipv4-ipv6-bt ipv4-bt-big ipv4-ipv6-bt-big)
add_custom_command(TARGET ${tgt}-${cpu} POST_BUILD
COMMAND ar d lib${tgt}-${cpu}.a stdio.c.obj stdio_uart.c.obj stdio_usb.c.obj stdio_usb_descriptors.c.obj pico_malloc.c.obj newlib_interface.c.obj
COMMAND ar d lib${tgt}-${cpu}.a btstack_flash_bank.c.obj # Need to override with our own implementation
+1 -1
View File
@@ -30,7 +30,7 @@ extern unsigned long __lwip_rand(void);
#define MEMP_NUM_TCP_SEG (32)
#define MEMP_NUM_ARP_QUEUE (10)
#define PBUF_POOL_SIZE (__LWIP_MEMMULT > 1 ? 32 : 24)
#define LWIP_ARP 5
#define LWIP_ARP 7
#define LWIP_ETHERNET 1
#define LWIP_ICMP 1
#define LWIP_RAW 1
+1
View File
@@ -6,6 +6,7 @@ set -x
export PICO_SDK_PATH="$(cd ../../pico-sdk/; pwd)"
export PATH="$(cd ../../system/arm-none-eabi/bin; pwd):$PATH"
export PATH="$(cd ../../system/riscv32-unknown-elf/bin; pwd):$PATH"
export PATH="$(cd ../../system/picotool; pwd):$PATH"
rm -rf build-rp2040
mkdir build-rp2040
+7 -5
View File
@@ -358,7 +358,7 @@ def MakeBoard(name, chip, vendor_name, product_name, vid, pid, pwr, boarddefine,
BuildDebugPort(name)
BuildDebugLevel(name)
BuildUSBStack(name)
if name == "rpipicow":
if name in ["rpipicow", "pimoroni_pico_plus_2w", "sparkfun_thingplusrp2350"]:
BuildCountry(name)
BuildIPBTStack(name)
if name == "generic":
@@ -476,8 +476,9 @@ BuildGlobalMenuList()
# Raspberry Pi
MakeBoard("rpipico", "rp2040", "Raspberry Pi", "Pico", "0x2e8a", "0x000a", 250, "RASPBERRY_PI_PICO", 2, 0, "boot2_w25q080_2_padded_checksum")
MakeBoard("rpipicow", "rp2040", "Raspberry Pi", "Pico W", "0x2e8a", "0xf00a", 250, "RASPBERRY_PI_PICO_W", 2, 0, "boot2_w25q080_2_padded_checksum")
MakeBoard("rpipicow", "rp2040", "Raspberry Pi", "Pico W", "0x2e8a", "0xf00a", 250, "RASPBERRY_PI_PICO_W", 2, 0, "boot2_w25q080_2_padded_checksum", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
MakeBoard("rpipico2", "rp2350", "Raspberry Pi", "Pico 2", "0x2e8a", "0x000f", 250, "RASPBERRY_PI_PICO_2", 4, 0, "none")
MakeBoard("rpipico2w", "rp2350", "Raspberry Pi", "Pico 2W", "0x2e8a", "0xf00f", 250, "RASPBERRY_PI_PICO_2W", 4, 0, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
# 0xCB
MakeBoard("0xcb_helios", "rp2040", "0xCB", "Helios", "0x1209", "0xCB74", 500, "0XCB_HELIOS", 16, 0, "boot2_w25q128jvxq_4_padded_checksum")
@@ -500,7 +501,7 @@ MakeBoard("adafruit_trinkeyrp2040qt", "rp2040", "Adafruit", "Trinkey RP2040 QT",
MakeBoard("adafruit_macropad2040", "rp2040", "Adafruit", "MacroPad RP2040", "0x239a", "0x8107", 250, "ADAFRUIT_MACROPAD_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
MakeBoard("adafruit_kb2040", "rp2040", "Adafruit", "KB2040", "0x239a", "0x8105", 250, "ADAFRUIT_KB2040_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
MakeBoard("adafruit_feather_rp2350_hstx", "rp2350", "Adafruit", "Feather RP2350 HSTX", "0x239a", "0x814f", 250, "ADAFRUIT_FEATHER_RP2350_HSTX", 8, 0, "none")
MakeBoard("adafruit_floppsy", "rp2040", "Adafruit", "Floppsy", "0x239a", "0x8151", 250, "ADAFRUIT_FLOPPSY_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
#Amken
MakeBoard("amken_bunny", "rp2040","Amken","BunnyBoard","0x2770",["0x7303"],250,"AMKEN_BB",128,0,"boot2_w25q128jvxq_4_padded_checksum","","https://www.amken3d.com")
@@ -600,11 +601,12 @@ MakeBoard("olimex_rp2040pico30_16mb", "rp2040", "Olimex", "RP2040-Pico30 16MB",
MakeBoard("pimoroni_pga2040", "rp2040", "Pimoroni", "PGA2040", "0x2e8a", "0x1008", 250, "PIMORONI_PGA2040", 8, 0, "boot2_w25q64jv_4_padded_checksum")
MakeBoard("pimoroni_pga2350", "rp2350", "Pimoroni", "PGA2350", "0x2e8a", "0x1018", 250, "PIMORONI_PGA2350", 16, 8, "none")
MakeBoard("pimoroni_pico_plus_2", "rp2350", "Pimoroni", "PicoPlus2", "0x2e8a", "0x100a", 500, "PIMORONI_PICO_PLUS_2", 16, 8, "none")
MakeBoard("pimoroni_pico_plus_2w", "rp2350", "Pimoroni", "PicoPlus2W", "0x2e8a", "0x100a", 500, "PIMORONI_PICO_PLUS_2W", 16, 8, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
MakeBoard("pimoroni_plasma2040", "rp2040", "Pimoroni", "Plasma2040", "0x2e8a", "0x100a", 500, "PIMORONI_PLASMA2040", 2, 0, "boot2_w25q080_2_padded_checksum")
MakeBoard("pimoroni_tiny2040", "rp2040", "Pimoroni", "Tiny2040", "0x2e8a", "0x100a", 500, "PIMORONI_TINY2040", 2, 0, "boot2_w25q64jv_4_padded_checksum")
MakeBoard("pimoroni_tiny2350", "rp2350", "Pimoroni", "Tiny2350", "0x2e8a", "0x100b", 500, "PIMORONI_TINY2350", 4, 0, "none")
#Pintronix
# Pintronix
MakeBoard("pintronix_pinmax", "rp2040", "Pintronix", "PinMax", "0x2e8a", "0x9101", 250, "PINTRONIX_PINMAX", 4, 0, "boot2_w25q080_2_padded_checksum")
# RAKwireless
@@ -630,7 +632,7 @@ MakeBoard("sparkfun_micromodrp2040", "rp2040", "SparkFun", "MicroMod RP2040", "0
MakeBoard("sparkfun_promicrorp2040", "rp2040", "SparkFun", "ProMicro RP2040", "0x1b4f", "0x0026", 250, "SPARKFUN_PROMICRO_RP2040", 16, 0, "boot2_generic_03h_4_padded_checksum")
MakeBoard("sparkfun_promicrorp2350", "rp2350", "SparkFun", "ProMicro RP2350", "0x1b4f", "0x0026", 250, "SPARKFUN_PROMICRO_RP2350", 16, 8, "none")
MakeBoard("sparkfun_thingplusrp2040", "rp2040", "SparkFun", "Thing Plus RP2040", "0x1b4f", "0x0026", 250, "SPARKFUN_THINGPLUS_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
MakeBoard("sparkfun_thingplusrp2350", "rp2350", "SparkFun", "Thing Plus RP2350", "0x1b4f", "0x0038", 250, "SPARKFUN_THINGPLUS_RP2350", 16, 8, "none")
MakeBoard("sparkfun_thingplusrp2350", "rp2350", "SparkFun", "Thing Plus RP2350", "0x1b4f", "0x0038", 250, "SPARKFUN_THINGPLUS_RP2350", 16, 8, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
# Upesy
MakeBoard("upesy_rp2040_devkit", "rp2040", "uPesy", "RP2040 DevKit", "0x2e8a", "0x1007", 250, "UPESY_RP2040_DEVKIT", 2, 0, "boot2_w25q080_2_padded_checksum")
+1
View File
@@ -363,6 +363,7 @@ def configure_network_flags(cpp_defines):
env.Append(CPPDEFINES=[
("PICO_CYW43_ARCH_THREADSAFE_BACKGROUND", 1),
("CYW43_LWIP", 1),
("CYW43_PIO_CLOCK_DIV_DYNAMIC", 1),
("LWIP_IPV4", 1),
("LWIP_IGMP", 1),
("LWIP_CHECKSUM_CTRL_PER_NETIF", 1)
+85
View File
@@ -0,0 +1,85 @@
#pragma once
// LEDs
#define PIN_LED (28u)
// NeoPixel
#define PIN_NEOPIXEL (22u)
// SD Card
#define PIN_CARD_CS 21
// PIN_CARD_DETECT on IO expander
#define TFT_DC 23
#define TFT_CS 24
#define TFT_BACKLIGHT 25
#define TFT_RESET 0
// pins on the 34-pin header
#define DENSITY_PIN 1 // IDC 2
#define INDEX_PIN 10 // IDC 8
#define SELECT_PIN 2 // IDC 12
#define MOTOR_PIN 3 // IDC 16
#define DIR_PIN 4 // IDC 18
#define STEP_PIN 5 // IDC 20
#define WRDATA_PIN 6 // IDC 22 (not used during read)
#define WRGATE_PIN 7 // IDC 24 (not used during read)
#define TRK0_PIN 11 // IDC 26
#define PROT_PIN 12 // IDC 28
#define READ_PIN 13 // IDC 30
#define SIDE_PIN 8 // IDC 32
#define READY_PIN 14 // IDC 34
// pins for Apple Disk ][ interfacing (20-pin IDC header)
#define APPLE2_PHASE1_PIN SIDE_PIN // IDC 2 "Phi0"
#define APPLE2_PHASE2_PIN STEP_PIN // IDC 4 "Phi1"
#define APPLE2_PHASE3_PIN DIR_PIN // IDC 6 "Phi2"
#define APPLE2_PHASE4_PIN MOTOR_PIN // IDC 8 "Phi3"
#define APPLE2_WRGATE_PIN WRGATE_PIN // IDC 10 "WR REQ"
// (IDC 12 is VCC)
#define APPLE2_ENABLE_PIN DENSITY_PIN // IDC 14 "DRVEN/"
#define APPLE2_RDDATA_PIN READ_PIN // IDC 16 "RD DATA"
#define APPLE2_WRDATA_PIN WRDATA_PIN // IDC 18 "WR DATA"
#define APPLE2_PROTECT_PIN PROT_PIN // IDC 20 "W PROT"
#define APPLE2_INDEX_PIN (26) // SENSE 1 JST connector
#define FLOPPY_DIRECTION_PIN 9
#define FLOPPY_ENABLE_PIN 15
// Not pinned out
#define PIN_SERIAL1_TX (31u)
#define PIN_SERIAL1_RX (31u)
// Not pinned out
#define PIN_SERIAL2_TX (31u)
#define PIN_SERIAL2_RX (31u)
// SPI
#define PIN_SPI0_SCK (18u)
#define PIN_SPI0_MOSI (19u)
#define PIN_SPI0_MISO (20u)
#define PIN_SPI0_SS (24u)
#define __SPI0_DEVICE spi0
// Not pinned out
#define PIN_SPI1_MISO (31u)
#define PIN_SPI1_MOSI (31u)
#define PIN_SPI1_SCK (31u)
#define PIN_SPI1_SS (31u)
#define __SPI1_DEVICE spi1
// Wire
#define PIN_WIRE0_SDA (16u)
#define PIN_WIRE0_SCL (17u)
#define __WIRE0_DEVICE i2c0
#define PIN_WIRE1_SDA (31u)
#define PIN_WIRE1_SCL (31u)
#define __WIRE1_DEVICE i2c1
#define SERIAL_HOWMANY (0u)
#define SPI_HOWMANY (1u)
#define WIRE_HOWMANY (1u)
#include "../generic/common.h"
@@ -18,43 +18,16 @@
*/
#include "Arduino.h"
#include <pico/cyw43_arch.h>
extern "C" void __pinMode(pin_size_t pin, PinMode mode);
extern "C" void __digitalWrite(pin_size_t pin, PinStatus val);
extern "C" PinStatus __digitalRead(pin_size_t pin);
extern bool __isPicoW;
#include <cyw43_wrappers.h>
extern "C" void pinMode(pin_size_t pin, PinMode mode) {
if (!__isPicoW && (pin == PIN_LED)) {
pin = 25; // Silently swap in the Pico's LED
}
if (pin < 32) {
__pinMode(pin, mode);
} else {
// TBD - There is no GPIO direction control in the driver
}
cyw43_pinMode(pin, mode);
}
extern "C" void digitalWrite(pin_size_t pin, PinStatus val) {
if (!__isPicoW && (pin == PIN_LED)) {
pin = 25; // Silently swap in the Pico's LED
}
if (pin < 32) {
__digitalWrite(pin, val);
} else {
cyw43_arch_gpio_put(pin - 32, val == HIGH ? 1 : 0);
}
cyw43_digitalWrite(pin, val);
}
extern "C" PinStatus digitalRead(pin_size_t pin) {
if (!__isPicoW && (pin == PIN_LED)) {
pin = 25; // Silently swap in the Pico's LED
}
if (pin < 32) {
return __digitalRead(pin);
} else {
return cyw43_arch_gpio_get(pin - 32) ? HIGH : LOW;
}
return cyw43_digitalRead(pin);
}
+25
View File
@@ -0,0 +1,25 @@
/*
Initialize the Pico W WiFi driver
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <cyw43_wrappers.h>
extern "C" void initVariant() {
init_cyw43_wifi();
}
@@ -0,0 +1,100 @@
#pragma once
#include <stdint.h>
#include <cyw43_wrappers.h>
// Pin definitions taken from:
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
// https://shop.pimoroni.com/products/pimoroni-pico-plus-2
#define PINS_COUNT (33u)
#define NUM_DIGITAL_PINS (33u)
#define NUM_ANALOG_INPUTS (3u)
#define NUM_ANALOG_OUTPUTS (0u)
#define ADC_RESOLUTION (12u)
// LED_BUILTIN
#define PIN_LED (64u)
#define LED_BUILTIN PIN_LED
// Serial
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
#define PIN_SERIAL2_TX (8u)
#define PIN_SERIAL2_RX (9u)
// SPI
#define PIN_SPI0_MISO (32u)
#define PIN_SPI0_MOSI (35u)
#define PIN_SPI0_SCK (34u)
#define PIN_SPI0_SS (33u)
#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (15u)
#define PIN_SPI1_SCK (14u)
#define PIN_SPI1_SS (13u)
// Wire
#define PIN_WIRE0_SDA (4u)
#define PIN_WIRE0_SCL (5u)
#define PIN_WIRE1_SDA (6u)
#define PIN_WIRE1_SCL (7u)
#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (2u)
// PSRAM
#define RP2350_PSRAM_CS (47u)
#define RP2350_PSRAM_MAX_SCK_HZ (109*1000*1000)
#define PICO_RP2350B 1
/* Pins mappings for marked pins on the board */
static const uint8_t D0 = (0u);
static const uint8_t D1 = (1u);
static const uint8_t D2 = (2u);
static const uint8_t D3 = (3u);
static const uint8_t D4 = (4u);
static const uint8_t D5 = (5u);
static const uint8_t D6 = (6u);
static const uint8_t D7 = (7u);
static const uint8_t D8 = (8u);
static const uint8_t D9 = (9u);
static const uint8_t D10 = (10u);
static const uint8_t D11 = (11u);
static const uint8_t D12 = (12u);
static const uint8_t D13 = (13u);
static const uint8_t D14 = (14u);
static const uint8_t D15 = (15u);
static const uint8_t D16 = (16u);
static const uint8_t D17 = (17u);
static const uint8_t D18 = (18u);
static const uint8_t D19 = (19u);
static const uint8_t D20 = (20u);
static const uint8_t D21 = (21u);
static const uint8_t D22 = (22u);
static const uint8_t D26 = (40u);
static const uint8_t D27 = (41u);
static const uint8_t D28 = (42u);
static const uint8_t A0 = (40u);
static const uint8_t A1 = (41u);
static const uint8_t A2 = (42u);
static const uint8_t A3 = (43u);
static const uint8_t SS = PIN_SPI0_SS;
static const uint8_t MOSI = PIN_SPI0_MOSI;
static const uint8_t MISO = PIN_SPI0_MISO;
static const uint8_t SCK = PIN_SPI0_SCK;
static const uint8_t SDA = PIN_WIRE0_SDA;
static const uint8_t SCL = PIN_WIRE0_SCL;
static const uint8_t RX = PIN_SERIAL1_RX;
static const uint8_t TX = PIN_SERIAL1_TX;
+33
View File
@@ -0,0 +1,33 @@
/*
pinMode and digitalRead/Write for the Raspberry Pi Pico W RP2040
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "Arduino.h"
#include <cyw43_wrappers.h>
extern "C" void pinMode(pin_size_t pin, PinMode mode) {
cyw43_pinMode(pin, mode);
}
extern "C" void digitalWrite(pin_size_t pin, PinStatus val) {
cyw43_digitalWrite(pin, val);
}
extern "C" PinStatus digitalRead(pin_size_t pin) {
return cyw43_digitalRead(pin);
}
+25
View File
@@ -0,0 +1,25 @@
/*
Initialize the Pico W WiFi driver
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <cyw43_wrappers.h>
extern "C" void initVariant() {
init_cyw43_wifi();
}
+41
View File
@@ -0,0 +1,41 @@
#pragma once
#include <cyw43_wrappers.h>
// Pin definitions taken from:
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
// LEDs
#define PIN_LED (64u)
// Serial
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
#define PIN_SERIAL2_TX (8u)
#define PIN_SERIAL2_RX (9u)
// SPI
#define PIN_SPI0_MISO (16u)
#define PIN_SPI0_MOSI (19u)
#define PIN_SPI0_SCK (18u)
#define PIN_SPI0_SS (17u)
#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (15u)
#define PIN_SPI1_SCK (14u)
#define PIN_SPI1_SS (13u)
// Wire
#define PIN_WIRE0_SDA (4u)
#define PIN_WIRE0_SCL (5u)
#define PIN_WIRE1_SDA (26u)
#define PIN_WIRE1_SCL (27u)
#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (2u)
#include "../generic/common.h"
+33
View File
@@ -0,0 +1,33 @@
/*
pinMode and digitalRead/Write for the Raspberry Pi Pico W RP2040
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "Arduino.h"
#include <cyw43_wrappers.h>
extern "C" void pinMode(pin_size_t pin, PinMode mode) {
cyw43_pinMode(pin, mode);
}
extern "C" void digitalWrite(pin_size_t pin, PinStatus val) {
cyw43_digitalWrite(pin, val);
}
extern "C" PinStatus digitalRead(pin_size_t pin) {
return cyw43_digitalRead(pin);
}
+25
View File
@@ -0,0 +1,25 @@
/*
Initialize the Pico W WiFi driver
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <cyw43_wrappers.h>
extern "C" void initVariant() {
init_cyw43_wifi();
}
-75
View File
@@ -1,75 +0,0 @@
/*
Initialize the Pico W WiFi driver
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <pico/cyw43_arch.h>
#include <pico/lwip_nosys.h>
#include "hardware/resets.h"
#include "hardware/gpio.h"
#include "hardware/adc.h"
#ifndef WIFICC
#define WIFICC CYW43_COUNTRY_WORLDWIDE
#endif
// Taken from https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf
// also discussion in https://github.com/earlephilhower/arduino-pico/issues/849
static bool CheckPicoW() {
adc_init();
auto dir = gpio_get_dir(29);
auto fnc = gpio_get_function(29);
adc_gpio_init(29);
adc_select_input(3);
auto adc29 = adc_read();
gpio_set_function(29, fnc);
gpio_set_dir(29, dir);
dir = gpio_get_dir(25);
fnc = gpio_get_function(25);
gpio_init(25);
gpio_set_dir(25, GPIO_IN);
auto gp25 = gpio_get(25);
gpio_set_function(25, fnc);
gpio_set_dir(25, dir);
if (gp25) {
return true; // Can't tell, so assume yes
} else if (adc29 < 200) {
return true; // PicoW
} else {
return false;
}
}
bool __isPicoW = true;
extern "C" void initVariant() {
__isPicoW = CheckPicoW();
if (__isPicoW) {
cyw43_arch_init_with_country(WIFICC);
}
}
extern "C" void __lockBluetooth() {
async_context_acquire_lock_blocking(cyw43_arch_async_context());
}
extern "C" void __unlockBluetooth() {
async_context_release_lock(cyw43_arch_async_context());
}
+2 -11
View File
@@ -3,19 +3,10 @@
// Pin definitions taken from:
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
extern bool __isPicoW;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
extern void __lockBluetooth();
extern void __unlockBluetooth();
#ifdef __cplusplus
}; // extern "C"
#endif // __cplusplus
#include <cyw43_wrappers.h>
// LEDs
#define PIN_LED (32u)
#define PIN_LED (64u)
// Serial
#define PIN_SERIAL1_TX (0u)
@@ -0,0 +1,33 @@
/*
pinMode and digitalRead/Write for the Raspberry Pi Pico W RP2040
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "Arduino.h"
#include <cyw43_wrappers.h>
extern "C" void pinMode(pin_size_t pin, PinMode mode) {
cyw43_pinMode(pin, mode);
}
extern "C" void digitalWrite(pin_size_t pin, PinStatus val) {
cyw43_digitalWrite(pin, val);
}
extern "C" PinStatus digitalRead(pin_size_t pin) {
return cyw43_digitalRead(pin);
}
@@ -0,0 +1,25 @@
/*
Initialize the Pico W WiFi driver
Copyright (c) 2022 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <cyw43_wrappers.h>
extern "C" void initVariant() {
init_cyw43_wifi();
}
@@ -1,7 +1,9 @@
#pragma once
#include <cyw43_wrappers.h>
// LEDs
#define PIN_LED (32u)
#define PIN_LED (64u)
#define PIN_NEOPIXEL (14)
#define NUM_NEOPIXEL (1)