Compare commits

..
54 Commits
Author SHA1 Message Date
Earle F. Philhower, III 500f197c02 Update version 2023-12-06 09:52:23 -08:00
Earle F. Philhower, III 2bf249ffe1 Avoid freezeing the core from LWIP under FreeRTOS (#1884)
Avoid issues with interrupts and priority inversions and other deadlocks
and use a SW based random generator for LWIP when under FreeRTOS.

This means removing any overrides for sleep_until and the two
get_rand_xx calls from the SDK, making things much saner.

Related to #1883, #1872, and other random FreeRTOS lockups.
2023-12-06 09:41:14 -08:00
Dominic PearmanandDominic Pearman 81070a0b3f Minor documentation corrections in platformio.rst. (#1885)
* Corrected minor typo.

* Removed superfluous newline.

---------

Co-authored-by: Dominic Pearman <dominic@phymorous.de>
2023-12-06 06:20:59 -08:00
GUVWAF d45a11f9e7 Disable interrupts first when idling core (#1883) 2023-12-05 11:53:41 -08:00
Earle F. Philhower, III c3a3526aad Fix SPI 16-bit transfers (#1882)
Fixes #1879
Fixes #1874
2023-12-04 17:30:43 -08:00
Earle F. Philhower, III 280fc43731 Fix SPI debug print warning (#1881) 2023-12-04 12:48:49 -08:00
Earle F. Philhower, III 762535faf9 Add documentation about MDNS + FreeRTOS = crash (#1880)
See #1875
2023-12-04 08:57:49 -08:00
GUVWAF 0e4fd0587b Replace std::bind in MDNSResponder for UDP context (#1875) 2023-12-03 08:34:35 -08:00
GUVWAF d2461a14ad Enable interrupts last when resuming other core (#1872) 2023-12-02 10:20:05 -08:00
Juraj Andrássy a1902b5f41 WiFiServer modernization (#1871) 2023-12-02 09:31:39 -08:00
Taylor Alexander aka Sequoia c2d60774af Fix small typo in analog.rst (#1869)
Change "RP20400" to "RP2040"
2023-12-01 15:17:58 -08:00
Earle F. Philhower, III 269c579846 Remove IPv6 compile warning (#1867) 2023-12-01 12:10:16 -08:00
Juraj Andrássy 91183ca22f LwipIntfDev - disconnect()/end() should not clear static IP settings (#1866) 2023-12-01 11:53:01 -08:00
Earle F. Philhower, III 971c235e8d Remove unneeded intermediate async for Ethernet (#1864)
Remove the always pending worker whose job it was to fire another async
worker after a timeout.
2023-12-01 10:50:15 -08:00
Juraj Andrássy abd3547711 WiFi and Ethernet - config static IP auto gw,mask,dns as in Arduino libs (#1862) 2023-12-01 10:24:11 -08:00
Juraj Andrássy 9181ec055d LwipIntfDev - hostByName default value for the timeout parameter (#1858)
to have standard version with two parameters
2023-11-30 08:58:15 -08:00
Juraj Andrássy 58089b1f44 wl_defintions.h wl_enc_type update (#1859) 2023-11-30 08:33:33 -08:00
Juraj Andrássy 4f62e0a4ba LwipIntfDev - added macAddress getter and DNS IP getter and setter (#1856)
and dnsIP(n) getter in WiFiClass too
2023-11-29 13:24:16 -08:00
Richard Teel dbab62c214 Added clearAPList method to WiFiMulti (#1848)
Fixes #1846
2023-11-27 15:35:36 -08:00
Earle F. Philhower, III 6a878cdee8 Only create SPI/Wire instances if variant defined (#1842)
Fixes #1841
2023-11-24 09:56:13 -08:00
noqman cebdb6c917 Add new board variant: Cytron Maker UNO RP2040 (#1838) 2023-11-24 07:13:37 -08:00
Earle F. Philhower, III 39a2bbd788 Update version 2023-11-22 07:59:00 -08:00
Earle F. Philhower, III 199314a463 Fix picotool path for Windows and Mac (#1836)
Fixes #1835
2023-11-21 13:55:32 -08:00
Earle F. Philhower, III 1020023eab Avoid infinite loop in BLE HID send (#1834)
If the BLE connection is severed, don't wait for the needToSend
flag to clear in the HID::send routine since it may never actually
clear unless the BLE connection is restored.

Partial #1817
2023-11-21 11:53:41 -08:00
Abdullah "Hayri" Kırmızıyüz a475c444c5 Added Degz Suibo RP2040 board (#1828) 2023-11-20 09:20:36 -08:00
Marco Scholl 633ac316b4 Add rp2040.getStackPointer and getFreeStack (#1816)
Fixes #1814
2023-11-16 07:57:49 -08:00
Earle F. Philhower, III 4625d2c8ab Avoid memory allocation in Ethernet callbacks (#1815)
std::bind can cause a memory allocation to occur during the periodic
polling interrupt which is a very bad thing.  Use a lambda instead.

Fixes #1812
2023-11-14 10:01:06 -08:00
David Ross Smith db7ba160ae Allow MCLK multiplier to be set on all I2S devices (#1813)
As discussed in #1765.
2023-11-13 06:57:37 -08:00
Earle F. Philhower, III ea936f00e1 Protect W5500/ENC28J60 isLinked from interrupt (#1805)
Fixes #1786
2023-11-12 11:09:09 -08:00
ZinnerC 8ac616e8db Adding capability to enable timeout for I2C (#1793) 2023-11-09 17:37:28 -08:00
Andriy Golovnya 3ce902183e Added RP2040-Eins board (#1804)
* Aggregated several earlier patches in one to add RP2040-Eins board into the project.
- Moved RP2040-ProMini in alphabetical order position.
- Added board description files for RP2040-Eins.
- Added board header file for RP2040-Eins.
- Adjusted unused pins order of RP2040-ProMini to be the same as in RP2040-Eins.
- Added RP2040-Eins to README.md.
- Renamed board files to use underscores to better fit the existing file naming style.

* Updated README.md
2023-11-05 15:32:08 +00:00
James Sleeman c34e602937 Handled already mounted disk. (#1797) 2023-11-05 10:36:56 +00:00
Nico Maas 28e25293a9 Add RAKwireless RAK11300 (#1802) 2023-11-05 10:26:19 +00:00
Krzysztof Heim 319d36531e Update wifintp.rst (#1798)
, instead of .
2023-11-01 16:09:05 +01:00
Andrew DeLisa 5bea328967 Add Sea-Picro board (#1784)
* add sea-picro board

* add configurable board URL to makeboards.py

* update board URL for sea picro

* update note about QT port

* update pin mappings

* fix board vendor/name
2023-10-28 14:29:34 +02:00
rlcamp f5f7267f44 Add Serial.dtr() and Serial.rts() methods (#1779)
* add Serial.dtr() and Serial.rts() methods

* added documentation for Serial.dtr() and Serial.rts()
2023-10-24 19:02:17 +02:00
Johnny Stene a4ad8ae0fd Fix typos in fs.rst (#1781) 2023-10-22 20:10:16 +02:00
rlcamp 44abc19d46 Use __attribute((weak)) for _write() and other stubs called by newlib, so that sketch and library code can provide non-stub implementations (#1777) 2023-10-20 14:58:51 -05:00
Cole Deck 2e93f1c9c8 Clear dirty flag after commiting EEPROM to flash (#1776)
* Clear dirty flag after commiting EEPROM to flash

* Styling: remove whitespace
2023-10-18 17:21:27 -07:00
Earle F. Philhower, III ae6847cf78 Allow changing USB HID poll rate (#1771)
Fixes #1769

Add a weak variable that can be overridden by the user to speed up or
slow down the USB HID polling speed.
2023-10-17 04:38:48 -07:00
Earle F. Philhower, III d42f0ab4b0 Update spi.rst (#1768) 2023-10-12 12:23:10 -07:00
Earle F. Philhower, III 10ddaee94d Add debugging for Bluetooth (#1767)
BTStack requires a special logger registration to enable debugging.  Add
support through the IDE menus.
2023-10-12 08:21:44 -07:00
Earle F. Philhower, III 5678bb9904 Don't break transfer16 into 2 8-bit CS periods (#1764)
With HW chip select enabled, transfer16's 2 individual byte transfers will
actualy deassert CS for a brief instant between bytes.  Avoid this by doing
a single multi-byte (2) tranfer of 16b.
2023-10-11 08:40:17 -07:00
Earle F. Philhower, III 5ecef160d4 Avoid calling spi_set_format during transactions (#1762)
Avoid potential interaction with Pico SDK 1.5.1 update that causes hiccups in
SPI transmissions.

Fixes #1760
2023-10-11 08:22:38 -07:00
Earle F. Philhower, III 52d50da56f Avoid calling spi_set_format during SPI transfers (#1762)
Avoid potential interaction with Pico SDK 1.5.1 update that causes hiccups in
SPI transmissions.  SPI.transfer16 to use 8-bit transfers.

Fixes #1760
2023-10-11 08:22:01 -07:00
Earle F. Philhower, III 47111a6eba Undo BSTstackLib warning (#1758)
Undo #1751
2023-10-08 16:42:08 -07:00
palmerr23 f6a5ef0f85 Update analog.rst (#1756)
Added text about specific dependencies between analogWriteRange and analogWriteFreq
2023-10-07 07:47:20 -07:00
Earle F. Philhower, III 7868ddee42 Allow full 8K stack for both cores, optionally (#1750)
Fixes #1749

Defining a global true `bool core1_separate_stack = true` will separate
the two cores' stacks, with core 0 using the scratch RAM while core 1
will use 8K from the heap.
2023-10-07 07:38:32 -07:00
Earle F. Philhower, III 6a0cc90a4d Update fs.rst (#1754)
Fix #1753
2023-10-05 17:24:04 -07:00
Earle F. Philhower, III 21d212a2ff Clarify LittleFS upload documentation (#1752) 2023-10-04 17:20:01 -07:00
Earle F. Philhower, III bd6b20dedd Mark the BTStackLib as unsupported (#1751)
Per https://github.com/bluekitchen/btstack/issues/529#issuecomment-1746293987
Don't run BTstackLib examples in CI
2023-10-04 09:39:01 -07:00
Earle F. Philhower, III 3cc68f82a2 Fix minor FS documentation issues (#1738) 2023-09-29 21:10:49 -07:00
Earle F. Philhower, III 4f945780e7 Remove redundant variable set in LittleFS lib (#1737) 2023-09-28 17:56:18 -07:00
Earle F. Philhower, III f08ef117b5 Point to new IDE2.x LittleFS uploader (#1736) 2023-09-28 17:47:16 -07:00
80 changed files with 4397 additions and 564 deletions
+8 -4
View File
@@ -31,6 +31,7 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* Cytron Maker Pi RP2040
* Cytron Maker Nano RP2040
* DatanoiseTV PicoADK+
* Degz Suibo RP2040
* DeRuiLab FlyBoard2040 Core
* DFRobot Beetle RP2040
* ElectronicCats Hunter Cat NFC
@@ -52,6 +53,10 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* Pimoroni PGA2040
* Pimoroni Plasma2040
* Pimoroni Tiny2040
* RAKwireless RAK11300
* Redscorp RP2040-Eins
* Redscorp RP2040-ProMini
* Sea-Picro
* Seeed Indicator RP2040
* Seeed XIAO RP2040
* Silicognition RP2040-Shim
@@ -69,7 +74,6 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* WIZnet W5100S-EVB-Pico
* WIZnet W5500-EVB-Pico
* WIZnet WizFi360-EVB-Pico
* Redscorp RP2040-ProMini
* Generic (configurable flash, I/O pins)
# Installing via Arduino Boards Manager
@@ -248,14 +252,14 @@ If you want to contribute or have bugfixes, drop me a note at <earlephilhower@ya
* [UF2CONV.PY](https://github.com/microsoft/uf2) is by Microsoft Corporation and licensed under the MIT license.
* Networking and filesystem code taken from the [ESP8266 Arduino Core](https://github.com/esp8266/Arduino) and licensed under the LGPL.
* DHCP server for AP host mode from the [Micropython Project](https://micropython.org), distributed under the MIT License.
* [FreeRTOS](https://freertos.org) is Copyright Amazon.com, Inc. or its affiliates, and distributed under the MIT license.
* [FreeRTOS](https://freertos.org) is copyright Amazon.com, Inc. or its affiliates, and distributed under the MIT license.
* [lwIP](https://savannah.nongnu.org/projects/lwip/) is (c) the Swedish Institute of Computer Science and licenced under the BSD license.
* [BearSSL](https://bearssl.org) library written by Thomas Pornin, is distributed under the [MIT License](https://bearssl.org/#legal-details).
* [UZLib](https://github.com/pfalcon/uzlib) is copyright (c) 2003 Joergen Ibsen and distributed under the zlib license.
* [LEAmDNS](https://github.com/LaborEtArs/ESP8266mDNS) is copyright multiple authors and distributed under the MIT license.
* [http-parser](https://github.com/nodejs/http-parser) is copyright Joyent, Inc. and other Node contributors.
* WebServer code modified from the [ESP32 WebServer](https://github.com/espressif/arduino-esp32/tree/master/libraries/WebServer) and is copyright (c) 2015 Ivan Grokhotkov and others
* WebServer code modified from the [ESP32 WebServer](https://github.com/espressif/arduino-esp32/tree/master/libraries/WebServer) and is copyright (c) 2015 Ivan Grokhotkov and others.
* [Xoshiro-cpp](https://github.com/Reputeless/Xoshiro-cpp) is copyright (c) 2020 Ryo Suzuki and distributed under the MIT license.
-Earle F. Philhower, III
earlephilhower@yahoo.com
+1715 -353
View File
File diff suppressed because it is too large Load Diff
+87
View File
@@ -0,0 +1,87 @@
/*
Enable BTStack debugging to a Print-able object
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
*/
#if defined(ENABLE_CLASSIC) || defined(ENABLE_BLE)
#include <Arduino.h>
#include <btstack.h>
#include <hci_dump.h>
static Print *_print;
static void _log_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len) {
if (!_print) {
return;
}
_print->printf("[BT @%lu] ", millis());
switch (packet_type) {
case HCI_COMMAND_DATA_PACKET:
_print->printf("CMD => ");
break;
case HCI_EVENT_PACKET:
_print->printf("EVT <= ");
break;
case HCI_ACL_DATA_PACKET:
_print->printf("ACL %s ", in ? "<=" : "=>");
break;
case HCI_SCO_DATA_PACKET:
_print->printf("SCO %s ", in ? "<=" : "=>");
break;
case HCI_ISO_DATA_PACKET:
_print->printf("ISO %s ", in ? "<=" : "=>");
break;
case LOG_MESSAGE_PACKET:
_print->printf("LOG -- %s\n", (char*) packet);
return;
default:
_print->printf("UNK(%x) %s ", packet_type, in ? "<=" : "=>");
break;
}
for (uint16_t i = 0; i < len; i++) {
_print->printf("%02X ", packet[i]);
}
_print->printf("\n");
}
static void _log_message(int log_level, const char * format, va_list argptr) {
(void)log_level;
char log_message_buffer[HCI_DUMP_MAX_MESSAGE_LEN];
if (!_print) {
return;
}
vsnprintf(log_message_buffer, sizeof(log_message_buffer), format, argptr);
_print->printf("[BT @%lu] LOG -- %s\n", millis(), log_message_buffer);
}
static const hci_dump_t hci_dump_instance = {
NULL,
_log_packet,
_log_message
};
void __EnableBluetoothDebug(Print &print) {
_print = &print;
hci_dump_init(&hci_dump_instance);
}
#endif
+23
View File
@@ -157,6 +157,10 @@ extern RP2040 rp2040;
extern "C" void main1();
extern "C" char __StackLimit;
extern "C" char __bss_end__;
extern "C" void setup1() __attribute__((weak));
extern "C" void loop1() __attribute__((weak));
extern "C" bool core1_separate_stack;
extern "C" uint32_t* core1_separate_stack_address;
class RP2040 {
public:
@@ -238,6 +242,25 @@ public:
return &__StackLimit - &__bss_end__;
}
inline uint32_t getStackPointer() {
uint32_t *sp;
asm volatile("mov %0, sp" : "=r"(sp));
return (uint32_t)sp;
}
inline int getFreeStack() {
const unsigned int sp = getStackPointer();
uint32_t ref = 0x20040000;
if (setup1 || loop1) {
if (core1_separate_stack) {
ref = cpuid() ? (unsigned int)core1_separate_stack_address : 0x20040000;
} else {
ref = cpuid() ? 0x20040000 : 0x20041000;
}
}
return sp - ref;
}
void idleOtherCore() {
fifo.idleOtherCore();
}
+4 -2
View File
@@ -83,6 +83,8 @@ static int __usb_task_irq;
9, TUSB_DESC_INTERFACE, _itfnum, 0, 0, TUSB_CLASS_VENDOR_SPECIFIC, RESET_INTERFACE_SUBCLASS, RESET_INTERFACE_PROTOCOL, _stridx,
int usb_hid_poll_interval __attribute__((weak)) = 10;
const uint8_t *tud_descriptor_device_cb(void) {
static tusb_desc_device_t usbd_desc_device = {
.bLength = sizeof(tusb_desc_device_t),
@@ -263,7 +265,7 @@ void __SetupUSBDescriptor() {
uint8_t hid_itf = __USBInstallSerial ? 2 : 0;
uint8_t hid_desc[TUD_HID_DESC_LEN] = {
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
TUD_HID_DESCRIPTOR(hid_itf, 0, HID_ITF_PROTOCOL_NONE, hid_report_len, EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
TUD_HID_DESCRIPTOR(hid_itf, 0, HID_ITF_PROTOCOL_NONE, hid_report_len, EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, (uint8_t)usb_hid_poll_interval)
};
uint8_t msd_itf = interface_count - 1;
@@ -400,7 +402,7 @@ bool __USBHIDReady() {
while (((millis() - start) < timeout) && tud_ready() && !tud_hid_ready()) {
tud_task();
delay(1);
delayMicroseconds(1);
}
return tud_hid_ready();
}
+2 -2
View File
@@ -1,5 +1,5 @@
#pragma once
#define ARDUINO_PICO_MAJOR 3
#define ARDUINO_PICO_MINOR 6
#define ARDUINO_PICO_REVISION 0
#define ARDUINO_PICO_VERSION_STR "3.6.0"
#define ARDUINO_PICO_REVISION 2
#define ARDUINO_PICO_VERSION_STR "3.6.2"
+8
View File
@@ -197,6 +197,14 @@ static void CheckSerialReset() {
}
}
bool SerialUSB::dtr() {
return _dtr;
}
bool SerialUSB::rts() {
return _rts;
}
extern "C" void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
(void) itf;
_dtr = dtr ? true : false;
+2
View File
@@ -43,6 +43,8 @@ public:
virtual size_t write(const uint8_t *p, size_t len) override;
using Print::write;
operator bool() override;
bool dtr();
bool rts();
void ignoreFlowControl(bool ignore = true);
-42
View File
@@ -60,45 +60,3 @@ SemaphoreHandle_t __get_freertos_mutex_for_ptr(mutex_t *m, bool recursive) {
}
return nullptr; // Need to make space for more mutex maps!
}
// The HW Random code needs a precise sleep_until() in order to assure it
// grabs the ROSC bit when it wants. Unfortunately, under FreeRTOS the
// sleep_until() becomes imprecise and the "did I get the bit when I wanted"
// check in the pico_rand code always fails and you get an infinite loop.
// This block wraps the 2 get_rand calls to set a flag to convert
// sleep_until() (which can do a task swap and cause bad timing) into a
// busy wait.
extern "C" {
static bool __inRand = false;
extern uint64_t __real_get_rand_64();
uint64_t __wrap_get_rand_64() {
if (__isFreeRTOS) {
rp2040.idleOtherCore();
__inRand = true;
auto r = __real_get_rand_64();
__inRand = false;
rp2040.resumeOtherCore();
return r;
} else {
return __real_get_rand_64();
}
}
uint32_t __wrap_get_rand_32() {
return (uint32_t) __wrap_get_rand_64();
}
extern void __real_sleep_until(absolute_time_t t);
void __wrap_sleep_until(absolute_time_t t) {
if (__inRand) {
busy_wait_until(t);
} else {
__real_sleep_until(t);
}
}
}
File diff suppressed because it is too large Load Diff
+15
View File
@@ -29,6 +29,7 @@
#include <pico/cyw43_arch.h>
#include <pico/mutex.h>
#include <sys/lock.h>
#include "_xoshiro.h"
extern void ethernet_arch_lwip_begin() __attribute__((weak));
extern void ethernet_arch_lwip_end() __attribute__((weak));
@@ -68,11 +69,25 @@ public:
extern "C" {
static XoshiroCpp::Xoshiro256PlusPlus *_lwip_rng = nullptr;
// Random number generator for LWIP. Bare metal, use the HW. FreeRTOS, use xoshiro generator to avoid needing to freeze the other core
unsigned long __lwip_rand() {
if (__isFreeRTOS) {
return (unsigned long)(*_lwip_rng)();
} else {
return get_rand_32();
}
}
// Avoid calling lwip_init multiple times
extern void __real_lwip_init();
void __wrap_lwip_init() {
static bool initted = false;
if (!initted) {
if (__isFreeRTOS) {
_lwip_rng = new XoshiroCpp::Xoshiro256PlusPlus(rp2040.getCycleCount());
}
__real_lwip_init();
initted = true;
}
+12 -1
View File
@@ -27,6 +27,7 @@
RP2040 rp2040;
extern "C" {
volatile bool __otherCoreIdled = false;
uint32_t* core1_separate_stack_address = nullptr;
};
extern void setup();
@@ -38,12 +39,14 @@ extern void startFreeRTOS() __attribute__((weak));
bool __isFreeRTOS;
volatile bool __freeRTOSinitted;
extern void __EnableBluetoothDebug(Print &);
// Weak empty variant initialization. May be redefined by variant files.
void initVariant() __attribute__((weak));
void initVariant() { }
// Optional 2nd core setup and loop
bool core1_separate_stack __attribute__((weak)) = false;
extern void setup1() __attribute__((weak));
extern void loop1() __attribute__((weak));
extern "C" void main1() {
@@ -117,6 +120,9 @@ extern "C" int main() {
#if defined DEBUG_RP2040_PORT
if (!__isFreeRTOS) {
DEBUG_RP2040_PORT.begin(115200);
#if (defined(ENABLE_BLUETOOTH) || defined(ENABLE_BLE)) && defined(DEBUG_RP2040_BLUETOOTH)
__EnableBluetoothDebug(DEBUG_RP2040_PORT);
#endif
}
#endif
@@ -132,7 +138,12 @@ extern "C" int main() {
if (!__isFreeRTOS) {
if (setup1 || loop1) {
delay(1); // Needed to make Picoprobe upload start 2nd core
multicore_launch_core1(main1);
if (core1_separate_stack) {
core1_separate_stack_address = (uint32_t*)malloc(0x2000);
multicore_launch_core1_with_stack(main1, core1_separate_stack_address, 0x2000);
} else {
multicore_launch_core1(main1);
}
}
setup();
while (true) {
+39 -13
View File
@@ -33,7 +33,9 @@
extern "C" int errno;
extern "C" ssize_t _write(int fd, const void *buf, size_t count) {
extern "C"
__attribute((weak))
ssize_t _write(int fd, const void *buf, size_t count) {
#if defined DEBUG_RP2040_PORT
(void) fd;
return DEBUG_RP2040_PORT.write((const char *)buf, count);
@@ -45,7 +47,9 @@ extern "C" ssize_t _write(int fd, const void *buf, size_t count) {
#endif
}
extern "C" int _chown(const char *path, uid_t owner, gid_t group) {
extern "C"
__attribute((weak))
int _chown(const char *path, uid_t owner, gid_t group) {
(void) path;
(void) owner;
(void) group;
@@ -53,7 +57,9 @@ extern "C" int _chown(const char *path, uid_t owner, gid_t group) {
return -1;
}
extern "C" int _close(int fd) {
extern "C"
__attribute((weak))
int _close(int fd) {
(void) fd;
errno = ENOSYS;
return -1;
@@ -72,7 +78,9 @@ extern "C" int _fork(void) {
return -1;
}
extern "C" int _fstat(int fd, struct stat *st) {
extern "C"
__attribute((weak))
int _fstat(int fd, struct stat *st) {
(void) fd;
(void) st;
errno = ENOSYS;
@@ -115,7 +123,9 @@ extern "C" void __setSystemTime(unsigned long long sec, unsigned long usec) {
__timedelta_us = newnow_us - now_us;
}
extern "C" int _isatty(int file) {
extern "C"
__attribute((weak))
int _isatty(int file) {
(void) file;
errno = ENOSYS;
return 0;
@@ -128,14 +138,18 @@ extern "C" int _kill(int pid, int sig) {
return -1;
}
extern "C" int _link(char *existing, char *newlink) {
extern "C"
__attribute((weak))
int _link(char *existing, char *newlink) {
(void) existing;
(void) newlink;
errno = ENOSYS;
return -1;
}
extern "C" int _lseek(int file, int ptr, int dir) {
extern "C"
__attribute((weak))
int _lseek(int file, int ptr, int dir) {
(void) file;
(void) ptr;
(void) dir;
@@ -143,7 +157,9 @@ extern "C" int _lseek(int file, int ptr, int dir) {
return -1;
}
extern "C" int _open(char *file, int flags, int mode) {
extern "C"
__attribute((weak))
int _open(char *file, int flags, int mode) {
(void) file;
(void) flags;
(void) mode;
@@ -151,7 +167,9 @@ extern "C" int _open(char *file, int flags, int mode) {
return -1;
}
extern "C" int _read(int file, char *ptr, int len) {
extern "C"
__attribute((weak))
int _read(int file, char *ptr, int len) {
(void) file;
(void) ptr;
(void) len;
@@ -159,7 +177,9 @@ extern "C" int _read(int file, char *ptr, int len) {
return -1;
}
extern "C" int _readlink(const char *path, char *buf, size_t bufsize) {
extern "C"
__attribute((weak))
int _readlink(const char *path, char *buf, size_t bufsize) {
(void) path;
(void) buf;
(void) bufsize;
@@ -167,14 +187,18 @@ extern "C" int _readlink(const char *path, char *buf, size_t bufsize) {
return -1;
}
extern "C" int _stat(const char *file, struct stat *st) {
extern "C"
__attribute((weak))
int _stat(const char *file, struct stat *st) {
(void) file;
(void) st;
errno = ENOSYS;
return -1;
}
extern "C" int _symlink(const char *path1, const char *path2) {
extern "C"
__attribute((weak))
int _symlink(const char *path1, const char *path2) {
(void) path1;
(void) path2;
errno = ENOSYS;
@@ -187,7 +211,9 @@ extern "C" clock_t _times(struct tms *buf) {
return -1;
}
extern "C" int _unlink(char *name) {
extern "C"
__attribute((weak))
int _unlink(char *name) {
(void) name;
errno = ENOSYS;
return -1;
+5 -1
View File
@@ -66,10 +66,14 @@ typedef enum {
} wl_status_t;
/* Encryption modes */
enum wl_enc_type { /* Values map to 802.11 encryption suites... */
enum wl_enc_type { /* Values map to 802.11 Cipher Algorithm Identifier */
ENC_TYPE_WEP = 5,
ENC_TYPE_TKIP = 2,
ENC_TYPE_WPA = ENC_TYPE_TKIP,
ENC_TYPE_CCMP = 4,
ENC_TYPE_WPA2 = ENC_TYPE_CCMP,
ENC_TYPE_GCMP = 6,
ENC_TYPE_WPA3 = ENC_TYPE_GCMP,
/* ... except these two, 7 and 8 are reserved in 802.11-2007 */
ENC_TYPE_NONE = 7,
ENC_TYPE_AUTO = 8,
+4 -2
View File
@@ -30,7 +30,7 @@ Analog Outputs
--------------
The RP2040 does not have any onboard DACs, so analog outputs are
simulated using the standard method of using pulse width modulation
(PWM) using the RP20400's hardware PWM units.
(PWM) using the RP2040's hardware PWM units.
While up to 16 PWM channels can be generated, they are not independent
and there are significant restrictions as to allowed pins in parallel.
@@ -40,7 +40,9 @@ Analog Output Restrictions
--------------------------
The PWM generator source clock restricts the legal combinations of
frequency and ranges. For example, at 1MHz only about 6 bits of range
frequency and ranges.
At a CPU frequency of 133MHz, the 16 bit maximum range decreases by 1 bit for every doubling of the default PWM frequency of 1 kHz.
For example, at 1MHz only about 6 bits of range
are possible. When you define an ``analogWriteFreq`` and ``analogWriteRange``
that can't be fulfilled by the hardware, the frequency will be preserved
but the accuracy (range) will be reduced automatically. Your code will
+1 -1
View File
@@ -13,7 +13,7 @@ Similar to the `BearSSL::WiFiClientSecure` method, sets the receive and transmit
Setting Server Certificates
~~~~~~~~~~~~~~~~~~~~~~~~~~~
TLS servers require a certificate identifying itself and containing its public key, and a private key they will use to encrypt information with. The application author is responsible for generating this certificate and key, either using a self-signed generator or using a commercial certification authority. **Do not re-use the certificates included in the examples provided.**
TLS servers require a certificate identifying itself and containing its public key, and a private key they will use to encrypt information with. The application author is responsible for generating this certificate and key, either using a self-signed generator or using a commercial certification authority. **Do not reuse the certificates included in the examples provided.**
This example command will generate a RSA 2048-bit key and certificate:
+2 -2
View File
@@ -54,9 +54,9 @@ author = u'Earle F. Philhower, III'
# built documents.
#
# The short X.Y version.
version = u'3.6.0'
version = u'3.6.2'
# The full version, including alpha/beta/rc tags.
release = u'3.6.0'
release = u'3.6.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
+28 -25
View File
@@ -18,12 +18,12 @@ The following diagram shows the flash layout used in Arduino-Pico:
::
|---------------------|-------------|----|
^ ^ ^
Sketch File system EEPROM
|----|---------------------|-------------|----|
^ ^ ^ ^
OTA Sketch File system EEPROM
The file system size is configurable via the IDE menus, rom 64k up to 15MB
(assuming you have an RP2040 boad with that much flash)
The file system size is configurable via the IDE menus, from 64k up to 15MB
(assuming you have an RP2040 board with that much flash)
**Note:** to use any of file system functions in the sketch, add the
following include to the sketch:
@@ -38,14 +38,14 @@ following include to the sketch:
Compatible Filesystem APIs
--------------------------
LittleFS is an onboard filesystem that sets asidesome program flash for
LittleFS is an onboard filesystem that sets aside some program flash for
use as a filesystem without requiring any external hardware.
SDFS is a filesystem for SD cards, based on [SdFat 2.0](https://github.com/earlephilhower/ESP8266SdFat).
It supports FAT16 and FAT32 formatted cards, and requires an external
SD card reader.
SD is the Arduino supported, somewhat old and limited SD card filesystem.
SD is the Arduino-supported, somewhat old and limited SD card filesystem.
It is recommended to use SDFS for new applications instead of SD.
All three of these filesystems can open and manipulate ``File`` and ``Dir``
@@ -75,22 +75,28 @@ Uploading Files to the LittleFS File System
menu item to **Tools** menu for uploading the contents of sketch data
directory into a new LittleFS flash file system.
**IDE 1.x**
- Download the tool: https://github.com/earlephilhower/arduino-pico-littlefs-plugin/releases
- In your Arduino sketchbook directory, create ``tools`` directory if
it doesn't exist yet.
- Unpack the tool into ``tools`` directory (the path will look like
``<home_dir>/Arduino/tools/PicoLittleFS/tool/picolittlefs.jar``)
- In your Arduino sketchbook directory, create ``tools`` directory if it doesn't exist yet.
- Unpack the tool into ``tools`` directory (the path will look like ``<home_dir>/Arduino/tools/PicoLittleFS/tool/picolittlefs.jar``)
If upgrading, overwrite the existing JAR file with the newer version.
- Restart Arduino IDE.
- Open a sketch (or create a new one and save it).
- Go to sketch directory (choose Sketch > Show Sketch Folder).
- Create a directory named ``data`` and any files you want in the file
system there.
- Create a directory named ``data`` and any files you want in the file system there.
- Make sure you have selected a board, port, and closed Serial Monitor.
- Double check theSerial Monitor is closed. Uploads will fail if the Serial
Monitor has control of the serial port.
- Select ``Tools > Pico LittleFS Data Upload``. This should start
uploading the files into the flash file system.
- Double check the Serial Monitor is closed. Uploads will fail if the Serial Monitor has control of the serial port.
- Select ``Tools > Pico LittleFS Data Upload``. This should start uploading the files into the flash file system.
**IDE 2.x**
- Download the new tool: https://github.com/earlephilhower/arduino-littlefs-upload/releases
- Exit the IDE, if running
- Copy the VSIX file manually to (Linux/Mac) ``~/.arduinoIDE/plugins/`` (you may need to make this directory yourself beforehand) or to (Windows) ``C:\Users\<username>\.arduinoIDE\``
- Restart the IDE
- Double check the Serial Monitor is closed. Uploads will fail if the Serial Monitor has control of the serial port.
- Enter ``[Ctrl]`` + ``[Shift]`` + ``[P]`` to bring up the command palette, then select/type ``Upload LittleFS to Pico/ESP8266``
SD Library Information
----------------------
@@ -131,7 +137,7 @@ before mounting. All filesystems have their own ``*Config`` (i.e.
All filesystems allow explicitly enabling/disabling formatting when
mounts fail. If you do not call this ``setConfig`` method before
perforing ``begin()``, you will get the filesystem's default
behavior and configuration. By default, SPIFFS will autoformat the
behavior and configuration. By default, LittleFS will autoformat the
filesystem if it cannot mount it, while SDFS will not.
begin
@@ -144,11 +150,10 @@ begin
This method mounts file system. It must be called before any
other FS APIs are used. Returns *true* if file system was mounted
successfully, false otherwise. With no options it will format SPIFFS
if it is unable to mount it on the first try.
successfully, false otherwise.
Note that LittleFS will automatically format the filesystem
if one is not detected. This is configurable via ``setConfig``
if one is not detected. This is configurable via ``setConfig``.
end
~~~
@@ -181,8 +186,8 @@ open
Opens a file. ``path`` should be an absolute path starting with a slash
(e.g. ``/dir/filename.txt``). ``mode`` is a string specifying access
mode. It can be one of "r", "w", "a", "r+", "w+", "a+". Meaning of these
modes is the same as for ``fopen`` C function.
mode. It can be one of "r", "w", "a", "r+", "w+", "a+". The meaning of these
modes is the same as for the ``fopen`` C function.
::
@@ -258,8 +263,6 @@ openDir
or LittleFS.openDir(path)
Opens a directory given its absolute path. Returns a *Dir* object.
Please note the previous discussion on the difference in behavior between
LittleFS and SPIFFS for this call.
remove
~~~~~~
+5 -5
View File
@@ -26,9 +26,7 @@ Arduino IDE Installation Warning
the actual Arduino application because it has issues detecting attached Pico
boards. Use the "Windows ZIP" or plain "Windows" executable (EXE) download
direct from https://arduino.cc. and allow it to install any device drivers
it suggests. Otherwise the Pico board may not be detected. Also, if trying
out the 2.0 beta Arduino please install the release 1.8 version beforehand
to ensure needed device drivers are present.
it suggests. Otherwise the Pico board may not be detected.
**Note for Linux Users**: If you installed the Arduino IDE using Flatpak, which
is common in Pop!_OS, Fedora, and Mint, among others, you may need to configure
@@ -141,11 +139,13 @@ Uploading Filesystem Images
---------------------------
The onboard flash filesystem for the Pico, LittleFS, lets you upload a filesystem image from the sketch directory for your sketch to use. Download the needed plugin from
* https://github.com/earlephilhower/arduino-pico-littlefs-plugin/releases
* `IDE 1.x`: https://github.com/earlephilhower/arduino-pico-littlefs-plugin/releases
* `IDE 2.x`: https://github.com/earlephilhower/arduino-littlefs-upload/releases
To install, follow the directions in
* https://github.com/earlephilhower/arduino-pico-littlefs-plugin/blob/master/README.md
* `IDE 1.x`: https://github.com/earlephilhower/arduino-pico-littlefs-plugin/blob/master/README.md
* `IDE 2.x`: https://github.com/earlephilhower/arduino-littlefs-upload/blob/main/README.md
For detailed usage information, please check the repo documentation available at
+16
View File
@@ -16,6 +16,22 @@ not necessarily simultaneously!).
See the ``Multicore.ino`` example in the ``rp2040`` example directory for a
quick introduction.
Stack Sizes
-----------
When the Pico is running in single core mode, core 0 has the full 8KB of stack
space available to it. When using multicore ``setup1``/``loop1`` the 8KB is split
into two 4K stacks, one per core. It is possible for core 0's stack to overwrite
core 1's stack in this case, if you go beyond the 4K limitation.
To allocate a separate 8K stack for core 1, resulting in 8K stacks being available
for both cores, simply define the following variable in your sketch and set it
to ``true``:
.. code:: cpp
bool core1_separate_stack = true;
Pausing Cores
-------------
+2 -3
View File
@@ -191,7 +191,7 @@ Debug Level
Done again by directly adding the needed `build
flags <https://github.com/earlephilhower/arduino-pico/blob/05356da2c5552413a442f742e209c6fa92823666/boards.txt#L104-L114>`__.
When wanting to define multiple build flags, they must be accumulated in
either a sing line or a newline-separated expression.
either a single line or a newline-separated expression.
.. code:: ini
@@ -397,5 +397,4 @@ The task "Build Filesystem Image" will take all files in the data directory and
The task "Upload Filesystem Image" will upload the filesystem image to the Pico via the specified ``upload_protocol``.
.. note::
Set the space available for the filesystem in the ``platformio.ini`` using e.g., ``board_build.filesystem_size = 0.5m``, or filesystem
creation will fail!
Set the space available for the filesystem in the ``platformio.ini`` using e.g., ``board_build.filesystem_size = 0.5m``, or filesystem creation will fail!
+10
View File
@@ -55,3 +55,13 @@ void Serial.ignoreFlowControl(bool ignore)
In some cases, the target application will not assert the DTR virtual line, thus preventing writing operations to succeed.
For this reason, the SerialUSB::ignoreFlowControl() method disables the connection's state verification, enabling the program to write on the port, even though the data might be lost.
bool Serial.dtr()
~~~~~~~~~~~~~~~~~
Returns the current state of the DTR virtual line. A USB CDC host (such as the Arduino serial monitor) typically raises the DTR pin when opening the device, and may lower it when closing the device.
bool Serial.rts()
~~~~~~~~~~~~~~~~~
Returns the current state of the RTS virtual line.
+1 -1
View File
@@ -40,6 +40,6 @@ in order to consunme the received data and provide data to transmit.
Examples
========
~~~~~~~~
See the SPItoMyself example for a complete Master and Slave application.
+16 -1
View File
@@ -14,13 +14,28 @@ from the IDE.
The Arduino-Pico core includes ported versions of the basic Arduino
``Keyboard``, ``Mouse`` and ``Joystick`` libraries. These libraries
allow you to emulate a keyboard, a gamepad or mouse (or all together)
with the Pico in your sketches.
with the Pico in your sketches. These libraries only are available
when using the built-in USB, not the Adafruit library.
See the examples and Arduino Reference at
https://www.arduino.cc/reference/en/language/functions/usb/keyboard/
and
https://www.arduino.cc/reference/en/language/functions/usb/mouse
HID Polling Interval
--------------------
By default, HID devices will request to be polled every 10ms (i.e. 100x
per second). If you have a higher performance need, you can override
this value by creating a global variable in your main application, set
to the polling period:
.. code:: cpp
int usb_hid_poll_interval = 1; // Set HID poll interval to 1ms (1kHz)
void setup() {
....
}
Adafruit TinyUSB Arduino Support
--------------------------------
Examples are provided in the Adafruit_TinyUSB_Arduino for the more
+3 -1
View File
@@ -42,7 +42,9 @@ Please note that WiFi on the Pico W is a work-in-progress and there are some imp
* Multicore is supported, but only core 0 may run ``WiFi`` related code.
* 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!
* 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.
The WiFi library borrows much work from the `ESP8266 Arduino Core <https://github.com/esp8266/Arduino>`__ , especially the ``WiFiClient`` and ``WiFiServer`` classes.
+1 -1
View File
@@ -5,7 +5,7 @@ NTP allows the Pico to set its internal clock using the internet, and is
required for secure connections because the certificates used have valid
date stamps.
After ``WiFi.begin()`` use ``NTP.begin(s1)`` or ``NTP,begin(s1, s2)`` to
After ``WiFi.begin()`` use ``NTP.begin(s1)`` or ``NTP.begin(s1, s2)`` to
use one or two NTP servers (common ones are ``pool.ntp.org`` and
``time.nist.gov``) .
+1
View File
@@ -2,6 +2,7 @@
// BTstack features that can be enabled
#define ENABLE_LOG_INFO
#define ENABLE_LOG_DEBUG
#define ENABLE_LOG_ERROR
#define ENABLE_PRINTF_HEXDUMP
#define ENABLE_SCO_OVER_HCI
+2 -2
View File
@@ -13,8 +13,8 @@ extern void interrupts();
#define SYS_ARCH_PROTECT(lev) noInterrupts
#define SYS_ARCH_UNPROTECT(lev) interrupts
extern unsigned long get_rand_32(void);
#define LWIP_RAND() get_rand_32()
extern unsigned long __lwip_rand(void);
#define LWIP_RAND() __lwip_rand()
// 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)
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-4
View File
@@ -209,7 +209,3 @@
-Wl,--wrap=cyw43_tcpip_link_status
-Wl,--wrap=cyw43_cb_tcpip_init
-Wl,--wrap=cyw43_cb_tcpip_deinit
-Wl,--wrap=get_rand_64
-Wl,--wrap=get_rand_32
-Wl,--wrap=sleep_until
+1
View File
@@ -124,6 +124,7 @@ bool EEPROMClass::commit() {
flash_range_program((intptr_t)_sector - (intptr_t)XIP_BASE, _data, _size);
rp2040.resumeOtherCore();
interrupts();
_dirty = false;
return true;
}
+3 -3
View File
@@ -165,14 +165,14 @@ static void __no_inline_not_in_flash_func(IdleThisCore)(void *param) {
(void) param;
while (true) {
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
vTaskPreemptionDisable(nullptr);
portDISABLE_INTERRUPTS();
vTaskPreemptionDisable(nullptr);
__otherCoreIdled = true;
while (__otherCoreIdled) {
/* noop */
}
portENABLE_INTERRUPTS();
vTaskPreemptionEnable(nullptr);
portENABLE_INTERRUPTS();
}
}
@@ -188,9 +188,9 @@ extern "C" void __no_inline_not_in_flash_func(__freertos_idle_other_core)() {
extern "C" void __no_inline_not_in_flash_func(__freertos_resume_other_core)() {
__otherCoreIdled = false;
portENABLE_INTERRUPTS();
xTaskResumeAll();
vTaskPreemptionEnable(nullptr);
portENABLE_INTERRUPTS();
}
@@ -252,8 +252,10 @@ public:
}
bool send(void *rpt, int len) {
//wait for another report to be sent
while (_needToSend);
// Wait for another report to be sent
while (connected() && _needToSend) {
/* noop busy wait */
}
_needToSend = true;
_sendReport = rpt;
_sendReportLen = len;
+1 -1
View File
@@ -134,7 +134,7 @@ bool I2S::setSysClk(int samplerate) { // optimise sys_clk for desired samplerate
}
bool I2S::setMCLKmult(int mult) {
if (_running || !_isOutput) {
if (_running) {
return false;
}
if ((mult % 64) == 0) {
@@ -20,9 +20,9 @@ void loop() {
Joystick.button(i, true);
delay(250);
Joystick.button(i, false);
delay(10); //we need a short delay here, sending packets with less than 1ms leads to packet loss!
delay(10); // We need a short delay here, sending packets with less than 1ms leads to packet loss!
}
//alternativ with manual send:
// Alternative with manual send:
Joystick.useManualSend(true);
Serial.println("Joystick buttons - manual send");
for (uint8_t i = 1; i <= 32; i++) {
@@ -33,8 +33,8 @@ void loop() {
}
Joystick.useManualSend(false);
//iterate all joystick axis
//Note: although you can use 0-1023 here (10bit), internally 8bits are used (-127 to 127)
// Iterate all joystick axis
// Note: although you can use 0-1023 here (10bit), internally 8bits are used (-127 to 127)
Serial.println("Joystick X");
for (uint16_t i = 0; i < 1023; i++) {
Joystick.X(i);
@@ -71,8 +71,8 @@ void loop() {
delay(20);
} Joystick.hat(-1);
//use int8 mode for the axis.
//Note: hat is not used differently.
// Use int8 mode for the axis.
// Note: hat is not used differently.
Serial.println("Now all axis in 8bit mode, -127 to 127");
Joystick.use8bit(true);
Serial.println("Joystick X");
@@ -20,9 +20,9 @@ void loop() {
JoystickBLE.button(i, true);
delay(250);
JoystickBLE.button(i, false);
delay(10); //we need a short delay here, sending packets with less than 1ms leads to packet loss!
delay(10); // We need a short delay here, sending packets with less than 1ms leads to packet loss!
}
//alternativ with manual send:
// Alternative with manual send:
JoystickBLE.useManualSend(true);
Serial.println("Joystick buttons - manual send");
for (uint8_t i = 1; i <= 32; i++) {
@@ -33,8 +33,8 @@ void loop() {
}
JoystickBLE.useManualSend(false);
//iterate all joystick axis
//Note: although you can use 0-1023 here (10bit), internally 8bits are used (-127 to 127)
// Iterate all joystick axis
// Note: although you can use 0-1023 here (10bit), internally 8bits are used (-127 to 127)
Serial.println("Joystick X");
for (uint16_t i = 0; i < 1023; i++) {
JoystickBLE.X(i);
@@ -71,8 +71,8 @@ void loop() {
delay(20);
} JoystickBLE.hat(-1);
//use int8 mode for the axis.
//Note: hat is not used differently.
// Use int8 mode for the axis.
// Note: hat is not used differently.
Serial.println("Now all axis in 8bit mode, -127 to 127");
JoystickBLE.use8bit(true);
Serial.println("Joystick X");
@@ -20,9 +20,9 @@ void loop() {
JoystickBT.button(i, true);
delay(250);
JoystickBT.button(i, false);
delay(10); //we need a short delay here, sending packets with less than 1ms leads to packet loss!
delay(10); // We need a short delay here, sending packets with less than 1ms leads to packet loss!
}
//alternativ with manual send:
// Alternative with manual send:
JoystickBT.useManualSend(true);
Serial.println("Joystick buttons - manual send");
for (uint8_t i = 1; i <= 32; i++) {
@@ -33,8 +33,8 @@ void loop() {
}
JoystickBT.useManualSend(false);
//iterate all joystick axis
//Note: although you can use 0-1023 here (10bit), internally 8bits are used (-127 to 127)
// Iterate all joystick axis
// Note: although you can use 0-1023 here (10bit), internally 8bits are used (-127 to 127)
Serial.println("Joystick X");
for (uint16_t i = 0; i < 1023; i++) {
JoystickBT.X(i);
@@ -71,8 +71,8 @@ void loop() {
delay(20);
} JoystickBT.hat(-1);
//use int8 mode for the axis.
//Note: hat is not used differently.
// Use int8 mode for the axis.
// Note: hat is not used differently.
Serial.println("Now all axis in 8bit mode, -127 to 127");
JoystickBT.use8bit(true);
Serial.println("Joystick X");
+1 -1
View File
@@ -161,7 +161,7 @@ bool MDNSResponder::_allocUDPContext(void) {
if (m_pUDPContext->listen(IP4_ADDR_ANY, DNS_MQUERY_PORT)) {
m_pUDPContext->setMulticastTTL(MDNS_MULTICAST_TTL);
m_pUDPContext->onRx(std::bind(&MDNSResponder::_callProcess, this));
m_pUDPContext->onRx([this] { this->_callProcess(); });
} else {
return false;
}
-1
View File
@@ -106,7 +106,6 @@ public:
if (!_mounted) {
return false;
}
info.maxOpenFiles = _maxOpenFds;
info.blockSize = _blockSize;
info.pageSize = _pageSize;
info.maxOpenFiles = _maxOpenFds;
+1
View File
@@ -18,6 +18,7 @@ beginTransaction KEYWORD2
endTransaction KEYWORD2
SPISettings KEYWORD2
transfer KEYWORD2
transfer16 KEYWORD2
setBitOrder KEYWORD2
setDataMode KEYWORD2
setClockDivider KEYWORD2
+11 -5
View File
@@ -110,8 +110,8 @@ byte SPIClassRP2040::transfer(uint8_t data) {
return 0;
}
data = (_spis.getBitOrder() == MSBFIRST) ? data : reverseByte(data);
spi_set_format(_spi, 8, cpol(), cpha(), SPI_MSB_FIRST);
DEBUGSPI("SPI::transfer(%02x), cpol=%d, cpha=%d\n", data, cpol(), cpha());
hw_write_masked(&spi_get_hw(_spi)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); // Fast set to 8-bits
spi_write_read_blocking(_spi, &data, &ret, 1);
ret = (_spis.getBitOrder() == MSBFIRST) ? ret : reverseByte(ret);
DEBUGSPI("SPI: read back %02x\n", ret);
@@ -124,8 +124,8 @@ uint16_t SPIClassRP2040::transfer16(uint16_t data) {
return 0;
}
data = (_spis.getBitOrder() == MSBFIRST) ? data : reverse16Bit(data);
spi_set_format(_spi, 16, cpol(), cpha(), SPI_MSB_FIRST);
DEBUGSPI("SPI::transfer16(%04x), cpol=%d, cpha=%d\n", data, cpol(), cpha());
hw_write_masked(&spi_get_hw(_spi)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); // Fast set to 16-bits
spi_write16_read16_blocking(_spi, &data, &ret, 1);
ret = (_spis.getBitOrder() == MSBFIRST) ? ret : reverse16Bit(ret);
DEBUGSPI("SPI: read back %02x\n", ret);
@@ -147,14 +147,14 @@ void SPIClassRP2040::transfer(const void *txbuf, void *rxbuf, size_t count) {
return;
}
hw_write_masked(&spi_get_hw(_spi)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS); // Fast set to 8-bits
DEBUGSPI("SPI::transfer(%p, %p, %d)\n", txbuf, rxbuf, count);
const uint8_t *txbuff = reinterpret_cast<const uint8_t *>(txbuf);
uint8_t *rxbuff = reinterpret_cast<uint8_t *>(rxbuf);
// MSB version is easy!
if (_spis.getBitOrder() == MSBFIRST) {
spi_set_format(_spi, 8, cpol(), cpha(), SPI_MSB_FIRST);
if (rxbuf == nullptr) { // transmit only!
spi_write_blocking(_spi, txbuff, count);
return;
@@ -191,6 +191,7 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
}
DEBUGSPI("SPI: initting SPI\n");
spi_init(_spi, _spis.getClockFreq());
spi_set_format(_spi, 8, cpol(), cpha(), SPI_MSB_FIRST);
DEBUGSPI("SPI: actual baudrate=%u\n", spi_get_baudrate(_spi));
_initted = true;
}
@@ -204,7 +205,7 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
io_rw_32 *en_reg = &irq_ctrl_base->inte[gpio / 8];
uint32_t val = ((*en_reg) >> (4 * (gpio % 8))) & 0xf;
_usingIRQs.insert_or_assign(gpio, val);
DEBUGSPI("SPI: GPIO %d = %d\n", gpio, val);
DEBUGSPI("SPI: GPIO %d = %lu\n", gpio, val);
(*en_reg) ^= val << (4 * (gpio % 8));
}
DEBUGSPI("SPI: IRQ masks after = %08x %08x %08x %08x\n", (unsigned)irq_ctrl_base->inte[0], (unsigned)irq_ctrl_base->inte[1], (unsigned)irq_ctrl_base->inte[2], (unsigned)irq_ctrl_base->inte[3]);
@@ -362,5 +363,10 @@ void SPIClassRP2040::setClockDivider(uint8_t uc_div) {
#define __SPI1_DEVICE spi1
#endif
#ifdef PIN_SPI0_MISO
SPIClassRP2040 SPI(__SPI0_DEVICE, PIN_SPI0_MISO, PIN_SPI0_SS, PIN_SPI0_SCK, PIN_SPI0_MOSI);
#endif
#ifdef PIN_SPI1_MISO
SPIClassRP2040 SPI1(__SPI1_DEVICE, PIN_SPI1_MISO, PIN_SPI1_SS, PIN_SPI1_SCK, PIN_SPI1_MOSI);
#endif
+1 -1
View File
@@ -90,7 +90,7 @@ void WebServerTemplate<ServerType, DefaultPort>::handleClient() {
_currentClient = nullptr;
}
_currentClient = new ClientType(_server.available());
_currentClient = new ClientType(_server.accept());
if (!_currentClient) {
if (_nullDelay) {
delay(1);
@@ -34,7 +34,7 @@ void loop() {
delay(1000);
Serial.printf("--loop %d\n", ++i);
delay(10);
WiFiClient client = server.available();
WiFiClient client = server.accept();
if (!client) {
return;
}
+12 -6
View File
@@ -193,7 +193,7 @@ bool WiFiClass::connected() {
param local_ip: Static ip configuration
*/
void WiFiClass::config(IPAddress local_ip) {
ip4_addr_set_u32(ip_2_ip4(&_wifi.getNetIf()->ip_addr), local_ip.v4());
_wifi.config(local_ip);
}
/* Change Ip configuration settings disabling the dhcp client
@@ -202,8 +202,7 @@ void WiFiClass::config(IPAddress local_ip) {
param dns_server: IP configuration for DNS server 1
*/
void WiFiClass::config(IPAddress local_ip, IPAddress dns_server) {
ip4_addr_set_u32(ip_2_ip4(&_wifi.getNetIf()->ip_addr), local_ip.v4());
dns_setserver(0, dns_server);
_wifi.config(local_ip, dns_server);
}
/* Change Ip configuration settings disabling the dhcp client
@@ -213,9 +212,7 @@ void WiFiClass::config(IPAddress local_ip, IPAddress dns_server) {
param gateway : Static gateway configuration
*/
void WiFiClass::config(IPAddress local_ip, IPAddress dns_server, IPAddress gateway) {
ip4_addr_set_u32(ip_2_ip4(&_wifi.getNetIf()->ip_addr), local_ip.v4());
dns_setserver(0, dns_server);
ip4_addr_set_u32(ip_2_ip4(&_wifi.getNetIf()->gw), gateway.v4());
_wifi.config(local_ip, dns_server, gateway);
}
/* Change Ip configuration settings disabling the dhcp client
@@ -326,6 +323,15 @@ IPAddress WiFiClass::gatewayIP() {
return _wifi.gatewayIP();
}
/*
Get the DNS ip address.
return: IPAddress DNS Server IP
*/
IPAddress WiFiClass::dnsIP(uint8_t dns_no) {
return _wifi.dnsIP(dns_no);
}
/*
Return the current SSID associated with the network
+7
View File
@@ -261,6 +261,13 @@ public:
*/
IPAddress gatewayIP();
/*
Get the DNS ip address.
return: IPAddress DNS Server IP
*/
IPAddress dnsIP(uint8_t dns_no = 0);
/*
Return the current SSID associated with the network
+9
View File
@@ -58,6 +58,15 @@ bool WiFiMulti::addAP(const char *ssid, const char *pass) {
return true;
}
void WiFiMulti::clearAPList() {
while (!_list.empty()) {
struct _AP ap = _list.front();
_list.pop_front();
free(ap.ssid);
free(ap.pass);
}
}
uint8_t WiFiMulti::run(uint32_t to) {
struct _scanAP {
char *ssid;
+2
View File
@@ -32,6 +32,8 @@ public:
bool addAP(const char *ssid, const char *pass = nullptr);
void clearAPList();
uint8_t run(uint32_t to = 10000);
private:
+8
View File
@@ -163,10 +163,18 @@ void WiFiServer::close() {
_listen_pcb = nullptr;
}
void WiFiServer::end() {
close();
}
void WiFiServer::stop() {
close();
}
WiFiServer::operator bool() {
return (status() != CLOSED);
}
template<typename T>
T* slist_append_tail(T* head, T* item) {
if (!head) {
+4 -2
View File
@@ -75,10 +75,10 @@ protected:
public:
WiFiServer(const IPAddress& addr, uint16_t port);
WiFiServer(uint16_t port);
WiFiServer(uint16_t port = 23);
virtual ~WiFiServer() {}
WiFiClient accept(); // https://www.arduino.cc/en/Reference/EthernetServerAccept
WiFiClient available(uint8_t* status = nullptr);
WiFiClient available(uint8_t* status = nullptr) __attribute__((deprecated("Use accept().")));
bool hasClient();
// hasClientData():
@@ -95,8 +95,10 @@ public:
bool getNoDelay();
uint8_t status();
uint16_t port() const;
void end();
void close();
void stop();
explicit operator bool();
using ClientType = WiFiClient;
+2 -2
View File
@@ -31,7 +31,7 @@ class WiFiClientSecure;
class WiFiServerSecure : public WiFiServer {
public:
WiFiServerSecure(IPAddress addr, uint16_t port);
WiFiServerSecure(uint16_t port);
WiFiServerSecure(uint16_t port = 22);
WiFiServerSecure(const WiFiServerSecure &rhs);
virtual ~WiFiServerSecure();
@@ -65,7 +65,7 @@ public:
// If awaiting connection available and authenticated (i.e. client cert), return it.
WiFiClientSecure accept(); // https://www.arduino.cc/en/Reference/EthernetServerAccept
WiFiClientSecure available(uint8_t* status = nullptr);
WiFiClientSecure available(uint8_t* status = nullptr) __attribute__((deprecated("Use accept().")));
WiFiServerSecure& operator=(const WiFiServerSecure&) = default;
+46
View File
@@ -262,6 +262,9 @@ size_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) {
_buffLen = i2c_read_blocking_until(_i2c, address, _buff, quantity, !stopBit, make_timeout_time_ms(_timeout));
if ((_buffLen == PICO_ERROR_GENERIC) || (_buffLen == PICO_ERROR_TIMEOUT)) {
if (_buffLen == PICO_ERROR_TIMEOUT) {
_handleTimeout(_reset_with_timeout);
}
_buffLen = 0;
}
_buffOff = 0;
@@ -335,12 +338,32 @@ stop:
return ack;
}
void TwoWire::_handleTimeout(bool reset) {
_timeoutFlag = true;
if (reset) {
if (_slave) {
uint8_t prev_addr = _addr;
int prev_clkHz = _clkHz;
end();
setClock(prev_clkHz);
begin(prev_addr);
} else {
int prev_clkHz = _clkHz;
end();
setClock(prev_clkHz);
begin();
}
}
}
// Errors:
// 0 : Success
// 1 : Data too long
// 2 : NACK on transmit of address
// 3 : NACK on transmit of data
// 4 : Other error
// 5 : Timeout
uint8_t TwoWire::endTransmission(bool stopBit) {
if (!_running || !_txBegun) {
return 4;
@@ -352,6 +375,10 @@ uint8_t TwoWire::endTransmission(bool stopBit) {
} else {
auto len = _buffLen;
auto ret = i2c_write_blocking_until(_i2c, _addr, _buff, _buffLen, !stopBit, make_timeout_time_ms(_timeout));
if (ret == PICO_ERROR_TIMEOUT) {
_handleTimeout(_reset_with_timeout);
return 5;
}
_buffLen = 0;
return (ret == len) ? 0 : 4;
}
@@ -422,6 +449,20 @@ void TwoWire::onRequest(void(*function)(void)) {
_onRequestCallback = function;
}
void TwoWire::setTimeout(uint32_t timeout, bool reset_with_timeout) {
_timeoutFlag = false;
Stream::setTimeout(timeout);
_reset_with_timeout = reset_with_timeout;
}
bool TwoWire::getTimeoutFlag() {
return _timeoutFlag;
}
void TwoWire::clearTimeoutFlag() {
_timeoutFlag = false;
}
#ifndef __WIRE0_DEVICE
#define __WIRE0_DEVICE i2c0
#endif
@@ -429,5 +470,10 @@ void TwoWire::onRequest(void(*function)(void)) {
#define __WIRE1_DEVICE i2c1
#endif
#ifdef PIN_WIRE0_SDA
TwoWire Wire(__WIRE0_DEVICE, PIN_WIRE0_SDA, PIN_WIRE0_SCL);
#endif
#ifdef PIN_WIRE1_SDA
TwoWire Wire1(__WIRE1_DEVICE, PIN_WIRE1_SDA, PIN_WIRE1_SCL);
#endif
+8
View File
@@ -82,6 +82,10 @@ public:
}
using Print::write;
void setTimeout(uint32_t timeout = 25, bool reset_with_timeout = false); // sets the maximum number of milliseconds to wait
bool getTimeoutFlag(void);
void clearTimeoutFlag(void);
// IRQ callback
void onIRQ();
@@ -96,6 +100,10 @@ private:
uint8_t _addr;
bool _txBegun;
bool _timeoutFlag;
bool _reset_with_timeout;
void _handleTimeout(bool reset);
uint8_t _buff[WIRE_BUFFER_SIZE];
int _buffLen;
int _buffOff;
+3 -11
View File
@@ -31,7 +31,6 @@ bool __ethernetContextInitted = false;
// Async context that pumps the ethernet controllers
static async_context_threadsafe_background_t lwip_ethernet_async_context_threadsafe_background;
static async_when_pending_worker_t always_pending_update_timeout_worker;
static async_at_time_worker_t ethernet_timeout_worker;
static async_context_t *_context = nullptr;
@@ -129,8 +128,9 @@ static async_context_t *lwip_ethernet_init_default_async_context(void) {
return NULL;
}
static uint32_t _pollingPeriod = 20;
// This will only be called under the protection of the async context mutex, so no re-entrancy checks needed
static void ethernet_timeout_reached(__unused async_context_t *context, __unused async_at_time_worker_t *worker) {
static void ethernet_timeout_reached(async_context_t *context, __unused async_at_time_worker_t *worker) {
assert(worker == &ethernet_timeout_worker);
for (auto handlePacket : _handlePacketList) {
handlePacket.second();
@@ -142,12 +142,6 @@ static void ethernet_timeout_reached(__unused async_context_t *context, __unused
#else
sys_check_timeouts();
#endif
}
static uint32_t _pollingPeriod = 20;
static void update_next_timeout(async_context_t *context, async_when_pending_worker_t *worker) {
assert(worker == &always_pending_update_timeout_worker);
worker->work_pending = true;
async_context_add_at_time_worker_in_ms(context, &ethernet_timeout_worker, _pollingPeriod);
}
@@ -164,10 +158,8 @@ void __startEthernetContext() {
#else
_context = lwip_ethernet_init_default_async_context();
#endif
always_pending_update_timeout_worker.work_pending = true;
always_pending_update_timeout_worker.do_work = update_next_timeout;
ethernet_timeout_worker.do_work = ethernet_timeout_reached;
async_context_add_when_pending_worker(_context, &always_pending_update_timeout_worker);
async_context_add_at_time_worker_in_ms(_context, &ethernet_timeout_worker, _pollingPeriod);
__ethernetContextInitted = true;
}
+42 -3
View File
@@ -61,9 +61,14 @@ public:
memset(&_netif, 0, sizeof(_netif));
}
//The argument order for ESP is not the same as for Arduino. However, there is compatibility code under the hood
//to detect Arduino arg order, and handle it correctly.
bool config(const IPAddress& local_ip, const IPAddress& arg1, const IPAddress& arg2,
const IPAddress& arg3 = IPADDR_NONE, const IPAddress& dns2 = IPADDR_NONE);
// two and one parameter version. 2nd parameter is DNS like in Arduino. IPv4 only
boolean config(IPAddress local_ip, IPAddress dns = IPADDR_NONE);
// default mac-address is inferred from esp8266's STA interface
bool begin(const uint8_t* macAddress = nullptr, const uint16_t mtu = DEFAULT_MTU);
@@ -73,6 +78,10 @@ public:
return &_netif;
}
uint8_t* macAddress(uint8_t* mac) {
memcpy(mac, &_netif.hwaddr, 6);
return mac;
}
IPAddress localIP() const {
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.ip_addr)));
}
@@ -82,6 +91,17 @@ public:
IPAddress gatewayIP() const {
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.gw)));
}
IPAddress dnsIP(int n = 0) const {
return IPAddress(dns_getserver(n));
}
void setDNS(IPAddress dns1, IPAddress dns2 = INADDR_ANY) {
if (dns1.isSet()) {
dns_setserver(0, dns1);
}
if (dns2.isSet()) {
dns_setserver(1, dns2);
}
}
// 1. Currently when no default is set, esp8266-Arduino uses the first
// DHCP client interface receiving a valid address and gateway to
@@ -107,7 +127,7 @@ public:
// ICMP echo, returns TTL
int ping(IPAddress host, uint8_t ttl, uint32_t timeout = 5000);
int hostByName(const char* aHostname, IPAddress& aResult, int timeout);
int hostByName(const char* aHostname, IPAddress& aResult, int timeout = 15000);
inline void setSPISpeed(int mhz) {
setSPISettings(SPISettings(mhz, MSBFIRST, SPI_MODE0));
@@ -249,6 +269,24 @@ bool LwipIntfDev<RawDev>::config(const IPAddress& localIP, const IPAddress& gate
}
return true;
}
template<class RawDev>
boolean LwipIntfDev<RawDev>::config(IPAddress local_ip, IPAddress dns) {
if (!local_ip.isSet()) {
return config(INADDR_ANY, INADDR_ANY, INADDR_ANY);
}
if (!local_ip.isV4()) {
return false;
}
IPAddress gw(local_ip);
gw[3] = 1;
if (!dns.isSet()) {
dns = gw;
}
return config(local_ip, gw, IPAddress(255, 255, 255, 0), dns);
}
extern char wifi_station_hostname[];
template<class RawDev>
bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
@@ -310,7 +348,7 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
return false;
}
_phID = __addEthernetPacketHandler(std::bind(&LwipIntfDev<RawDev>::handlePackets, this));
_phID = __addEthernetPacketHandler([this] { this->handlePackets(); });
if (localIP().v4() == 0) {
// IP not set, starting DHCP
@@ -337,6 +375,7 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
#endif
#if LWIP_IPV6_DHCP6_STATELESS
err_t __res = dhcp6_enable_stateless(&_netif);
(void) __res; // Not used except for debug
DEBUGV("LwipIntfDev: Enabled DHCP6 stateless: %d\n", __res);
#endif
@@ -362,7 +401,7 @@ void LwipIntfDev<RawDev>::end() {
RawDev::end();
netif_remove(&_netif);
memset(&_netif, 0, sizeof(_netif));
_started = false;
}
@@ -39,6 +39,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <LwipEthernet.h>
#include "enc28j60.h"
@@ -696,6 +697,8 @@ uint16_t ENC28J60::phyread(uint8_t reg) {
bool ENC28J60::isLinked() {
// ( https://github.com/JAndrassy/EthernetENC/tree/master/src/utility/enc28j60.h )
return !!(phyread(MACSTAT2) & 0x400);
ethernet_arch_lwip_begin();
auto ret = !!(phyread(MACSTAT2) & 0x400);
ethernet_arch_lwip_end();
return ret;
}
+7 -3
View File
@@ -38,6 +38,7 @@
#include <stdint.h>
#include <Arduino.h>
#include <SPI.h>
#include <LwipEthernet.h>
class Wiznet5500 {
public:
@@ -83,7 +84,10 @@ public:
@return true when physical link is up
*/
bool isLinked() {
return wizphy_getphylink() == PHY_LINK_ON;
ethernet_arch_lwip_begin();
auto ret = wizphy_getphylink() == PHY_LINK_ON;
ethernet_arch_lwip_end();
return ret;
}
/**
@@ -267,7 +271,7 @@ private:
/**
set the power mode of phy inside WIZCHIP. Refer to @ref PHYCFGR in W5500, @ref PHYSTATUS in
W5200
@param pmode Settig value of power down mode.
@param pmode Setting value of power down mode.
*/
int8_t wizphy_setphypmode(uint8_t pmode);
@@ -432,7 +436,7 @@ private:
/* PHYCFGR register value */
enum {
PHYCFGR_RST = ~(1 << 7), //< For PHY reset, must operate AND mask.
PHYCFGR_OPMD = (1 << 6), // Configre PHY with OPMDC value
PHYCFGR_OPMD = (1 << 6), // Configure PHY with OPMDC value
PHYCFGR_OPMDC_ALLA = (7 << 3),
PHYCFGR_OPMDC_PDOWN = (6 << 3),
PHYCFGR_OPMDC_NA = (5 << 3),
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "framework-arduinopico",
"version": "1.30600.0",
"version": "1.30602.0",
"description": "Arduino Wiring-based Framework (RPi Pico RP2040)",
"keywords": [
"framework",
+30 -15
View File
@@ -86,9 +86,15 @@
{
"name": "Cytron Maker Pi RP2040"
},
{
"name": "Cytron Maker UNO RP2040"
},
{
"name": "DatanoiseTV PicoADK"
},
{
"name": "Degz Robotics Suibo RP2040"
},
{
"name": "DeRuiLab FlyBoard2040Core"
},
@@ -155,6 +161,18 @@
{
"name": "Pimoroni Tiny2040"
},
{
"name": "RAKwireless RAK11300"
},
{
"name": "redscorp RP2040-Eins"
},
{
"name": "redscorp RP2040-ProMini"
},
{
"name": "Generic Sea-Picro"
},
{
"name": "Silicognition RP2040-Shim"
},
@@ -209,9 +227,6 @@
{
"name": "WIZnet W5500-EVB-Pico"
},
{
"name": "redscorp RP2040-ProMini"
},
{
"name": "Generic RP2040"
}
@@ -286,17 +301,17 @@
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-w64-mingw32.picotool-f6fe6b7.230911.zip",
"archiveFileName": "i686-w64-mingw32.picotool-f6fe6b7.230911.zip",
"checksum": "SHA-256:8059eb1b0c41fad5ec6da06a731f19e7d25ce21684679d9975311ecb66e0aca6",
"size": "292401"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/i686-w64-mingw32.picotool1-f6fe6b7.230911.zip",
"archiveFileName": "i686-w64-mingw32.picotool1-f6fe6b7.230911.zip",
"checksum": "SHA-256:5c8fc5a9a9a6f4cc49a84bcf4cde6f4188d64008d11754bda4da48affca39f13",
"size": "291812"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-apple-darwin15.picotool-f6fe6b7.230911.tar.gz",
"archiveFileName": "x86_64-apple-darwin15.picotool-f6fe6b7.230911.tar.gz",
"checksum": "SHA-256:01813cb827a33de73ac46450f9525855b483269b6248a5c9d123d4771b78e5d7",
"size": "845993"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-apple-darwin15.picotool1-f6fe6b7.230911.tar.gz",
"archiveFileName": "x86_64-apple-darwin15.picotool1-f6fe6b7.230911.tar.gz",
"checksum": "SHA-256:80415ab9b4b63a327b31a1b84df31883dae4080a286851a546a46badf1b7de41",
"size": "1130270"
},
{
"host": "x86_64-pc-linux-gnu",
@@ -307,10 +322,10 @@
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-w64-mingw32.picotool-f6fe6b7.230911.zip",
"archiveFileName": "x86_64-w64-mingw32.picotool-f6fe6b7.230911.zip",
"checksum": "SHA-256:08e516df547aaf42d808584e3f7f95b2c91966721f8dc377a772f67eb7b2baa4",
"size": "277242"
"url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/2.1.0-a/x86_64-w64-mingw32.picotool1-f6fe6b7.230911.zip",
"archiveFileName": "x86_64-w64-mingw32.picotool1-f6fe6b7.230911.zip",
"checksum": "SHA-256:1a0cbf35adcc1fa696af8a97ea37d9f413fb4de152713b8f97f1d0ca393a5593",
"size": "277139"
}
]
},
+1 -1
View File
@@ -20,7 +20,7 @@
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Raspberry Pi RP2040 Boards
version=3.6.0
version=3.6.2
# Required discoveries and monitors
# ---------------------------------
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0x1071"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_CYTRON_MAKER_UNO_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0x1071"
]
],
"mcu": "rp2040",
"variant": "cytron_maker_uno_rp2040"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Maker UNO RP2040",
"upload": {
"maximum_ram_size": 270336,
"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",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "Cytron"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_generic_03h_4_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0xF00A"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_DEGZ_SUIBO_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0xF00A"
]
],
"mcu": "rp2040",
"variant": "degz_suibo"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Suibo RP2040",
"upload": {
"maximum_ram_size": 270336,
"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",
"pico-debug"
]
},
"url": "https://www.degzrobotics.com/suibo",
"vendor": "Degz Robotics"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q16jvxq_4_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0x00C0"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_RAKWIRELESS_RAK11300 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0x00C0"
]
],
"mcu": "rp2040",
"variant": "rakwireless_rak11300"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "RAK11300",
"upload": {
"maximum_ram_size": 270336,
"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",
"pico-debug"
]
},
"url": "https://store.rakwireless.com/products/wisduo-lpwan-module-rak11300",
"vendor": "RAKwireless"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x2341",
"usb_pid": "0x005F"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_REDSCORP_RP2040_EINS -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2341",
"0x005F"
]
],
"mcu": "rp2040",
"variant": "redscorp_rp2040_eins"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "RP2040-Eins",
"upload": {
"maximum_ram_size": 270336,
"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",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "redscorp"
}
@@ -22,7 +22,7 @@
]
],
"mcu": "rp2040",
"variant": "redscorp-rp2040-promini"
"variant": "redscorp_rp2040_promini"
},
"debug": {
"jlink_device": "RP2040_M0_0",
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q64jv_4_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0xF00A"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_SEA_PICRO -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0xF00A"
]
],
"mcu": "rp2040",
"variant": "sea_picro"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Sea-Picro",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 8388608,
"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",
"pico-debug"
]
},
"url": "https://github.com/joshajohnson/sea-picro",
"vendor": "Generic"
}
+1
View File
@@ -2,6 +2,7 @@
// BTstack features that can be enabled
#define ENABLE_LOG_INFO
#define ENABLE_LOG_DEBUG
#define ENABLE_LOG_ERROR
#define ENABLE_PRINTF_HEXDUMP
#define ENABLE_SCO_OVER_HCI
+2 -2
View File
@@ -13,8 +13,8 @@ extern void interrupts();
#define SYS_ARCH_PROTECT(lev) noInterrupts
#define SYS_ARCH_UNPROTECT(lev) interrupts
extern unsigned long get_rand_32(void);
#define LWIP_RAND() get_rand_32()
extern unsigned long __lwip_rand(void);
#define LWIP_RAND() __lwip_rand()
// 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)
+21 -9
View File
@@ -28,8 +28,8 @@ def BuildDebugPort(name):
print("%s.menu.dbgport.%s.build.debug_port=-DDEBUG_RP2040_PORT=%s" % (name, p, p))
def BuildDebugLevel(name):
for l in [ ("None", ""), ("Core", "-DDEBUG_RP2040_CORE"), ("SPI", "-DDEBUG_RP2040_SPI"), ("Wire", "-DDEBUG_RP2040_WIRE"),
("All", "-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE"), ("NDEBUG", "-DNDEBUG") ]:
for l in [ ("None", ""), ("Core", "-DDEBUG_RP2040_CORE"), ("SPI", "-DDEBUG_RP2040_SPI"), ("Wire", "-DDEBUG_RP2040_WIRE"), ("Bluetooth", "-DDEBUG_RP2040_BLUETOOTH"),
("All", "-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE -DDEBUG_RP2040_BLUETOOTH"), ("NDEBUG", "-DNDEBUG") ]:
print("%s.menu.dbglvl.%s=%s" % (name, l[0], l[0]))
print("%s.menu.dbglvl.%s.build.debug_level=%s" % (name, l[0], l[1]))
@@ -205,7 +205,7 @@ def BuildGlobalMenuList():
print("menu.ipbtstack=IP/Bluetooth Stack")
print("menu.uploadmethod=Upload Method")
def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra = None):
def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra = None, board_url = None):
fssizelist = [ 0, 64 * 1024, 128 * 1024, 256 * 1024, 512 * 1024 ]
for i in range(1, flashsizemb):
fssizelist.append(i * 1024 * 1024)
@@ -236,13 +236,13 @@ def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flash
elif name.startswith("adafruit") and "w25q080" in boot2:
BuildBootW25Q(name)
BuildUploadMethodMenu(name)
MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra)
MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra, board_url)
global pkgjson
thisbrd = {}
thisbrd['name'] = "%s %s" % (vendor_name, product_name)
pkgjson['packages'][0]['platforms'][0]['boards'].append(thisbrd)
def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra):
def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra, board_url):
if type(pid) == list:
pid = pid[0]
if extra != None:
@@ -304,7 +304,7 @@ def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, f
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"url": "BOARDURL",
"vendor": "VENDORNAME"
}\n"""\
.replace('VARIANTNAME', name)\
@@ -312,6 +312,7 @@ def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, f
.replace('BOOT2', boot2)\
.replace('VID', vid.upper().replace("X", "x"))\
.replace('PID', pid.upper().replace("X", "x"))\
.replace('BOARDURL', board_url or 'https://www.raspberrypi.org/products/raspberry-pi-pico/')\
.replace('VENDORNAME', vendor_name)\
.replace('PRODUCTNAME', product_name)\
.replace('FLASHSIZE', str(1024*1024*flashsizemb))\
@@ -369,10 +370,14 @@ MakeBoard("bridgetek_idm2040-7a", "BridgeTek", "IDM2040-7A", "0x2e8a", "0x1041",
# Cytron
MakeBoard("cytron_maker_nano_rp2040", "Cytron", "Maker Nano RP2040", "0x2e8a", "0x100f", 250, "CYTRON_MAKER_NANO_RP2040", 2, "boot2_w25q080_2_padded_checksum")
MakeBoard("cytron_maker_pi_rp2040", "Cytron", "Maker Pi RP2040", "0x2e8a", "0x1000", 250, "CYTRON_MAKER_PI_RP2040", 2, "boot2_w25q080_2_padded_checksum")
MakeBoard("cytron_maker_uno_rp2040", "Cytron", "Maker UNO RP2040", "0x2e8a", "0x1071", 250, "CYTRON_MAKER_UNO_RP2040", 2, "boot2_w25q080_2_padded_checksum")
# DatanoiseTV
MakeBoard("datanoisetv_picoadk", "DatanoiseTV", "PicoADK", "0x2e8a", "0x000a", 250, "DATANOISETV_PICOADK", 2, "boot2_w25q080_2_padded_checksum")
# Degz Robotics
MakeBoard("degz_suibo", "Degz Robotics", "Suibo RP2040", "0x2e8a", "0xf00a", 250, "DEGZ_SUIBO_RP2040", 16, "boot2_generic_03h_4_padded_checksum", board_url="https://www.degzrobotics.com/suibo")
# DeRuiLab
MakeBoard("flyboard2040_core", "DeRuiLab", "FlyBoard2040Core", "0x2e8a", "0x008a", 500, "FLYBOARD2040_CORE", 4, "boot2_w25q080_2_padded_checksum")
@@ -413,6 +418,16 @@ MakeBoard("pimoroni_pga2040", "Pimoroni", "PGA2040", "0x2e8a", "0x1008", 250, "P
MakeBoard("pimoroni_plasma2040", "Pimoroni", "Plasma2040", "0x2e8a", "0x100a", 500, "PIMORONI_PLASMA2040", 2, "boot2_w25q080_2_padded_checksum")
MakeBoard("pimoroni_tiny2040", "Pimoroni", "Tiny2040", "0x2e8a", "0x100a", 500, "PIMORONI_TINY2040", 2, "boot2_w25q64jv_4_padded_checksum")
# RAKwireless
MakeBoard("rakwireless_rak11300", "RAKwireless", "RAK11300", "0x2e8a", "0x00c0", 500, "RAKWIRELESS_RAK11300", 2, "boot2_w25q16jvxq_4_padded_checksum", None, "https://store.rakwireless.com/products/wisduo-lpwan-module-rak11300")
# Redscorp
MakeBoard("redscorp_rp2040_eins", "redscorp", "RP2040-Eins", "0x2341", ["0x005f", "0x805f", "0x015f", "0x025f"] , 250, "REDSCORP_RP2040_EINS", 16, "boot2_w25q080_2_padded_checksum")
MakeBoard("redscorp_rp2040_promini", "redscorp", "RP2040-ProMini", "0x2341", ["0x005f", "0x805f", "0x015f", "0x025f"] , 250, "REDSCORP_RP2040_PROMINI", 16, "boot2_w25q080_2_padded_checksum")
# Sea-Picro
MakeBoard("sea_picro", "Generic", "Sea-Picro", "0x2e8a", "0xf00a", 500, "SEA_PICRO", 8, "boot2_w25q64jv_4_padded_checksum", None, "https://github.com/joshajohnson/sea-picro")
# Silicognition
MakeBoard("silicognition_rp2040_shim", "Silicognition", "RP2040-Shim", "0x1209", "0xf502", 500, "SILICOGNITION_RP2040_SHIM", 4, "boot2_generic_03h_4_padded_checksum")
@@ -449,9 +464,6 @@ MakeBoard("wiznet_5100s_evb_pico", "WIZnet", "W5100S-EVB-Pico", "0x2e8a", "0x102
MakeBoard("wiznet_wizfi360_evb_pico", "WIZnet", "WizFi360-EVB-Pico", "0x2e8a", "0x1028", 250, "WIZNET_WIZFI360_EVB_PICO", 2, "boot2_w25q080_2_padded_checksum")
MakeBoard("wiznet_5500_evb_pico", "WIZnet", "W5500-EVB-Pico", "0x2e8a", "0x1029", 250, "WIZNET_5500_EVB_PICO", 2, "boot2_w25q080_2_padded_checksum")
# AG
MakeBoard("redscorp-rp2040-promini", "redscorp", "RP2040-ProMini", "0x2341", ["0x005f", "0x805f", "0x015f", "0x025f"] , 250, "REDSCORP_RP2040_PROMINI", 16, "boot2_w25q080_2_padded_checksum")
# Generic
MakeBoard("generic", "Generic", "RP2040", "0x2e8a", "0xf00a", 250, "GENERIC_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
+5
View File
@@ -279,6 +279,11 @@ def get_drives():
match = re.search(r'Mounted\s+.*\s+at\s+([^\.\r\n]*)', stdoutput)
if match:
drives = [match.group(1)]
else:
stderror = proc_out.stderr.decode("UTF-8")
match = re.search(r'already mounted at\s+[`\']([^\.\r\n\'`]+)', stderror)
if match:
drives = [match.group(1)]
except Exception as ex:
print("Exception executing udisksctl. Exception: {}".format(ex))
# If it fails, no problem since it was a heroic attempt
@@ -0,0 +1,53 @@
#pragma once
// LEDs
#define PIN_LED (3u)
// Neopixel
#define PIN_NEOPIXEL (25u)
#define NUM_NEOPIXEL (2u)
#define PIN_RGB PIN_NEOPIXEL
// Buzzer
#define PIN_BUZZER (8u)
// Button
#define PIN_BUTTON (2u)
// Serial 1
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
// Serial 2 (Not pinned out)
#define PIN_SERIAL2_TX (31u)
#define PIN_SERIAL2_RX (31u)
// SPI 0
#define PIN_SPI0_MISO (12u)
#define PIN_SPI0_MOSI (11u)
#define PIN_SPI0_SCK (10u)
#define PIN_SPI0_SS (13u)
// SPI 1 (Not pinned out)
#define PIN_SPI1_MISO (31u)
#define PIN_SPI1_MOSI (31u)
#define PIN_SPI1_SCK (31u)
#define PIN_SPI1_SS (31u)
// Wire
#define PIN_WIRE0_SDA (20u)
#define PIN_WIRE0_SCL (21u)
#define PIN_WIRE1_SDA (26u)
#define PIN_WIRE1_SCL (27u)
#define SERIAL_HOWMANY (1u)
#define SPI_HOWMANY (1u)
#define WIRE_HOWMANY (1u)
#include "../generic/common.h"
+76
View File
@@ -0,0 +1,76 @@
#pragma once
#include <stdint.h>
#define PINS_COUNT (30u)
#define NUM_DIGITAL_PINS (30u)
#define NUM_ANALOG_INPUTS (4u)
#define NUM_ANALOG_OUTPUTS (0u)
#define ADC_RESOLUTION (12u)
#ifdef PIN_LED
#define LED_BUILTIN PIN_LED
#endif
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 D23 = (23u);
static const uint8_t D24 = (24u);
static const uint8_t D25 = (25u);
static const uint8_t D26 = (26u);
static const uint8_t D27 = (27u);
static const uint8_t D28 = (28u);
static const uint8_t D29 = (29u);
#ifdef __PIN_A0
static const uint8_t A0 = __PIN_A0;
#else
static const uint8_t A0 = (26u);
#endif
#ifdef __PIN_A1
static const uint8_t A1 = __PIN_A1;
#else
static const uint8_t A1 = (27u);
#endif
#ifdef __PIN_A2
static const uint8_t A2 = __PIN_A2;
#else
static const uint8_t A2 = (28u);
#endif
#ifdef __PIN_A3
static const uint8_t A3 = __PIN_A3;
#else
static const uint8_t A3 = (29u);
#endif
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;
+39
View File
@@ -0,0 +1,39 @@
#pragma once
// Pin definitions taken from:
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
// LEDs
#define PIN_LED (25u)
// Serial
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
#define PIN_SERIAL2_TX (8u)
#define PIN_SERIAL2_RX (9u)
// SPI
#define PIN_SPI0_MISO (16u)
#define PIN_SPI0_MOSI (19u)
#define PIN_SPI0_SCK (18u)
#define PIN_SPI0_SS (17u)
#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (15u)
#define PIN_SPI1_SCK (14u)
#define PIN_SPI1_SS (13u)
// Wire
#define PIN_WIRE0_SDA (4u)
#define PIN_WIRE0_SCL (5u)
#define PIN_WIRE1_SDA (26u)
#define PIN_WIRE1_SCL (27u)
#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (2u)
#include "../generic/common.h"
@@ -0,0 +1,46 @@
#pragma once
// Pin definitions taken from:
// RAK definition: https://github.com/RAKWireless/RAK-RP-Arduino/
// RAK datasheet: https://docs.rakwireless.com/Product-Categories/WisDuo/RAK11300-Module/Datasheet/#overview
// Internal wiring of SX1262 module: https://forum.rakwireless.com/t/rak11300-pinout-rp2040-to-sx1262/8414/
// Serial
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
#define PIN_SERIAL2_TX (5u)
#define PIN_SERIAL2_RX (4u)
// SPI
#define PIN_SPI0_MISO (16u)
#define PIN_SPI0_MOSI (19u)
#define PIN_SPI0_SCK (18u)
#define PIN_SPI0_SS (17u)
// Hardwired to SX1262 Radio
#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (11u)
#define PIN_SPI1_SCK (10u)
#define PIN_SPI1_SS (13u)
// Reset / NReset PIN
#define PIN_SX1262_NRESET (14u)
// Busy / GPIO PIN
#define PIN_SX1262_BUSY (15u)
// DIO1 / IRQ PIN
#define PIN_SX1262_DIO1 (29u)
// Antenna Switch power control
#define PIN_SX1262_ANT_PWR (25u)
// Wire
#define PIN_WIRE0_SDA (2u)
#define PIN_WIRE0_SCL (3u)
#define PIN_WIRE1_SDA (20u)
#define PIN_WIRE1_SCL (21u)
#define SERIAL_HOWMANY (2u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (2u)
#include "../generic/common.h"
@@ -0,0 +1,105 @@
/* RP2040-Eins board support
URL: https://github.com/red-scorp/RP2040-Eins
Based on Arduino Nano Connect configuration */
#pragma once
// Pin definitions taken from:
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
static const uint8_t D0 = (1u);
static const uint8_t D1 = (0u);
static const uint8_t D2 = (25u);
static const uint8_t D3 = (15u);
static const uint8_t D4 = (16u);
static const uint8_t D5 = (17u);
static const uint8_t D6 = (18u);
static const uint8_t D7 = (19u);
static const uint8_t D8 = (20u);
static const uint8_t D9 = (21u);
static const uint8_t D10 = (5u);
static const uint8_t D11 = (7u);
static const uint8_t D12 = (4u);
static const uint8_t D13 = (6u);
static const uint8_t D14 = (26u);
static const uint8_t D15 = (27u);
static const uint8_t D16 = (28u);
static const uint8_t D17 = (29u);
static const uint8_t D18 = (12u);
static const uint8_t D19 = (13u);
static const uint8_t D20 = (22u);
static const uint8_t D21 = (23u);
static const uint8_t D22 = (9u);
static const uint8_t D23 = (10u);
static const uint8_t D24 = (11u);
static const uint8_t D25 = (8u);
static const uint8_t D26 = (2u);
static const uint8_t D27 = (24u);
static const uint8_t D28 = (3u);
static const uint8_t D29 = (14u);
static const uint8_t A0 = (26u);
static const uint8_t A1 = (27u);
static const uint8_t A2 = (28u);
static const uint8_t A3 = (29u);
// LEDs
#define PIN_LED (D13)
#define PIN_LED_R (D22)
#define PIN_LED_G (D23)
#define PIN_LED_B (D24)
#define LED_BUILTIN PIN_LED
// Serial
#define PIN_SERIAL1_TX (D1)
#define PIN_SERIAL1_RX (D0)
#define PIN_SERIAL2_TX (D25)
#define PIN_SERIAL2_RX (D26)
#define PIN_SERIAL2_CTS (D27)
#define PIN_SERIAL2_RTS (D28)
// SPI
#define PIN_SPI0_MISO (D12)
#define PIN_SPI0_MOSI (D11)
#define PIN_SPI0_SCK (D13)
#define PIN_SPI0_SS (D10)
#define PIN_SPI1_MISO (D25)
#define PIN_SPI1_MOSI (D28)
#define PIN_SPI1_SCK (D29)
#define PIN_SPI1_SS (D10)
// Wire
#define PIN_WIRE0_SDA (D18)
#define PIN_WIRE0_SCL (D19)
#define PIN_WIRE1_SDA (D14)
#define PIN_WIRE1_SCL (D15)
#define SERIAL_HOWMANY (3u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (1u)
#define PINS_COUNT (30u)
#define NUM_DIGITAL_PINS (30u)
#define NUM_ANALOG_INPUTS (4u)
#define NUM_ANALOG_OUTPUTS (0u)
#define ADC_RESOLUTION (12u)
#define DigitalPinToPinName(p) (p)
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;
// Some random stuff
#define SERIAL_PORT_USBVIRTUAL SerialUSB
#define SERIAL_PORT_MONITOR SerialUSB
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial2
#define CRYPTO_WIRE Wire
#define USB_MAX_POWER (500)
@@ -28,13 +28,13 @@ static const uint8_t D18 = (12u);
static const uint8_t D19 = (13u);
static const uint8_t D20 = (22u);
static const uint8_t D21 = (23u);
static const uint8_t D22 = (2u);
static const uint8_t D23 = (24u);
static const uint8_t D24 = (3u);
static const uint8_t D22 = (9u);
static const uint8_t D23 = (10u);
static const uint8_t D24 = (11u);
static const uint8_t D25 = (8u);
static const uint8_t D26 = (9u);
static const uint8_t D27 = (10u);
static const uint8_t D28 = (11u);
static const uint8_t D26 = (2u);
static const uint8_t D27 = (24u);
static const uint8_t D28 = (3u);
static const uint8_t D29 = (14u);
static const uint8_t A0 = (26u);
@@ -44,6 +44,7 @@ static const uint8_t A3 = (29u);
// LEDs
#define PIN_LED (D13)
#define LED_BUILTIN PIN_LED
// Serial
#define PIN_SERIAL1_TX (D1)
@@ -82,7 +83,6 @@ static const uint8_t A3 = (29u);
#define NUM_ANALOG_OUTPUTS (0u)
#define ADC_RESOLUTION (12u)
#define LED_BUILTIN PIN_LED
#define DigitalPinToPinName(p) (p)
static const uint8_t SS = PIN_SPI0_SS;
+42
View File
@@ -0,0 +1,42 @@
#pragma once
// Pin definitions taken from:
// https://github.com/joshajohnson/sea-picro/blob/master/documentation/pinout/sea-picro-top-pinout-rory-render.png
// LEDs not pinned out
#define PIN_LED (31u)
// Serial
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
// Not pinned out
#define PIN_SERIAL2_TX (31u)
#define PIN_SERIAL2_RX (31u)
// SPI
#define PIN_SPI0_MISO (20u)
#define PIN_SPI0_MOSI (23u)
#define PIN_SPI0_SCK (22u)
#define PIN_SPI0_SS (21u)
#define PIN_SPI1_MISO (12u)
#define PIN_SPI1_MOSI (13u)
#define PIN_SPI1_SCK (14u)
#define PIN_SPI1_SS (15u)
// Wire
#define PIN_WIRE0_SDA (4u)
#define PIN_WIRE0_SCL (5u)
// Not pinned out
#define PIN_WIRE1_SDA (2u)
#define PIN_WIRE1_SCL (3u)
#define SERIAL_HOWMANY (1u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (2u)
#define PIN_NEOPIXEL (25u)
#include "../generic/common.h"