Compare commits

...

4 commits

Author SHA1 Message Date
Limor "Ladyada" Fried
22dfda2c1c
Merge branch 'master' into master 2025-02-09 11:17:11 -05:00
ladyada
cab65de189 lol 2025-02-09 11:16:40 -05:00
Earle F. Philhower, III
c79e543c41
Move to Arduino API 10501 (#2797)
* Move to Arduino API 10501

Track upstream Arduino API headers

* IPAddress V4/V6 compatiblity restored

* Fix WiFiUDP includes

* String differences in example

* HardwareSerial using exported
2025-02-08 22:45:10 -08:00
Stefan Nürnberger
3c556e6729
fixed: Wire::writeReadAsync not setting _dmaSendBufferLen, therefore allocating the DMA buffer anew on every call (#2796)
Co-authored-by: Stefan Nuernberger <stefan@elexir.eu>
2025-02-08 14:15:18 -08:00
13 changed files with 144 additions and 11 deletions

@ -1 +1 @@
Subproject commit ece6e68f29c6f406a4434659bcbcfe558baaa3a9
Subproject commit 82928635c893189343cf8eb78569f0c4136fded0

View file

@ -110,7 +110,7 @@ extern bool __isFreeRTOS;
#endif
#ifndef PGM_VOID_P
#define PGM_VOID_P void *
#define PGM_VOID_P const void *
#endif
#ifdef __cplusplus
@ -159,3 +159,7 @@ constexpr uint64_t __bitset(const int (&a)[N], size_t i = 0U) {
#define __GPIOCNT 30
#define __FIRSTANALOGGPIO 26
#endif
#ifdef __cplusplus
using namespace arduino;
#endif

View file

@ -29,7 +29,7 @@
extern "C" typedef struct uart_inst uart_inst_t;
class SerialPIO : public HardwareSerial {
class SerialPIO : public arduino::HardwareSerial {
public:
static const pin_size_t NOPIN = 0xff; // Use in constructor to disable RX or TX unit
SerialPIO(pin_size_t tx, pin_size_t rx, size_t fifoSize = 32);

View file

@ -24,7 +24,7 @@
#include "Arduino.h"
#include "api/HardwareSerial.h"
class SerialSemiClass : public HardwareSerial {
class SerialSemiClass : public arduino::HardwareSerial {
public:
SerialSemiClass() {
/* noop */

View file

@ -29,7 +29,7 @@
extern "C" typedef struct uart_inst uart_inst_t;
#define UART_PIN_NOT_DEFINED (255u)
class SerialUART : public HardwareSerial {
class SerialUART : public arduino::HardwareSerial {
public:
SerialUART(uart_inst_t *uart, pin_size_t tx, pin_size_t rx, pin_size_t rts = UART_PIN_NOT_DEFINED, pin_size_t cts = UART_PIN_NOT_DEFINED);

View file

@ -24,7 +24,7 @@
#include "api/HardwareSerial.h"
#include <stdarg.h>
class SerialUSB : public HardwareSerial {
class SerialUSB : public arduino::HardwareSerial {
public:
SerialUSB() { }
void begin(unsigned long baud = 115200) override;

View file

@ -23,6 +23,7 @@
#include <errno.h>
#include <_syslist.h>
#include <sys/times.h>
#include <sys/unistd.h>
#include <pico/stdlib.h>
#include <pico/multicore.h>

View file

@ -56,9 +56,9 @@ extern "C" void shiftOut(pin_size_t dataPin, pin_size_t clockPin, BitOrder bitOr
}
for (i = 0; i < 8; i++) {
if (bitOrder == LSBFIRST) {
digitalWrite(dataPin, !!(val & (1 << i)));
digitalWrite(dataPin, !!(val & (1 << i)) ? HIGH : LOW);
} else {
digitalWrite(dataPin, !!(val & (1 << (7 - i))));
digitalWrite(dataPin, !!(val & (1 << (7 - i))) ? HIGH : LOW);
}
digitalWrite(clockPin, HIGH);

View file

@ -216,9 +216,9 @@ void handleFileList() {
// as an HTTP chunk
Serial.println(output);
server.sendContent(output);
output = ',';
output = ",";
} else {
output = '[';
output = "[";
}
output += "{\"type\":\"";

View file

@ -21,6 +21,7 @@
#pragma once
#include <Arduino.h>
#include <Udp.h>
#include <include/slist.h>

View file

@ -507,7 +507,7 @@ bool TwoWire::writeReadAsync(uint8_t address, const void *wbuffer, size_t wbytes
abortAsync();
// Create or enlarge dma command buffer, we need one entry for every i2c byte we want to write/read
const size_t bufLen = (wbytes + rbytes) * 2;
const size_t bufLen = (wbytes + rbytes) * sizeof(uint16_t);
if (_dmaSendBufferLen < bufLen) {
if (_dmaSendBuffer) {
free(_dmaSendBuffer);
@ -518,6 +518,7 @@ bool TwoWire::writeReadAsync(uint8_t address, const void *wbuffer, size_t wbytes
if (!_dmaSendBuffer) {
return false;
}
_dmaSendBufferLen = bufLen;
}
// Fill the dma command buffer

View file

@ -0,0 +1,55 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "none.S",
"usb_vid": "0x239A",
"usb_pid": "0x814D"
}
},
"core": "earlephilhower",
"cpu": "cortex-m33",
"extra_flags": "-DARDUINO_ADAFRUIT_METRO_RP2350 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
"f_cpu": "150000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x239A",
"0x814D"
]
],
"mcu": "rp2350",
"variant": "adafruit_metro_rp2350"
},
"debug": {
"jlink_device": "RP2350_0",
"openocd_target": "rp2350.cfg",
"svd_path": "rp2350.svd"
},
"frameworks": [
"arduino"
],
"name": "Metro 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"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "Adafruit"
}

View file

@ -0,0 +1,71 @@
#pragma once
#define PICO_RP2350B 1
// LEDs
#define PIN_LED (23u)
#define PIN_NEOPIXEL (25)
#define NUM_NEOPIXEL (1)
// 'Boot0' button also on GPIO #24
#define PIN_BUTTON (24u)
// USB host connector
#define PIN_USB_HOST_DP (32u)
#define PIN_USB_HOST_DM (33u)
#define PIN_5V_EN (29u)
#define PIN_5V_EN_STATE (1u)
// SDIO
#define PIN_SD_CLK (34u)
#define PIN_SD_CMD_MOSI (35u)
#define PIN_SD_DAT0_MISO (36u)
#define PIN_SD_DAT1 (37u)
#define PIN_SD_DAT2 (38u)
#define PIN_SD_DAT3_CS (39u)
#define PIN_SD_DETECT (40u)
#define __PIN_A0 (41u)
#define __PIN_A1 (42u)
#define __PIN_A2 (43u)
#define __PIN_A3 (44u)
#define __PIN_A4 (45u)
#define __PIN_A5 (46u)
// UARTs
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
#define PIN_SERIAL2_TX (99u) // not pinned out
#define PIN_SERIAL2_RX (99u)
// SPI
#define __SPI0_DEVICE spi1
#define PIN_SPI1_MISO (36u)
#define PIN_SPI1_MOSI (35u)
#define PIN_SPI1_SCK (34u)
#define PIN_SPI1_SS (39u)
#define __SPI1_DEVICE spi0
#define PIN_SPI0_MISO (28u)
#define PIN_SPI0_MOSI (31u)
#define PIN_SPI0_SCK (30u)
#define PIN_SPI0_SS (29u)
// Wire
#define __WIRE0_DEVICE i2c0
#define PIN_WIRE0_SDA (20u)
#define PIN_WIRE0_SCL (21u)
#define __WIRE1_DEVICE i2c1
#define PIN_WIRE1_SDA (99u) // not pinned out
#define PIN_WIRE1_SCL (99u)
#define SERIAL_HOWMANY (1u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (1u)
// PSRAM
#define RP2350_PSRAM_CS (47u)
#define RP2350_PSRAM_MAX_SCK_HZ (109*1000*1000)
#include "../generic/common.h"