Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0d8523f1a | ||
|
|
6c435c1209 | ||
|
|
f4de3cbd6d | ||
|
|
7ea9115bae | ||
|
|
49ada3418f | ||
|
|
2124367f34 | ||
|
|
93a23fdc98 | ||
|
|
49efd05fb9 | ||
|
|
a4695734a5 | ||
|
|
e67b4f69b5 | ||
|
|
46076d22b9 | ||
|
|
f1943029fd | ||
|
|
98419d884e | ||
|
|
21f34396ee | ||
|
|
8704d9e395 | ||
|
|
df81f20eb4 |
@@ -4,7 +4,7 @@
|
||||
|
||||
Raspberry Pi Pico Arduino core, for all RP2040 and RP2350 boards
|
||||
|
||||
This is a port of Arduino to the RP2040 (Raspberry Pi Pico processor) and RP2350 (Raspberry Pi Pico 2 processor). It uses the bare Raspberry Pi Pico SDK and a custom GCC 14.2/Newlib 4.3 toolchain and supports ARM and RISC-V cores.
|
||||
This is a port of Arduino to the RP2040 (Raspberry Pi Pico processor) and RP2350 (Raspberry Pi Pico 2 processor). It uses the bare Raspberry Pi Pico SDK and a custom GCC 14.3/Newlib 4.5 toolchain and supports ARM and RISC-V cores.
|
||||
|
||||
# Documentation
|
||||
See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for more detailed usage information.
|
||||
|
||||
+559
-585
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -42,7 +42,7 @@ For many BTStack examples, you simply need call the included
|
||||
called afterwards to start processing (in the background).
|
||||
|
||||
You will also need to acquire the BT ``async_context`` system lock before
|
||||
calling any BTStack APIs. ``__lockBluetooth`` and ``unlockBluetooth`` are
|
||||
calling any BTStack APIs. ``__lockBluetooth`` and ``__unlockBluetooth`` are
|
||||
provided in the PicoW variant code.
|
||||
|
||||
Note that if you need to modify the system ``btstack_config.h`` file, do so
|
||||
|
||||
+13
-8
@@ -105,14 +105,14 @@ are automatically created when you attempt to create a file in a
|
||||
subdirectory, and when the last file in a subdirectory is removed the
|
||||
subdirectory itself is automatically deleted.
|
||||
|
||||
Uploading Files to the LittleFS File System
|
||||
-------------------------------------------
|
||||
Uploading Files to the LittleFS File System on IDE 1.x (RP2040 only)
|
||||
--------------------------------------------------------------------
|
||||
|
||||
*PicoLittleFS* is a tool which integrates into the Arduino IDE. It adds a
|
||||
menu item to **Tools** menu for uploading the contents of sketch data
|
||||
directory into a new LittleFS flash file system.
|
||||
|
||||
**IDE 1.x**
|
||||
For the Pico (RP2040) only, *PicoLittleFS* is a tool which integrates into
|
||||
the obsolete Arduino 1.x IDE. It adds a menu item to **Tools** menu for uploading the
|
||||
contents of sketch data directory into a new LittleFS flash file system.
|
||||
Please note that this JAVA plug in for the obsolete 1.x IDE does **NOT**
|
||||
support the RP2350 (Pico 2).
|
||||
|
||||
- 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.
|
||||
@@ -126,7 +126,12 @@ directory into a new LittleFS 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**
|
||||
Uploading Files to the LittleFS File System on IDE 2.x (RP2040 and RP2350)
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
For the original Pico (RP2040) and Pico 2 (RP2350), use the Typescript 2.x IDE tool which
|
||||
operates in the new Arduino 2.x IDE. This tool works on all Pico and Pico 2s (and ESP32s
|
||||
if you're so inclined).
|
||||
|
||||
- Download the new tool: https://github.com/earlephilhower/arduino-littlefs-upload/releases
|
||||
- Exit the IDE, if running
|
||||
|
||||
+3
-5
@@ -63,12 +63,10 @@ Step 3: Reboot the computer
|
||||
Once the two prior stages are complete, please do a full reboot or power cycle so that the new settings will take effect.
|
||||
|
||||
|
||||
Current state of development
|
||||
----------------------------
|
||||
Updating platformio.ini to use the proper platform
|
||||
--------------------------------------------------
|
||||
|
||||
At the time of writing, PlatformIO integration for this core is a work-in-progress and not yet merged into mainline PlatformIO. This is subject to change once `this pull request <https://github.com/platformio/platform-raspberrypi/pull/36>`_ is merged.
|
||||
|
||||
If you want to use the PlatformIO integration right now, make sure you first create a standard Raspberry Pi Pico + Arduino project within PlatformIO.
|
||||
First create a standard Raspberry Pi Pico + Arduino project within PlatformIO.
|
||||
This will give you a project with the ``platformio.ini``
|
||||
|
||||
.. code:: ini
|
||||
|
||||
Submodule libraries/Adafruit_TinyUSB_Arduino updated: 6b772c0ac4...7b30ff9e14
@@ -45,7 +45,7 @@ void loop() {
|
||||
Serial.print("[HTTPS] begin...\n");
|
||||
|
||||
// configure server and url
|
||||
const char *fp = "41:FA:FD:B6:96:5F:33:09:F4:ED:09:28:BF:66:4D:5B:A2:88:03:65";
|
||||
const char *fp = "e5:e8:05:7d:85:70:b0:db:d9:5a:b6:a6:bb:2b:29:ae:d9:b1:b7:f9";
|
||||
|
||||
HTTPClient https;
|
||||
https.setFingerprint(fp);
|
||||
|
||||
@@ -323,6 +323,7 @@ bool HTTPClient::beginInternal(const String& __url, const char* expectedProtocol
|
||||
return false;
|
||||
}
|
||||
DEBUG_HTTPCLIENT("[HTTP-Client][begin] host: %s port: %d url: %s\n", _host.c_str(), _port, _uri.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -675,6 +676,7 @@ int HTTPClient::sendRequest(const char * type, const uint8_t * payload, size_t s
|
||||
}
|
||||
} while (redirect);
|
||||
|
||||
|
||||
// handle Server Response (Header)
|
||||
return returnError(code);
|
||||
}
|
||||
@@ -744,7 +746,7 @@ const String& HTTPClient::getLocation(void) {
|
||||
*/
|
||||
WiFiClient& HTTPClient::getStream(void) {
|
||||
if (connected()) {
|
||||
return *_client();
|
||||
return _stream;
|
||||
}
|
||||
|
||||
DEBUG_HTTPCLIENT("[HTTP-Client] getStream: not connected\n");
|
||||
@@ -758,7 +760,7 @@ WiFiClient& HTTPClient::getStream(void) {
|
||||
*/
|
||||
WiFiClient* HTTPClient::getStreamPtr(void) {
|
||||
if (connected()) {
|
||||
return _client();
|
||||
return &_stream;
|
||||
}
|
||||
|
||||
DEBUG_HTTPCLIENT("[HTTP-Client] getStreamPtr: not connected\n");
|
||||
@@ -808,57 +810,10 @@ int HTTPClient::writeToPrint(Print * print) {
|
||||
// return returnError(StreamReportToHttpClientReport(_client->getLastSendReport()));
|
||||
// }
|
||||
} else if (_transferEncoding == HTTPC_TE_CHUNKED) {
|
||||
int size = 0;
|
||||
while (1) {
|
||||
if (!connected()) {
|
||||
return returnError(HTTPC_ERROR_CONNECTION_LOST);
|
||||
}
|
||||
String chunkHeader = _client()->readStringUntil('\n');
|
||||
ret = StreamSendSize(&_stream, print, -1);
|
||||
|
||||
if (chunkHeader.length() <= 0) {
|
||||
return returnError(HTTPC_ERROR_READ_TIMEOUT);
|
||||
}
|
||||
|
||||
chunkHeader.trim(); // remove \r
|
||||
DEBUG_HTTPCLIENT("[HTTP-Client] chunk header: '%s'\n", chunkHeader.c_str());
|
||||
|
||||
// read size of chunk
|
||||
len = (uint32_t) strtol((const char *) chunkHeader.c_str(), nullptr, 16);
|
||||
size += len;
|
||||
DEBUG_HTTPCLIENT("[HTTP-Client] read chunk len: %d\n", len);
|
||||
|
||||
// data left?
|
||||
if (len > 0) {
|
||||
// read len bytes with timeout
|
||||
int r = StreamSendSize(_client(), print, len);
|
||||
if (r != len) {
|
||||
return HTTPC_ERROR_NO_STREAM;
|
||||
}
|
||||
|
||||
// if (_client->getLastSendReport() != Stream::Report::Success)
|
||||
// // not all data transferred
|
||||
// return returnError(StreamReportToHttpClientReport(_client->getLastSendReport()));
|
||||
ret += r;
|
||||
} else {
|
||||
|
||||
// if no length Header use global chunk size
|
||||
if (_size <= 0) {
|
||||
_size = size;
|
||||
}
|
||||
|
||||
// check if we have write all data out
|
||||
if (ret != _size) {
|
||||
return returnError(HTTPC_ERROR_STREAM_WRITE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// read trailing \r\n at the end of the chunk
|
||||
char buf[2];
|
||||
auto trailing_seq_len = _client()->readBytes((uint8_t*)buf, 2);
|
||||
if (trailing_seq_len != 2 || buf[0] != '\r' || buf[1] != '\n') {
|
||||
return returnError(HTTPC_ERROR_READ_TIMEOUT);
|
||||
}
|
||||
if (ret == 0) {
|
||||
return HTTPC_ERROR_NO_STREAM;
|
||||
}
|
||||
} else {
|
||||
return returnError(HTTPC_ERROR_ENCODING);
|
||||
@@ -1112,6 +1067,9 @@ int HTTPClient::handleHeaderResponse() {
|
||||
|
||||
_canReuse = _reuse;
|
||||
|
||||
// Hook up the HTTPStream to this WiFiClient already connected and headers decoded
|
||||
_stream.reset(_client(), false);
|
||||
|
||||
String transferEncoding;
|
||||
|
||||
_transferEncoding = HTTPC_TE_IDENTITY;
|
||||
@@ -1204,6 +1162,9 @@ int HTTPClient::handleHeaderResponse() {
|
||||
_transferEncoding = HTTPC_TE_IDENTITY;
|
||||
}
|
||||
|
||||
// Hook up the HTTPStream to this WiFiClient already connected and headers decoded
|
||||
_stream.reset(_client(), _transferEncoding == HTTPC_TE_CHUNKED);
|
||||
|
||||
if (_returnCode <= 0) {
|
||||
DEBUG_HTTPCLIENT("[HTTP-Client][handleHeaderResponse] Remote host is not an HTTP Server!");
|
||||
_returnCode = HTTPC_ERROR_NO_HTTP_SERVER;
|
||||
|
||||
@@ -176,6 +176,228 @@ typedef struct {
|
||||
} Cookie;
|
||||
typedef std::vector<Cookie> CookieJar;
|
||||
|
||||
class HTTPStream : public WiFiClient {
|
||||
public:
|
||||
HTTPStream() {
|
||||
_conn = nullptr;
|
||||
_chunked = false;
|
||||
_chunkLen = 0;
|
||||
_state = READ_HEX;
|
||||
_partial = 0;
|
||||
_eof = false;
|
||||
}
|
||||
|
||||
HTTPStream(const HTTPStream&);
|
||||
HTTPStream& operator=(const HTTPStream&);
|
||||
|
||||
void reset(WiFiClient *connection, bool chunked) {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] reset(%p, %d)\n", connection, chunked);
|
||||
_conn = connection;
|
||||
_partial = 0;
|
||||
_state = READ_HEX;
|
||||
_chunked = chunked;
|
||||
_eof = false;
|
||||
}
|
||||
|
||||
virtual size_t write(uint8_t c) override {
|
||||
return _conn->write(c);
|
||||
}
|
||||
|
||||
virtual size_t write(const uint8_t *buf, size_t size) override {
|
||||
return _conn->write(buf, size);
|
||||
}
|
||||
|
||||
virtual uint8_t connected() override {
|
||||
return _conn->connected();
|
||||
}
|
||||
|
||||
virtual int available() override {
|
||||
if (!_chunked) {
|
||||
return _conn->available();
|
||||
}
|
||||
// We're chunked at this point
|
||||
if (_eof) {
|
||||
return 0;
|
||||
}
|
||||
if (!_chunkLen) {
|
||||
tryReadChunkLen(1);
|
||||
}
|
||||
return std::min(_chunkLen, _conn->available());
|
||||
}
|
||||
|
||||
virtual int availableForWrite() override {
|
||||
return _conn->availableForWrite();
|
||||
}
|
||||
|
||||
virtual void flush() override {
|
||||
_conn->flush();
|
||||
}
|
||||
|
||||
virtual void stop() override {
|
||||
_conn->stop();
|
||||
}
|
||||
|
||||
virtual int read() override {
|
||||
if (!_chunked) {
|
||||
return _conn->read();
|
||||
}
|
||||
// We're chunked at this point
|
||||
if (_eof) {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] ::read() after EOF\n");
|
||||
return -1;
|
||||
}
|
||||
if (!_chunkLen) {
|
||||
tryReadChunkLen(_timeout);
|
||||
}
|
||||
if (!_chunkLen) {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] ::read no chunkLen\n");
|
||||
return -1;
|
||||
}
|
||||
uint32_t start = millis();
|
||||
while (((millis() - start) < _timeout) && !_conn->available() && _conn->connected()) {
|
||||
delay(1);
|
||||
}
|
||||
if (_conn->available()) {
|
||||
_chunkLen--;
|
||||
return _conn->read();
|
||||
} else {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] ::read wrapped stream failure. avail = %d, conn = %d\n", _conn->available(), _conn->connected());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
virtual int read(uint8_t *buf, size_t size) override {
|
||||
if (!_chunked) {
|
||||
return _conn->read(buf, size);
|
||||
}
|
||||
for (int i = 0; i < (int)size; i++) {
|
||||
int c = read();
|
||||
if (c < 0) {
|
||||
return i;
|
||||
}
|
||||
*(buf++) = (uint8_t)c;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
virtual int peek() override {
|
||||
if (!_chunked) {
|
||||
return _conn->peek();
|
||||
}
|
||||
// We're chunked at this point
|
||||
if (_eof) {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] ::peek after EOF\n");
|
||||
return -1;
|
||||
}
|
||||
if (!_chunkLen) {
|
||||
tryReadChunkLen(_timeout);
|
||||
}
|
||||
if (!_chunkLen) {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] ::peek no chunkLen\n");
|
||||
return -1;
|
||||
}
|
||||
uint32_t start = millis();
|
||||
while (((millis() - start) < _timeout) && !_conn->available() && _conn->connected()) {
|
||||
delay(1);
|
||||
}
|
||||
if (_conn->available()) {
|
||||
return _conn->peek();
|
||||
} else {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] ::peek wrapped stream failure. avail = %d, conn = %d\n", _conn->available(), _conn->connected());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void setTimeout(unsigned long timeout) {
|
||||
_timeout = timeout;
|
||||
_conn->setTimeout(timeout);
|
||||
}
|
||||
|
||||
private:
|
||||
void tryReadChunkLen(uint32_t to) {
|
||||
if (_state == ERROR) {
|
||||
return;
|
||||
}
|
||||
uint32_t start = millis();
|
||||
while ((millis() - start) <= to) {
|
||||
if (_conn->available()) {
|
||||
int recv = _conn->read();
|
||||
if (recv < 0) {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] Read of available data failed\n");
|
||||
_state = ERROR;
|
||||
return;
|
||||
}
|
||||
switch (_state) {
|
||||
case READ_HEX:
|
||||
if (recv == '\r') {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] Saw \\r of chunk len\r\n");
|
||||
_state = READ_LF;
|
||||
break;
|
||||
}
|
||||
if (recv >= '0' && recv <= '9') {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] Read %c of chunk size\n", recv);
|
||||
_partial <<= 4;
|
||||
_partial |= recv - '0';
|
||||
} else if (tolower(recv) >= 'a' && tolower(recv) <= 'f') {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] Read %c of chunk size\n", recv);
|
||||
_partial <<= 4;
|
||||
_partial |= tolower(recv) - 'a' + 10;
|
||||
} else {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] READ_HEX error '%c'\n", recv);
|
||||
_state = ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case READ_LF:
|
||||
if (recv != '\n') {
|
||||
_state = ERROR;
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] READ_LF error '%02x'\n", recv);
|
||||
return;
|
||||
}
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] Chunk len = %d\n", _partial);
|
||||
_chunkLen = _partial;
|
||||
_partial = 0;
|
||||
_state = TAIL_CR;
|
||||
if (_chunkLen == 0) {
|
||||
// 0-sized chunk is EOF special case
|
||||
_eof = true;
|
||||
}
|
||||
return;
|
||||
case TAIL_CR:
|
||||
if (recv == '\r') {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] Saw \\r of chunk end\n");
|
||||
_state = TAIL_LF;
|
||||
break;
|
||||
}
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] TAIL_CR error '%c'\n", recv);
|
||||
_state = ERROR;
|
||||
return;
|
||||
case TAIL_LF:
|
||||
if (recv == '\n') {
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] Saw \\n of chunk end\n");
|
||||
_state = READ_HEX;
|
||||
break;
|
||||
}
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] TAIL_LF error '%c'\n", recv);
|
||||
_state = ERROR;
|
||||
return;
|
||||
case ERROR:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_HTTPCLIENT("[HTTPStream] Timeout waiting for chunk\n");
|
||||
}
|
||||
|
||||
WiFiClient *_conn;
|
||||
bool _chunked;
|
||||
int _chunkLen;
|
||||
enum { READ_HEX, READ_LF, TAIL_CR, TAIL_LF, ERROR } _state;
|
||||
int _partial;
|
||||
bool _eof;
|
||||
};
|
||||
|
||||
|
||||
class HTTPClient {
|
||||
public:
|
||||
HTTPClient() = default;
|
||||
@@ -407,4 +629,6 @@ protected:
|
||||
std::unique_ptr<StreamString> _payload;
|
||||
// Cookie jar support
|
||||
CookieJar *_cookieJar = nullptr;
|
||||
|
||||
HTTPStream _stream;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@ PWMAudio::PWMAudio(pin_size_t pin, bool stereo) {
|
||||
_freq = 48000;
|
||||
_arb = nullptr;
|
||||
_cb = nullptr;
|
||||
_cbd = nullptr;
|
||||
_buffers = 8;
|
||||
_bufferWords = 0;
|
||||
_stereo = stereo;
|
||||
|
||||
@@ -48,36 +48,6 @@ SPISlaveClass::SPISlaveClass(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_
|
||||
_dataLeft = 0;
|
||||
}
|
||||
|
||||
inline spi_cpol_t SPISlaveClass::cpol(SPISettings _spis) {
|
||||
switch (_spis.getDataMode()) {
|
||||
case SPI_MODE0:
|
||||
return SPI_CPOL_0;
|
||||
case SPI_MODE1:
|
||||
return SPI_CPOL_0;
|
||||
case SPI_MODE2:
|
||||
return SPI_CPOL_1;
|
||||
case SPI_MODE3:
|
||||
return SPI_CPOL_1;
|
||||
}
|
||||
// Error
|
||||
return SPI_CPOL_0;
|
||||
}
|
||||
|
||||
inline spi_cpha_t SPISlaveClass::cpha(SPISettings _spis) {
|
||||
switch (_spis.getDataMode()) {
|
||||
case SPI_MODE0:
|
||||
return SPI_CPHA_0;
|
||||
case SPI_MODE1:
|
||||
return SPI_CPHA_1;
|
||||
case SPI_MODE2:
|
||||
return SPI_CPHA_0;
|
||||
case SPI_MODE3:
|
||||
return SPI_CPHA_1;
|
||||
}
|
||||
// Error
|
||||
return SPI_CPHA_0;
|
||||
}
|
||||
|
||||
bool SPISlaveClass::setRX(pin_size_t pin) {
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({0, 4, 16, 20, 32, 26}) /* SPI0 */,
|
||||
@@ -196,7 +166,7 @@ void SPISlaveClass::_handleIRQ() {
|
||||
if (cnt && _recvCB) {
|
||||
_recvCB(buff, cnt);
|
||||
}
|
||||
// Attempt to send as many ytes to the TX FIFO as we have/are free
|
||||
// Attempt to send as many bytes to the TX FIFO as we have/are free
|
||||
while (spi_is_writable(_spi)) {
|
||||
for (; _dataLeft && spi_is_writable(_spi); _dataLeft--) {
|
||||
spi_get_hw(_spi)->dr = *(_dataOut++);
|
||||
@@ -243,7 +213,7 @@ void SPISlaveClass::begin(SPISettings spis) {
|
||||
spi_init(_spi, _spis.getClockFreq());
|
||||
DEBUGSPI("SPISlave: actual baudrate=%u\n", spi_get_baudrate(_spi));
|
||||
spi_set_slave(_spi, true);
|
||||
spi_set_format(_spi, 8, cpol(spis), cpha(spis), SPI_MSB_FIRST);
|
||||
spi_set_format(_spi, 8, _helper.cpol(spis), _helper.cpha(spis), SPI_MSB_FIRST);
|
||||
|
||||
// Install our IRQ handler
|
||||
if (_spi == spi0) {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <SPI.h> // For SPIHelper
|
||||
#include <api/HardwareSPI.h>
|
||||
#include <hardware/spi.h>
|
||||
#include <functional>
|
||||
@@ -69,10 +70,6 @@ public:
|
||||
void _handleIRQ();
|
||||
|
||||
private:
|
||||
spi_cpol_t cpol(SPISettings _spis);
|
||||
spi_cpha_t cpha(SPISettings _spis);
|
||||
uint8_t reverseByte(uint8_t b);
|
||||
uint16_t reverse16Bit(uint16_t w);
|
||||
void adjustBuffer(const void *s, void *d, size_t cnt, bool by16);
|
||||
|
||||
spi_inst_t *_spi;
|
||||
@@ -89,6 +86,8 @@ private:
|
||||
size_t _dataLeft;
|
||||
|
||||
// Received data will be returned in small chunks directly from a local buffer in _handleIRQ()
|
||||
|
||||
SPIHelper _helper;
|
||||
};
|
||||
|
||||
extern SPISlaveClass SPISlave;
|
||||
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
// Lockless, IRQ-handled circular queue
|
||||
uint32_t _writer;
|
||||
uint32_t _reader;
|
||||
size_t _fifoSize = 32;
|
||||
size_t _fifoSize = 1024;
|
||||
uint8_t *_queue;
|
||||
|
||||
const int RFCOMM_SERVER_CHANNEL = 1;
|
||||
|
||||
@@ -366,10 +366,7 @@
|
||||
"name": "Waveshare RP2040 PiZero"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 Plus 4MB"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 Plus 16MB"
|
||||
"name": "Waveshare RP2040 Plus"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2040 LCD 0.96"
|
||||
@@ -377,6 +374,9 @@
|
||||
{
|
||||
"name": "Waveshare RP2040 LCD 1.28"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2350 Zero"
|
||||
},
|
||||
{
|
||||
"name": "Waveshare RP2350 Plus"
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "waveshare_rp2040_plus_4mb"
|
||||
"variant": "waveshare_rp2040_plus"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
@@ -33,7 +33,7 @@
|
||||
"arduino",
|
||||
"picosdk"
|
||||
],
|
||||
"name": "RP2040 Plus 4MB",
|
||||
"name": "RP2040 Plus",
|
||||
"upload": {
|
||||
"maximum_ram_size": 262144,
|
||||
"maximum_size": 4194304,
|
||||
+14
-14
@@ -2,15 +2,15 @@
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x1020"
|
||||
"usb_pid": "0x10B0"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-DARDUINO_WAVESHARE_RP2040_PLUS -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
|
||||
"f_cpu": "133000000L",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_WAVESHARE_RP2350_ZERO -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
@@ -18,25 +18,25 @@
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x1020"
|
||||
"0x10B0"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "waveshare_rp2040_plus_16mb"
|
||||
"mcu": "rp2350",
|
||||
"variant": "waveshare_rp2350_zero"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
"jlink_device": "RP2350_M33_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino",
|
||||
"picosdk"
|
||||
],
|
||||
"name": "RP2040 Plus 16MB",
|
||||
"name": "RP2350 Zero",
|
||||
"upload": {
|
||||
"maximum_ram_size": 262144,
|
||||
"maximum_size": 16777216,
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 4194304,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
+5
-2
@@ -350,6 +350,9 @@ def MakeBoard(name, chip, vendor_name, product_name, vid, pid, pwr, boarddefine,
|
||||
BuildCountry(name)
|
||||
BuildFlashMenu(name, chip, 8*1024*1024, [0, 7*1024*1024, 4*1024*1024, 2*1024*1024])
|
||||
BuildFlashMenu(name, chip, 16*1024*1024, [0, 15*1024*1024, 14*1024*1024, 12*1024*1024, 8*1024*1024, 4*1024*1024, 2*1024*1024])
|
||||
elif name == "waveshare_rp2040_plus":
|
||||
BuildFlashMenu(name, chip, 4*1024*1024, [*smallfs, 1024*1024, 2*1024*1024, 3*1024*1024])
|
||||
BuildFlashMenu(name, chip, 16*1024*1024, [0, 15*1024*1024, 14*1024*1024, 12*1024*1024, 8*1024*1024, 4*1024*1024, 2*1024*1024])
|
||||
elif name == "waveshare_rp2350_plus":
|
||||
BuildFlashMenu(name, chip, 4*1024*1024, [*smallfs, 1024*1024, 2*1024*1024, 3*1024*1024])
|
||||
BuildFlashMenu(name, chip, 16*1024*1024, [0, 15*1024*1024, 14*1024*1024, 12*1024*1024, 8*1024*1024, 4*1024*1024, 2*1024*1024])
|
||||
@@ -695,10 +698,10 @@ MakeBoard("waveshare_rp2040_zero", "rp2040", "Waveshare", "RP2040 Zero", "0x2e8a
|
||||
MakeBoard("waveshare_rp2040_one", "rp2040", "Waveshare", "RP2040 One", "0x2e8a", "0x103a", 500, "WAVESHARE_RP2040_ONE", 4, 0, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_matrix", "rp2040", "Waveshare", "RP2040 Matrix", "0x2e8a", "0x103a", 500, "WAVESHARE_RP2040_MATRIX", 2, 0, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_pizero", "rp2040", "Waveshare", "RP2040 PiZero", "0x2e8a", "0x0003", 500, "WAVESHARE_RP2040_PIZERO", 16, 0, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_plus_4mb", "rp2040", "Waveshare", "RP2040 Plus 4MB", "0x2e8a", "0x1020", 500, "WAVESHARE_RP2040_PLUS", 4, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_plus_16mb", "rp2040", "Waveshare", "RP2040 Plus 16MB", "0x2e8a", "0x1020", 500, "WAVESHARE_RP2040_PLUS", 16, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_plus", "rp2040", "Waveshare", "RP2040 Plus", "0x2e8a", "0x1020", 500, "WAVESHARE_RP2040_PLUS", 4, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_lcd_0_96", "rp2040", "Waveshare", "RP2040 LCD 0.96", "0x2e8a", "0x1021", 500, "WAVESHARE_RP2040_LCD_0_96", 2, 0, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
MakeBoard("waveshare_rp2040_lcd_1_28", "rp2040", "Waveshare", "RP2040 LCD 1.28", "0x2e8a", "0x1039", 500, "WAVESHARE_RP2040_LCD_1_28", 2, 0, "boot2_w25q16jvxq_4_padded_checksum")
|
||||
MakeBoard("waveshare_rp2350_zero", "rp2350", "Waveshare", "RP2350 Zero", "0x2e8a", "0x10B0", 500, "WAVESHARE_RP2350_ZERO", 4, 0, "none")
|
||||
MakeBoard("waveshare_rp2350_plus", "rp2350", "Waveshare", "RP2350 Plus", "0x2e8a", "0x10B1", 500, "WAVESHARE_RP2350_PLUS", 4, 0, "none")
|
||||
MakeBoard("waveshare_rp2350_lcd_0_96", "rp2350", "Waveshare", "RP2350 LCD 0.96", "0x2e8a", "0x10B7", 500, "WAVESHARE_RP2350_LCD_0_96", 4, 0, "none")
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#define PIN_RXD0 PIN_SERIAL1_RX
|
||||
|
||||
// Wire
|
||||
#define __WIRE0_DEVICE i2c1
|
||||
#define PIN_WIRE0_SDA PIN_SERIAL1_TX
|
||||
#define PIN_WIRE0_SCL PIN_SERIAL1_RX
|
||||
|
||||
|
||||
@@ -51,6 +51,16 @@
|
||||
|
||||
#define PICO_RP2350A 0 // RP2350B
|
||||
|
||||
// DVI connector
|
||||
#define PIN_CKN (15u)
|
||||
#define PIN_CKP (14u)
|
||||
#define PIN_D0N (13u)
|
||||
#define PIN_D0P (12u)
|
||||
#define PIN_D1N (19u)
|
||||
#define PIN_D1P (18u)
|
||||
#define PIN_D2N (17u)
|
||||
#define PIN_D2P (16u)
|
||||
|
||||
/* Pins mappings for marked pins on the board */
|
||||
static const uint8_t D0 = (0u);
|
||||
static const uint8_t D1 = (1u);
|
||||
|
||||
@@ -53,6 +53,16 @@
|
||||
|
||||
#define PICO_RP2350A 0 // RP2530B
|
||||
|
||||
// DVI connector
|
||||
#define PIN_CKN (15u)
|
||||
#define PIN_CKP (14u)
|
||||
#define PIN_D0N (13u)
|
||||
#define PIN_D0P (12u)
|
||||
#define PIN_D1N (19u)
|
||||
#define PIN_D1P (18u)
|
||||
#define PIN_D2N (17u)
|
||||
#define PIN_D2P (16u)
|
||||
|
||||
/* Pins mappings for marked pins on the board */
|
||||
static const uint8_t D0 = (0u);
|
||||
static const uint8_t D1 = (1u);
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Waveshare RP2040 Plus
|
||||
// https://www.waveshare.com/wiki/RP2040-Plus
|
||||
// https://www.waveshare.com/w/upload/d/d1/RP2040_Plus.pdf
|
||||
// https://www.waveshare.com/img/devkit/RP2040-Plus/RP2040-Plus-details-7.jpg
|
||||
//
|
||||
|
||||
/*
|
||||
Pin# Pin#
|
||||
___(_____)___
|
||||
GPIO0 1 | *USB C* | 40 VBUS
|
||||
GPIO1 2 | | 39 VSYS
|
||||
GND 3 | | 38 GND
|
||||
GPIO2 4 | | 37 3V3_EN
|
||||
GPIO3 5 | | 36 3V3(OUT)
|
||||
GPIO4 6 | | 35 ADC_VREF
|
||||
GPIO5 7 | | 34 GPIO28
|
||||
GND 8 | | 33 GND
|
||||
GPIO6 9 | | 32 GPIO27
|
||||
GPIO7 10 | | 31 GPIO26
|
||||
GPIO8 11 | | 30 RUN
|
||||
GPIO9 12 | | 29 GPIO22
|
||||
GND 13 | | 28 GND
|
||||
GPIO10 14 | | 27 GPIO21
|
||||
GPIO11 15 | | 25 GPIO20
|
||||
GPIO12 16 | | 25 GPIO19
|
||||
GPIO13 17 | | 24 GPIO18
|
||||
GND 18 | | 23 GND
|
||||
GPIO14 19 | | 22 GPIO17
|
||||
GPIO15 20 |____|_|_|____| 21 GPIO16
|
||||
S G S
|
||||
W N W
|
||||
C D D
|
||||
L I
|
||||
K N
|
||||
*/
|
||||
|
||||
// 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 (8u)
|
||||
#define PIN_WIRE0_SCL (9u)
|
||||
|
||||
#define PIN_WIRE1_SDA (6u)
|
||||
#define PIN_WIRE1_SCL (7u)
|
||||
|
||||
#define SERIAL_HOWMANY (3u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
|
||||
// Waveshare RP2350 Zero
|
||||
// https://www.waveshare.com/wiki/RP2350-Zero
|
||||
// https://files.waveshare.com/wiki/RP2350-Zero/RP2350_Zero.pdf
|
||||
// https://www.waveshare.com/img/devkit/RP2350-Zero/RP2350-Zero-details-7.jpg
|
||||
//
|
||||
|
||||
/*
|
||||
Pin# Pin#
|
||||
___(_____)___
|
||||
5v 1 | *USB C* | 23 GPIO0
|
||||
GND 2 | | 22 GPIO1
|
||||
3.3v 3 | | 21 GPIO2
|
||||
GPIO29 4 | | 20 GPIO3
|
||||
GPIO28 5 | | 19 GPIO4
|
||||
GPIO27 6 | | 18 GPIO5
|
||||
GPIO26 7 | | 17 GPIO6
|
||||
GPIO15 8 | | 16 GPIO7
|
||||
GPIO14 9 |__|_|_|_|_|__| 15 GPIO8
|
||||
1 1 1 1 1
|
||||
0 1 2 3 4
|
||||
|
||||
Pin10 = GPIO13
|
||||
Pin11 = GPIO12
|
||||
Pin12 = GPIO11
|
||||
Pin13 = GPIO10
|
||||
Pin14 = GPIO9
|
||||
*/
|
||||
|
||||
#define PICO_RP2350A 1
|
||||
|
||||
// NeoPixel
|
||||
#define PIN_NEOPIXEL (16u)
|
||||
|
||||
// Serial1
|
||||
#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 (4u)
|
||||
#define PIN_SPI0_MOSI (3u)
|
||||
#define PIN_SPI0_SCK (2u)
|
||||
#define PIN_SPI0_SS (5u)
|
||||
|
||||
#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 (2u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (2u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
Reference in New Issue
Block a user