Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7add6250e0 | ||
|
|
4068601b01 | ||
|
|
9cea4708c8 | ||
|
|
1a41be1eb0 | ||
|
|
996c3bfab9 | ||
|
|
322a1af6da | ||
|
|
e25d382732 | ||
|
|
bda12cd7e7 | ||
|
|
ca30518510 | ||
|
|
17aab7e373 | ||
|
|
083d86d251 | ||
|
|
7a0adfebd1 | ||
|
|
db4b167aaa | ||
|
|
5a428647d4 | ||
|
|
6c8d62fdb8 | ||
|
|
64156c42b1 | ||
|
|
f5c4136b94 | ||
|
|
c4b6521849 | ||
|
|
593b3bece4 |
@@ -0,0 +1,42 @@
|
||||
# Run whenever it is manually triggered, a pull request or a push is done that modifes the libpico configuration
|
||||
|
||||
name: libpico Builder
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- tools/libpico/**
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- tools/libpico/**
|
||||
jobs:
|
||||
build-libpico:
|
||||
name: Build libpico precompiled libraries
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
- name: Get submodules for pico-sdk
|
||||
run: cd pico-sdk && git submodule update --init --recursive
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install cmake make build-essential wget
|
||||
# Automatically get correct toolchain
|
||||
cd tools && python3 get.py && cd ..
|
||||
# add to PATH
|
||||
echo "$GITHUB_WORKSPACE/system/riscv32-unknown-elf/bin" >> "$GITHUB_PATH"
|
||||
echo "$GITHUB_WORKSPACE/system/arm-none-eabi/bin" >> "$GITHUB_PATH"
|
||||
- name: Build libpico
|
||||
run: |
|
||||
cd tools/libpico
|
||||
./make-libpico.sh
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: libpico
|
||||
path: |
|
||||
tools/libpico/build-rp2040/*.a
|
||||
tools/libpico/build-rp2350/*.a
|
||||
tools/libpico/build-rp2350-riscv/*.a
|
||||
@@ -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
|
||||
@@ -91,6 +94,7 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
|
||||
* SparkFun ProMicro RP2040
|
||||
* SparkFun ProMicro RP2350
|
||||
* SparkFun Thing Plus RP2040
|
||||
* SparkFun Thing Plus RP2350
|
||||
* uPesy RP2040 DevKit
|
||||
* VCC-GND YD-RP2040
|
||||
* Viyalab Mizu RP2040
|
||||
@@ -102,7 +106,10 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
|
||||
* Waveshare RP2040 Matrix
|
||||
* Waveshare RP2040 PiZero
|
||||
* WIZnet W5100S-EVB-Pico
|
||||
* WIZnet W5100S-EVB-Pico2
|
||||
* WIZnet W5500-EVB-Pico
|
||||
* WIZnet W5500-EVB-Pico2
|
||||
* WIZnet W55RP20-EVB-Pico
|
||||
* WIZnet WizFi360-EVB-Pico
|
||||
* Generic RP2040 (configurable flash, I/O pins)
|
||||
* Generic RP2350 (configurable flash, I/O pins)
|
||||
|
||||
+1890
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,8 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef PICO_RP2040
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <hardware/structs/psm.h>
|
||||
|
||||
@@ -31,3 +33,5 @@ void RP2040::enableDoubleResetBootloader() {
|
||||
boot_double_tap_check();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -351,7 +351,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PICO_RP2040
|
||||
static void enableDoubleResetBootloader();
|
||||
#endif
|
||||
|
||||
void wdt_begin(uint32_t delay_ms) {
|
||||
watchdog_enable(delay_ms, 1);
|
||||
@@ -463,7 +465,7 @@ public:
|
||||
}
|
||||
|
||||
bool isPicoW() {
|
||||
#if !defined(ARDUINO_RASPBERRY_PI_PICO_W)
|
||||
#if !defined(PICO_CYW43_SUPPORTED)
|
||||
return false;
|
||||
#else
|
||||
extern bool __isPicoW;
|
||||
|
||||
@@ -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 0
|
||||
#define ARDUINO_PICO_VERSION_STR "4.2.0"
|
||||
#define ARDUINO_PICO_VERSION_STR "4.3.0"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
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;
|
||||
extern "C" {
|
||||
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);
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
};
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -54,9 +54,9 @@ author = u'Earle F. Philhower, III'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = u'4.2.0'
|
||||
version = u'4.3.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = u'4.2.0'
|
||||
release = u'4.3.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ Requirements
|
||||
Implementation Overview
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Updates with a web browser are implemented using ``HTTPUpdateServer`` class together with ``WebServer`` and ``LEAmDNS`` classes. The following code is required to get it work:
|
||||
Updates with a web browser are implemented using ``HTTPUpdateServer`` class together with ``WebServer`` and ``LEAmDNS`` or ``SimpleMDNS`` classes. The following code is required to get it work:
|
||||
|
||||
setup()
|
||||
|
||||
|
||||
+2
-2
@@ -95,8 +95,8 @@ doing any WiFi calls.
|
||||
Bootloader
|
||||
----------
|
||||
|
||||
void rp2040.enableDoubleResetBootloader()
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
void rp2040.enableDoubleResetBootloader() (Pico/RP2040 only)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Add a call anywhere in the sketch to ``rp2040.enableDoubleResetBootloader()`` and
|
||||
the core will check for a double-tap on reset, and if found will start the USB
|
||||
bootloader.
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ Please note that WiFi on the Pico W is a work-in-progress and there are some imp
|
||||
|
||||
* FreeRTOS is supported only on core 0 and from within ``setup`` and ``loop``, not tasks, due to the requirement for a very different LWIP implementation. PRs always appreciated!
|
||||
|
||||
* LEAmDNS (``MDNS``) is not supported in FreeRTOS due to internal IRQ-time memory allocations.
|
||||
* LEAmDNS (``MDNS``) is not supported in FreeRTOS due to internal IRQ-time memory allocations. Instead, use the SimpleMDNS library ( ``#include <SimpleMDNS.h>`` ) which has no such allocations.
|
||||
|
||||
The WiFi library borrows much work from the `ESP8266 Arduino Core <https://github.com/esp8266/Arduino>`__ , especially the ``WiFiClient`` and ``WiFiServer`` classes.
|
||||
|
||||
|
||||
+45
-39
@@ -21,50 +21,56 @@ extern unsigned long __lwip_rand(void);
|
||||
// Common settings used in most of the pico_w examples
|
||||
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details)
|
||||
|
||||
#define NO_SYS 1
|
||||
#define LWIP_SOCKET 0
|
||||
#define MEM_LIBC_MALLOC 0
|
||||
#define NO_SYS 1
|
||||
#define LWIP_SOCKET 0
|
||||
#define MEM_LIBC_MALLOC 0
|
||||
|
||||
#define MEM_ALIGNMENT 4
|
||||
#define MEM_SIZE (__LWIP_MEMMULT * 16384)
|
||||
#define MEMP_NUM_TCP_SEG (32)
|
||||
#define MEMP_NUM_ARP_QUEUE (10)
|
||||
#define PBUF_POOL_SIZE (__LWIP_MEMMULT > 1 ? 32 : 24)
|
||||
#define LWIP_ARP 2
|
||||
#define LWIP_ETHERNET 1
|
||||
#define LWIP_ICMP 1
|
||||
#define LWIP_RAW 1
|
||||
#define TCP_WND (8 * TCP_MSS)
|
||||
#define TCP_MSS 1460
|
||||
#define TCP_SND_BUF (8 * TCP_MSS)
|
||||
#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS))
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
#define LWIP_NETIF_LINK_CALLBACK 1
|
||||
#define LWIP_NETIF_HOSTNAME 1
|
||||
#define LWIP_NETCONN 0
|
||||
#define LWIP_STATS 0
|
||||
#define LWIP_STATS_DISPLAY 0
|
||||
#define MEM_STATS 0
|
||||
#define SYS_STATS 0
|
||||
#define MEMP_STATS 0
|
||||
#define LINK_STATS 0
|
||||
#define LWIP_CHKSUM_ALGORITHM 0
|
||||
#define LWIP_DHCP 1
|
||||
#define LWIP_IPV4 1
|
||||
#define LWIP_TCP 1
|
||||
#define LWIP_UDP 1
|
||||
#define LWIP_DNS 1
|
||||
#define LWIP_TCP_KEEPALIVE 1
|
||||
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
||||
#define DHCP_DOES_ARP_CHECK 0
|
||||
#define LWIP_DHCP_DOES_ACD_CHECK 0
|
||||
#define MEM_ALIGNMENT 4
|
||||
#define MEM_SIZE (__LWIP_MEMMULT * 16384)
|
||||
#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_ETHERNET 1
|
||||
#define LWIP_ICMP 1
|
||||
#define LWIP_RAW 1
|
||||
#define TCP_WND (8 * TCP_MSS)
|
||||
#define TCP_MSS 1460
|
||||
#define TCP_SND_BUF (8 * TCP_MSS)
|
||||
#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS))
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
#define LWIP_NETIF_LINK_CALLBACK 1
|
||||
#define LWIP_NETIF_HOSTNAME 1
|
||||
#define LWIP_NUM_NETIF_CLIENT_DATA 5
|
||||
#define LWIP_NETCONN 0
|
||||
#define LWIP_STATS 0
|
||||
#define LWIP_STATS_DISPLAY 0
|
||||
#define MEM_STATS 0
|
||||
#define SYS_STATS 0
|
||||
#define MEMP_STATS 0
|
||||
#define LINK_STATS 0
|
||||
#define LWIP_CHKSUM_ALGORITHM 0
|
||||
#define LWIP_DHCP 1
|
||||
#define LWIP_IPV4 1
|
||||
#define LWIP_TCP 1
|
||||
#define LWIP_UDP 1
|
||||
#define LWIP_DNS 1
|
||||
#define LWIP_DNS_SUPPORT_MDNS_QUERIES 1
|
||||
#define LWIP_TCP_KEEPALIVE 1
|
||||
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
||||
#define DHCP_DOES_ARP_CHECK 0
|
||||
#define LWIP_DHCP_DOES_ACD_CHECK 0
|
||||
#define LWIP_IGMP 1
|
||||
#define LWIP_MDNS_RESPONDER 1
|
||||
#define MDNS_MAX_SERVICES 4
|
||||
|
||||
// See #1285
|
||||
#define MEMP_NUM_UDP_PCB (__LWIP_MEMMULT * 6)
|
||||
#define MEMP_NUM_TCP_PCB (__LWIP_MEMMULT * 5)
|
||||
#define MEMP_NUM_UDP_PCB (__LWIP_MEMMULT * 7)
|
||||
#define MEMP_NUM_TCP_PCB (__LWIP_MEMMULT * 5)
|
||||
|
||||
#if LWIP_IPV6
|
||||
#define LWIP_IPV6_DHCP6 1
|
||||
#define LWIP_IPV6_DHCP6 1
|
||||
#define LWIP_IPV6_MLD 1
|
||||
#endif
|
||||
|
||||
// NTP
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,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.
@@ -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,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.
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <WiFi.h>
|
||||
#include <LEAmDNS.h>
|
||||
#include <SimpleMDNS.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <WiFi.h>
|
||||
#include <LEAmDNS.h>
|
||||
#include <SimpleMDNS.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <LEAmDNS.h>
|
||||
#include <SimpleMDNS.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
|
||||
@@ -28,10 +28,7 @@
|
||||
|
||||
#include <lwip/udp.h>
|
||||
#include <include/UdpContext.h>
|
||||
|
||||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
|
||||
#include <LEAmDNS.h>
|
||||
#endif
|
||||
#include <SimpleMDNS.h>
|
||||
|
||||
#ifdef DEBUG_RP2040_CORE
|
||||
#ifdef DEBUG_RP2040_PORT
|
||||
|
||||
@@ -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,7 +5,7 @@
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WebServer.h>
|
||||
#include <LEAmDNS.h>
|
||||
#include <SimpleMDNS.h>
|
||||
#include <HTTPUpdateServer.h>
|
||||
|
||||
#ifndef STASSID
|
||||
|
||||
@@ -162,13 +162,13 @@ right1:
|
||||
left1:
|
||||
in pins, 1 side 0b01
|
||||
jmp x--, left1 side 0b00
|
||||
in pins, 1 side 0b11 ; Last bit of left has WCLK change per I2S spec
|
||||
|
||||
in pins, 1 side 0b01 ; 2584 LRCK stays low until BCLK goes low
|
||||
; Last bit of left has WCLK change per I2S spec
|
||||
mov x, y side 0b10
|
||||
right1:
|
||||
in pins, 1 side 0b11
|
||||
jmp x--, right1 side 0b10
|
||||
in pins, 1 side 0b01 ; Last bit of right also has WCLK change
|
||||
in pins, 1 side 0b11 ; 2584 LRCK stays high until BCLK goes low
|
||||
; Loop back to beginning...
|
||||
|
||||
|
||||
@@ -184,13 +184,13 @@ right1:
|
||||
left1:
|
||||
in pins, 1 side 0b10
|
||||
jmp x--, left1 side 0b00
|
||||
in pins, 1 side 0b11 ; Last bit of left has WCLK change per I2S spec
|
||||
in pins, 1 side 0b10 ;2584 LRCK stays low until BCLK goes low
|
||||
|
||||
mov x, y side 0b01
|
||||
right1:
|
||||
in pins, 1 side 0b11
|
||||
jmp x--, right1 side 0b01
|
||||
in pins, 1 side 0b10 ; Last bit of right also has WCLK change
|
||||
in pins, 1 side 0b11 ; 2584 LRCK stays high until BCLK goes low
|
||||
; Loop back to beginning...
|
||||
|
||||
|
||||
|
||||
@@ -286,11 +286,11 @@ static const uint16_t pio_i2s_in_program_instructions[] = {
|
||||
0xa022, // 0: mov x, y side 0
|
||||
0x4801, // 1: in pins, 1 side 1
|
||||
0x0041, // 2: jmp x--, 1 side 0
|
||||
0x5801, // 3: in pins, 1 side 3
|
||||
0x4801, // 3: in pins, 1 side 1
|
||||
0xb022, // 4: mov x, y side 2
|
||||
0x5801, // 5: in pins, 1 side 3
|
||||
0x1045, // 6: jmp x--, 5 side 2
|
||||
0x4801, // 7: in pins, 1 side 1
|
||||
0x5801, // 7: in pins, 1 side 3
|
||||
// .wrap
|
||||
};
|
||||
|
||||
@@ -326,11 +326,11 @@ static const uint16_t pio_i2s_in_swap_program_instructions[] = {
|
||||
0xa022, // 0: mov x, y side 0
|
||||
0x5001, // 1: in pins, 1 side 2
|
||||
0x0041, // 2: jmp x--, 1 side 0
|
||||
0x5801, // 3: in pins, 1 side 3
|
||||
0x5001, // 3: in pins, 1 side 2
|
||||
0xa822, // 4: mov x, y side 1
|
||||
0x5801, // 5: in pins, 1 side 3
|
||||
0x0845, // 6: jmp x--, 5 side 1
|
||||
0x5001, // 7: in pins, 1 side 2
|
||||
0x5801, // 7: in pins, 1 side 3
|
||||
// .wrap
|
||||
};
|
||||
|
||||
|
||||
@@ -1348,3 +1348,8 @@ protected:
|
||||
} // namespace esp8266
|
||||
|
||||
#include <ESP8266mDNS.h>
|
||||
|
||||
#define __LEAMDNS_H 1
|
||||
#ifdef __SIMPLEMDNS_H
|
||||
#error SimpleMDNS and LeaMDNS both included. Only one allowed at a time.
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# SimpleMDNS Library for Arduino-Pico
|
||||
|
||||
This library implements a very basic MDNS responder (xxx.local) for the
|
||||
Pico to enable things like local name resolution and Arduino IDE OTA
|
||||
connections. It uses the LWIP-provided simplified MDNS application.
|
||||
|
||||
Unlike LEAmDNS, this library only supports very simple configurations.
|
||||
They should be sufficient for OTA and name resolution and simple web
|
||||
servers, but for more complicated needs please use LEAmDNS.
|
||||
|
||||
The benefit of this simplicity is that it is low code and has no runtime
|
||||
memory allocations. This means it can be run under FreeRTOS (which LEAmDNS
|
||||
does not presently support).
|
||||
|
||||
This should be a drop-in replacement, just replace `#include <LEAmDNS.h>`
|
||||
with `#include <SimpleMDNS.h>`.
|
||||
|
||||
Be sure to `MDNS.begin()` after enabling WiFi/Ethernet.begin().
|
||||
|
||||
-Earle F. Philhower, III
|
||||
<earlephilhower@yahoo.com>
|
||||
@@ -0,0 +1,23 @@
|
||||
#######################################
|
||||
# Syntax Coloring Map
|
||||
#######################################
|
||||
|
||||
#######################################
|
||||
# Datatypes (KEYWORD1)
|
||||
#######################################
|
||||
|
||||
SimpleMDNS KEYWORD1
|
||||
MDNS KEYWORD1
|
||||
|
||||
#######################################
|
||||
# Methods and Functions (KEYWORD2)
|
||||
#######################################
|
||||
|
||||
begin KEYWORD2
|
||||
addService KEYWORD2
|
||||
enableArduino KEYWORD2
|
||||
|
||||
#######################################
|
||||
# Constants (LITERAL1)
|
||||
#######################################
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
name=SimpleMDNS
|
||||
version=1.0
|
||||
author=Earle F. Philhower, III <earlephilhower@yahoo.com>
|
||||
maintainer=Earle F. Philhower, III <earlephilhower@yahoo.com>
|
||||
sentence=Creates a simple mDNS responder using LWIP features
|
||||
paragraph=Creates a mDNS responder to ensure host domain uniqueness in local networks and to allow for mDNS service discovery and announcement.
|
||||
category=Communication
|
||||
url=https://github.com/earlephilhower/arduino-pico
|
||||
architectures=rp2040
|
||||
dot_a_linkage=true
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
SimpleMDNS for Rasperry Pi Pico
|
||||
Implements a basic MDNS responder (xxx.local)
|
||||
|
||||
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 "SimpleMDNS.h"
|
||||
#include <LwipEthernet.h>
|
||||
#include <lwip/apps/mdns.h>
|
||||
|
||||
bool SimpleMDNS::begin(const char *hostname, unsigned int ttl) {
|
||||
if (_running) {
|
||||
return false;
|
||||
}
|
||||
mdns_resp_init();
|
||||
struct netif *n = netif_list;
|
||||
while (n) {
|
||||
mdns_resp_add_netif(n, hostname);
|
||||
n = n->next;
|
||||
}
|
||||
__setStateChangeCallback(_statusCB);
|
||||
_hostname = strdup(hostname);
|
||||
_running = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimpleMDNS::enableArduino(unsigned int port, bool passwd) {
|
||||
if (!_running) {
|
||||
return;
|
||||
}
|
||||
struct netif *n = netif_list;
|
||||
while (n) {
|
||||
mdns_resp_add_service(n, _hostname, "_arduino", DNSSD_PROTO_TCP, port, _arduinoGetTxt, (void *)passwd);
|
||||
n = n->next;
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleMDNS::addService(const char *service, const char *proto, unsigned int port) {
|
||||
if (!_running) {
|
||||
return;
|
||||
}
|
||||
char s[128];
|
||||
snprintf(s, sizeof(s), "_%s", service);
|
||||
s[sizeof(s) - 1] = 0;
|
||||
struct netif *n = netif_list;
|
||||
while (n) {
|
||||
mdns_resp_add_service(n, _hostname, s, !strcasecmp("tcp", proto) ? DNSSD_PROTO_TCP : DNSSD_PROTO_UDP, port, _nullGetTxt, nullptr);
|
||||
n = n->next;
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleMDNS::update() {
|
||||
/* No-op */
|
||||
}
|
||||
|
||||
void SimpleMDNS::end() {
|
||||
/* No-op */
|
||||
}
|
||||
|
||||
void SimpleMDNS::_statusCB(struct netif *netif) {
|
||||
mdns_resp_netif_settings_changed(netif);
|
||||
}
|
||||
|
||||
void SimpleMDNS::_addServiceTxt(struct mdns_service *service, const char *str) {
|
||||
mdns_resp_add_service_txtitem(service, str, strlen(str));
|
||||
}
|
||||
|
||||
void SimpleMDNS::_arduinoGetTxt(struct mdns_service *service, void *txt_userdata) {
|
||||
_addServiceTxt(service, "tcp_check=no");
|
||||
_addServiceTxt(service, "ssh_upload=no");
|
||||
_addServiceTxt(service, "board=" ARDUINO_VARIANT);
|
||||
_addServiceTxt(service, (bool)txt_userdata ? "auth_upload=yes" : "auth_upload=no");
|
||||
}
|
||||
|
||||
void SimpleMDNS::_nullGetTxt(struct mdns_service *service, void *txt_userdata) {
|
||||
/* nop */
|
||||
}
|
||||
|
||||
const char *SimpleMDNS::_hostname = nullptr;
|
||||
|
||||
SimpleMDNS MDNS;
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
SimpleMDNS for Rasperry Pi Pico
|
||||
Implements a basic MDNS responder (xxx.local)
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
class SimpleMDNS {
|
||||
|
||||
public:
|
||||
bool begin(const char *hostname, unsigned int ttl = 60);
|
||||
void enableArduino(unsigned int port, bool passwd = false);
|
||||
void addService(const char *service, const char *proto, unsigned int port);
|
||||
|
||||
// No-ops here
|
||||
void end();
|
||||
void update();
|
||||
|
||||
private:
|
||||
static void _statusCB(struct netif *netif);
|
||||
static void _addServiceTxt(struct mdns_service *service, const char *str);
|
||||
static void _arduinoGetTxt(struct mdns_service *service, void *txt_userdata);
|
||||
static void _nullGetTxt(struct mdns_service *service, void *txt_userdata);
|
||||
|
||||
bool _running = false;
|
||||
static const char *_hostname;
|
||||
};
|
||||
|
||||
extern SimpleMDNS MDNS;
|
||||
|
||||
#define __SIMPLEMDNS_H 1
|
||||
#ifdef __LEAMDNS_H
|
||||
#error SimpleMDNS and LeaMDNS both included. Only one allowed at a time.
|
||||
#endif
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -115,4 +115,5 @@ public:
|
||||
|
||||
private:
|
||||
bool _multicast;
|
||||
bool _dirty;
|
||||
};
|
||||
|
||||
@@ -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 {
|
||||
@@ -229,3 +229,8 @@ void lwipPollingPeriod(int ms) {
|
||||
_pollingPeriod = ms;
|
||||
}
|
||||
}
|
||||
|
||||
std::function<void(struct netif *)> _scb;
|
||||
void __setStateChangeCallback(std::function<void(struct netif *)> s) {
|
||||
_scb = s;
|
||||
}
|
||||
|
||||
@@ -44,3 +44,6 @@ int hostByName(const char *aHostname, IPAddress &aResult, int timeout_ms = 5000)
|
||||
|
||||
// Set the LWIP polling time (default 50ms). Lower polling times == lower latency but higher CPU usage
|
||||
void lwipPollingPeriod(int ms);
|
||||
|
||||
// Sets the global netif state change callback
|
||||
void __setStateChangeCallback(std::function<void(struct netif *)> s);
|
||||
|
||||
@@ -53,15 +53,13 @@
|
||||
|
||||
// Dup'd to avoid CYW43 dependency
|
||||
// Generate a mac address if one is not set in otp
|
||||
extern "C" {
|
||||
static void cyw43_hal_generate_laa_mac(__unused int idx, uint8_t buf[6]) {
|
||||
pico_unique_board_id_t board_id;
|
||||
pico_get_unique_board_id(&board_id);
|
||||
memcpy(buf, &board_id.id[2], 6);
|
||||
buf[0] &= (uint8_t)~0x1; // unicast
|
||||
buf[0] |= 0x2; // locally administered
|
||||
}
|
||||
};
|
||||
static void _cyw43_hal_generate_laa_mac(__unused int idx, uint8_t buf[6]) {
|
||||
pico_unique_board_id_t board_id;
|
||||
pico_get_unique_board_id(&board_id);
|
||||
memcpy(buf, &board_id.id[2], 6);
|
||||
buf[0] &= (uint8_t)~0x1; // unicast
|
||||
buf[0] |= 0x2; // locally administered
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,8 +69,6 @@ enum EthernetLinkStatus {
|
||||
LinkOFF
|
||||
};
|
||||
|
||||
extern "C" void cyw43_hal_generate_laa_mac(__unused int idx, uint8_t buf[6]);
|
||||
|
||||
template<class RawDev>
|
||||
class LwipIntfDev: public LwipIntf, public RawDev {
|
||||
public:
|
||||
@@ -181,6 +177,7 @@ protected:
|
||||
static err_t linkoutput_s(netif* netif, struct pbuf* p);
|
||||
static void netif_status_callback_s(netif* netif);
|
||||
static void _irq(void *param);
|
||||
|
||||
public:
|
||||
// called on a regular basis or on interrupt
|
||||
err_t handlePackets();
|
||||
@@ -355,7 +352,7 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
|
||||
#if 1
|
||||
// forge a new mac-address from the esp's wifi sta one
|
||||
// I understand this is cheating with an official mac-address
|
||||
cyw43_hal_generate_laa_mac(0, _macAddress);
|
||||
_cyw43_hal_generate_laa_mac(0, _macAddress);
|
||||
#else
|
||||
// https://serverfault.com/questions/40712/what-range-of-mac-addresses-can-i-safely-use-for-my-virtual-machines
|
||||
memset(_macAddress, 0, 6);
|
||||
@@ -533,6 +530,7 @@ err_t LwipIntfDev<RawDev>::netif_init() {
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
extern std::function<void(struct netif *)> _scb;
|
||||
template<class RawDev>
|
||||
void LwipIntfDev<RawDev>::netif_status_callback() {
|
||||
check_route();
|
||||
@@ -540,6 +538,9 @@ void LwipIntfDev<RawDev>::netif_status_callback() {
|
||||
sntp_stop();
|
||||
sntp_init();
|
||||
}
|
||||
if (_scb) {
|
||||
_scb(&_netif);
|
||||
}
|
||||
}
|
||||
|
||||
template<class RawDev>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
const char* host = "djxmmx.net";
|
||||
const uint16_t port = 17;
|
||||
|
||||
#ifdef ARDUINO_WIZNET_5100S_EVB_PICO
|
||||
#if defined(ARDUINO_WIZNET_5100S_EVB_PICO) || defined(ARDUINO_WIZNET_5100S_EVB_PICO2)
|
||||
// To use Interrupt-driven mode, pass in an SPI object and an IRQ pin like so:
|
||||
Wiznet5100lwIP eth(17, SPI, 21);
|
||||
#else
|
||||
@@ -16,7 +16,7 @@ Wiznet5100lwIP eth(1 /* chip select */);
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
#ifndef ARDUINO_WIZNET_5100S_EVB_PICO
|
||||
#if !defined(ARDUINO_WIZNET_5100S_EVB_PICO) && !defined(ARDUINO_WIZNET_5100S_EVB_PICO2)
|
||||
// Set up SPI pinout to match your HW
|
||||
SPI.setRX(0);
|
||||
SPI.setCS(1);
|
||||
|
||||
@@ -8,14 +8,21 @@
|
||||
const char* host = "djxmmx.net";
|
||||
const uint16_t port = 17;
|
||||
|
||||
#if defined(ARDUINO_WIZNET_5500_EVB_PICO) || defined(ARDUINO_WIZNET_5500_EVB_PICO2)
|
||||
// To use Interrupt-driven mode, pass in an SPI object and an IRQ pin like so:
|
||||
Wiznet5500lwIP eth(17, SPI, 21);
|
||||
#else
|
||||
Wiznet5500lwIP eth(1 /* chip select */);
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
#if !defined(ARDUINO_WIZNET_5500_EVB_PICO) && !defined(ARDUINO_WIZNET_5500_EVB_PICO2)
|
||||
// Set up SPI pinout to match your HW
|
||||
SPI.setRX(0);
|
||||
SPI.setCS(1);
|
||||
SPI.setSCK(2);
|
||||
SPI.setTX(3);
|
||||
#endif
|
||||
|
||||
Serial.begin(115200);
|
||||
delay(5000);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "framework-arduinopico",
|
||||
"version": "1.40200.0",
|
||||
"version": "1.40300.0",
|
||||
"description": "Arduino Wiring-based Framework (RPi Pico RP2040, RP2350)",
|
||||
"keywords": [
|
||||
"framework",
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
@@ -281,6 +290,9 @@
|
||||
{
|
||||
"name": "SparkFun Thing Plus RP2040"
|
||||
},
|
||||
{
|
||||
"name": "SparkFun Thing Plus RP2350"
|
||||
},
|
||||
{
|
||||
"name": "uPesy RP2040 DevKit"
|
||||
},
|
||||
@@ -326,12 +338,18 @@
|
||||
{
|
||||
"name": "WIZnet W5100S-EVB-Pico"
|
||||
},
|
||||
{
|
||||
"name": "WIZnet W5100S-EVB-Pico2"
|
||||
},
|
||||
{
|
||||
"name": "WIZnet WizFi360-EVB-Pico"
|
||||
},
|
||||
{
|
||||
"name": "WIZnet W5500-EVB-Pico"
|
||||
},
|
||||
{
|
||||
"name": "WIZnet W5500-EVB-Pico2"
|
||||
},
|
||||
{
|
||||
"name": "WIZnet W55RP20-EVB-Pico"
|
||||
},
|
||||
|
||||
+1
-1
Submodule pico-sdk updated: efe2103f9b...95ea6acad1
+1
-1
@@ -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.0
|
||||
version=4.3.0
|
||||
|
||||
# Required discoveries and monitors
|
||||
# ---------------------------------
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ for dir in ./cores/rp2040 ./libraries/EEPROM ./libraries/I2S ./libraries/SingleF
|
||||
./libraries/SPISlave ./libraries/lwIP_ESPHost ./libraries/FatFS\
|
||||
./libraries/FatFSUSB ./libraries/BluetoothAudio ./libraries/BluetoothHCI \
|
||||
./libraries/BluetoothHIDMaster ./libraries/NetBIOS ./libraries/Ticker \
|
||||
./libraries/VFS ./libraries/rp2350; do
|
||||
./libraries/VFS ./libraries/rp2350 ./libraries/SimpleMDNS; do
|
||||
find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" \) -a \! -path '*api*' -exec astyle --suffix=none --options=./tests/astyle_core.conf \{\} \;
|
||||
find $dir -type f -name "*.ino" -exec astyle --suffix=none --options=./tests/astyle_examples.conf \{\} \;
|
||||
done
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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": [
|
||||
[
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x1B4F",
|
||||
"usb_pid": "0x0038"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"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": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x1B4F",
|
||||
"0x0038"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "sparkfun_thingplusrp2350"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Thing Plus RP2350",
|
||||
"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": "SparkFun"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x1027"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_WIZNET_5100S_EVB_PICO2 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x1027"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "wiznet_5100s_evb_pico2"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "W5100S-EVB-Pico2",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 2097152,
|
||||
"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": "WIZnet"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x1029"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_WIZNET_5500_EVB_PICO2 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x1029"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "wiznet_5500_evb_pico2"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "W5500-EVB-Pico2",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 2097152,
|
||||
"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": "WIZnet"
|
||||
}
|
||||
@@ -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,21 @@ 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_PIN_WL_DYNAMIC=1
|
||||
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 +127,13 @@ 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
|
||||
${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,19 +217,19 @@ 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
|
||||
pico_lwip_mdns
|
||||
pico_stdlib
|
||||
)
|
||||
|
||||
@@ -262,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
|
||||
@@ -332,4 +323,5 @@ add_custom_command(TARGET pico-${cpu} POST_BUILD
|
||||
COMMAND sed 's/include.*pico-sdk/include \"..\\/..\\/pico-sdk/' ./generated/pico_base/pico/config_autogen.h > ../../../include/${cpu}/pico_base/pico/config_autogen.h
|
||||
COMMAND cp ../tusb_config.h ../../../include/${cpu}/.
|
||||
COMMAND cp ../btstack_config.h ../../../include/${cpu}/.
|
||||
COMMAND cp ../lwipopts.h ../../../include/.
|
||||
)
|
||||
|
||||
+45
-39
@@ -21,50 +21,56 @@ extern unsigned long __lwip_rand(void);
|
||||
// Common settings used in most of the pico_w examples
|
||||
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details)
|
||||
|
||||
#define NO_SYS 1
|
||||
#define LWIP_SOCKET 0
|
||||
#define MEM_LIBC_MALLOC 0
|
||||
#define NO_SYS 1
|
||||
#define LWIP_SOCKET 0
|
||||
#define MEM_LIBC_MALLOC 0
|
||||
|
||||
#define MEM_ALIGNMENT 4
|
||||
#define MEM_SIZE (__LWIP_MEMMULT * 16384)
|
||||
#define MEMP_NUM_TCP_SEG (32)
|
||||
#define MEMP_NUM_ARP_QUEUE (10)
|
||||
#define PBUF_POOL_SIZE (__LWIP_MEMMULT > 1 ? 32 : 24)
|
||||
#define LWIP_ARP 2
|
||||
#define LWIP_ETHERNET 1
|
||||
#define LWIP_ICMP 1
|
||||
#define LWIP_RAW 1
|
||||
#define TCP_WND (8 * TCP_MSS)
|
||||
#define TCP_MSS 1460
|
||||
#define TCP_SND_BUF (8 * TCP_MSS)
|
||||
#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS))
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
#define LWIP_NETIF_LINK_CALLBACK 1
|
||||
#define LWIP_NETIF_HOSTNAME 1
|
||||
#define LWIP_NETCONN 0
|
||||
#define LWIP_STATS 0
|
||||
#define LWIP_STATS_DISPLAY 0
|
||||
#define MEM_STATS 0
|
||||
#define SYS_STATS 0
|
||||
#define MEMP_STATS 0
|
||||
#define LINK_STATS 0
|
||||
#define LWIP_CHKSUM_ALGORITHM 0
|
||||
#define LWIP_DHCP 1
|
||||
#define LWIP_IPV4 1
|
||||
#define LWIP_TCP 1
|
||||
#define LWIP_UDP 1
|
||||
#define LWIP_DNS 1
|
||||
#define LWIP_TCP_KEEPALIVE 1
|
||||
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
||||
#define DHCP_DOES_ARP_CHECK 0
|
||||
#define LWIP_DHCP_DOES_ACD_CHECK 0
|
||||
#define MEM_ALIGNMENT 4
|
||||
#define MEM_SIZE (__LWIP_MEMMULT * 16384)
|
||||
#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_ETHERNET 1
|
||||
#define LWIP_ICMP 1
|
||||
#define LWIP_RAW 1
|
||||
#define TCP_WND (8 * TCP_MSS)
|
||||
#define TCP_MSS 1460
|
||||
#define TCP_SND_BUF (8 * TCP_MSS)
|
||||
#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS))
|
||||
#define LWIP_NETIF_STATUS_CALLBACK 1
|
||||
#define LWIP_NETIF_LINK_CALLBACK 1
|
||||
#define LWIP_NETIF_HOSTNAME 1
|
||||
#define LWIP_NUM_NETIF_CLIENT_DATA 5
|
||||
#define LWIP_NETCONN 0
|
||||
#define LWIP_STATS 0
|
||||
#define LWIP_STATS_DISPLAY 0
|
||||
#define MEM_STATS 0
|
||||
#define SYS_STATS 0
|
||||
#define MEMP_STATS 0
|
||||
#define LINK_STATS 0
|
||||
#define LWIP_CHKSUM_ALGORITHM 0
|
||||
#define LWIP_DHCP 1
|
||||
#define LWIP_IPV4 1
|
||||
#define LWIP_TCP 1
|
||||
#define LWIP_UDP 1
|
||||
#define LWIP_DNS 1
|
||||
#define LWIP_DNS_SUPPORT_MDNS_QUERIES 1
|
||||
#define LWIP_TCP_KEEPALIVE 1
|
||||
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
||||
#define DHCP_DOES_ARP_CHECK 0
|
||||
#define LWIP_DHCP_DOES_ACD_CHECK 0
|
||||
#define LWIP_IGMP 1
|
||||
#define LWIP_MDNS_RESPONDER 1
|
||||
#define MDNS_MAX_SERVICES 4
|
||||
|
||||
// See #1285
|
||||
#define MEMP_NUM_UDP_PCB (__LWIP_MEMMULT * 6)
|
||||
#define MEMP_NUM_TCP_PCB (__LWIP_MEMMULT * 5)
|
||||
#define MEMP_NUM_UDP_PCB (__LWIP_MEMMULT * 7)
|
||||
#define MEMP_NUM_TCP_PCB (__LWIP_MEMMULT * 5)
|
||||
|
||||
#if LWIP_IPV6
|
||||
#define LWIP_IPV6_DHCP6 1
|
||||
#define LWIP_IPV6_DHCP6 1
|
||||
#define LWIP_IPV6_MLD 1
|
||||
#endif
|
||||
|
||||
// NTP
|
||||
|
||||
@@ -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
|
||||
|
||||
+9
-4
@@ -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,6 +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", ["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")
|
||||
@@ -657,8 +660,10 @@ MakeBoard("waveshare_rp2040_lcd_1_28", "rp2040", "Waveshare", "RP2040 LCD 1.28",
|
||||
|
||||
# WIZnet
|
||||
MakeBoard("wiznet_5100s_evb_pico", "rp2040", "WIZnet", "W5100S-EVB-Pico", "0x2e8a", "0x1027", 250, "WIZNET_5100S_EVB_PICO", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("wiznet_5100s_evb_pico2", "rp2350", "WIZnet", "W5100S-EVB-Pico2", "0x2e8a", "0x1027", 250, "WIZNET_5100S_EVB_PICO2", 2, 0, "none")
|
||||
MakeBoard("wiznet_wizfi360_evb_pico", "rp2040", "WIZnet", "WizFi360-EVB-Pico", "0x2e8a", "0x1028", 250, "WIZNET_WIZFI360_EVB_PICO", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("wiznet_5500_evb_pico", "rp2040", "WIZnet", "W5500-EVB-Pico", "0x2e8a", "0x1029", 250, "WIZNET_5500_EVB_PICO", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("wiznet_5500_evb_pico2", "rp2350", "WIZnet", "W5500-EVB-Pico2", "0x2e8a", "0x1029", 250, "WIZNET_5500_EVB_PICO2", 2, 0, "none")
|
||||
MakeBoard("wiznet_55rp20_evb_pico", "rp2040", "WIZnet", "W55RP20-EVB-Pico", "0x2e8a", "0x1029", 250, "WIZNET_55RP20_EVB_PICO", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# Generic
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user