Compare commits
+1
-1
Submodule ArduinoCore-API updated: ece6e68f29...82928635c8
@@ -25,6 +25,7 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
|
||||
* Adafruit KB2040
|
||||
* Adafruit Macropad RP2040
|
||||
* Adafruit Metro RP2040
|
||||
* Adafruit Metro RP2350
|
||||
* Adafruit QTPy RP2040
|
||||
* Adafruit STEMMA Friend RP2040
|
||||
* Adafruit Trinkey RP2040 QT
|
||||
@@ -68,16 +69,21 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
|
||||
* Melopero Cookie RP2040
|
||||
* Melopero Shake RP2040
|
||||
* METE HOCA Akana R1
|
||||
* Makerbase MKSTHR36
|
||||
* Makerbase MKSTHR42
|
||||
* MyMakers RP2040
|
||||
* Neko Systems BL2040 Mini
|
||||
* Newsan Archi
|
||||
* nullbits Bit-C PRO
|
||||
* Olimex Pico2XL
|
||||
* Olimex Pico2XXL
|
||||
* Olimex RP2040-Pico30
|
||||
* Pimoroni PGA2040
|
||||
* Pimoroni Pico Plus 2
|
||||
* Pimoroni Pico Plus 2W
|
||||
* Pimoroni Plasma2040
|
||||
* Pimoroni Plasma2350
|
||||
* Pimoroni Servo2040
|
||||
* Pimoroni Tiny2040
|
||||
* Pimoroni Tiny2350
|
||||
* Pintronix PinMax
|
||||
@@ -92,11 +98,13 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
|
||||
* Solder Party RP2040 Stamp
|
||||
* Solder Party RP2350 Stamp
|
||||
* Solder Party RP2350 Stamp XL
|
||||
* SparkFun IoT RedBoard RP2350
|
||||
* SparkFun MicroMod RP2040
|
||||
* SparkFun ProMicro RP2040
|
||||
* SparkFun ProMicro RP2350
|
||||
* SparkFun Thing Plus RP2040
|
||||
* SparkFun Thing Plus RP2350
|
||||
* SparkFun XRP Controller
|
||||
* uPesy RP2040 DevKit
|
||||
* VCC-GND YD-RP2040
|
||||
* Viyalab Mizu RP2040
|
||||
|
||||
+4594
-1633
File diff suppressed because it is too large
Load Diff
+19
-2
@@ -27,10 +27,23 @@
|
||||
#include "RP2040Version.h"
|
||||
#include "api/ArduinoAPI.h"
|
||||
#include "api/itoa.h" // ARM toolchain doesn't provide itoa etc, provide them
|
||||
#include <pico.h>
|
||||
#undef PICO_RP2350A // Set in the RP2350 SDK boards file, overridden in the variant pins_arduino.h
|
||||
#include <pins_arduino.h>
|
||||
#include <hardware/gpio.h> // Required for the port*Register macros
|
||||
#include "debug_internal.h"
|
||||
|
||||
// Chip sanity checking. SDK uses interesting way of separating 2350A from 2350B, see https://github.com/raspberrypi/pico-sdk/issues/2364
|
||||
#if (!defined(PICO_RP2040) && !defined(PICO_RP2350)) || defined(PICO_RP2040) && defined(PICO_RP2350)
|
||||
#error Invalid core definition. Either PICO_RP2040 or PICO_RP2350 must be defined.
|
||||
#endif
|
||||
#if defined(PICO_RP2350) && !defined(PICO_RP2350A)
|
||||
#error Invalid RP2350 definition. Need to set PICO_RP2350A=0/1 for A/B variant
|
||||
#endif
|
||||
#if defined(PICO_RP2350B)
|
||||
#error Do not define PICO_RP2350B. Use PICO_RP2350A=0 to indicate RP2350B. See the SDK for more details
|
||||
#endif
|
||||
|
||||
// Try and make the best of the old Arduino abs() macro. When in C++, use
|
||||
// the sane std::abs() call, but for C code use their macro since stdlib abs()
|
||||
// is int but their macro "works" for everything (with potential side effects)
|
||||
@@ -110,7 +123,7 @@ extern bool __isFreeRTOS;
|
||||
#endif
|
||||
|
||||
#ifndef PGM_VOID_P
|
||||
#define PGM_VOID_P void *
|
||||
#define PGM_VOID_P const void *
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -152,10 +165,14 @@ constexpr uint64_t __bitset(const int (&a)[N], size_t i = 0U) {
|
||||
#define PSRAM __attribute__((section("\".psram\"")))
|
||||
|
||||
// General GPIO/ADC layout info
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A
|
||||
#define __GPIOCNT 48
|
||||
#define __FIRSTANALOGGPIO 40
|
||||
#else
|
||||
#define __GPIOCNT 30
|
||||
#define __FIRSTANALOGGPIO 26
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
using namespace arduino;
|
||||
#endif
|
||||
|
||||
@@ -20,10 +20,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
@brief Wrapper class for polling the BOOTSEL button
|
||||
*/
|
||||
class __Bootsel {
|
||||
public:
|
||||
__Bootsel() { }
|
||||
/**
|
||||
@brief Get state of the BOOTSEL pin
|
||||
|
||||
@returns True if BOOTSEL pushed
|
||||
*/
|
||||
operator bool();
|
||||
};
|
||||
|
||||
/**
|
||||
@brief BOOTSEL accessor instance
|
||||
*/
|
||||
extern __Bootsel BOOTSEL;
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
#include "api/IPAddress.h"
|
||||
using arduino::IPAddress;
|
||||
|
||||
@@ -182,6 +182,9 @@ extern "C" void loop1() __attribute__((weak));
|
||||
extern "C" bool core1_separate_stack;
|
||||
extern "C" uint32_t* core1_separate_stack_address;
|
||||
|
||||
/**
|
||||
@brief RP2040/RP2350 helper function for HW-specific features
|
||||
*/
|
||||
class RP2040 {
|
||||
public:
|
||||
RP2040() { /* noop */ }
|
||||
@@ -207,26 +210,50 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
// Convert from microseconds to PIO clock cycles
|
||||
/**
|
||||
@brief Convert from microseconds to PIO clock cycles
|
||||
|
||||
@returns the PIO cycles for a given microsecond delay
|
||||
*/
|
||||
static int usToPIOCycles(int us) {
|
||||
// Parenthesis needed to guarantee order of operations to avoid 32bit overflow
|
||||
return (us * (clock_get_hz(clk_sys) / 1'000'000));
|
||||
}
|
||||
|
||||
// Get current clock frequency
|
||||
/**
|
||||
@brief Gets the active CPU speed (may differ from F_CPU
|
||||
|
||||
@returns CPU frequency in Hz
|
||||
*/
|
||||
static int f_cpu() {
|
||||
return clock_get_hz(clk_sys);
|
||||
}
|
||||
|
||||
// Get current CPU core number
|
||||
/**
|
||||
@brief Get the core ID that is currently executing this code
|
||||
|
||||
@returns 0 for Core 0, 1 for Core 1
|
||||
*/
|
||||
static int cpuid() {
|
||||
return sio_hw->cpuid;
|
||||
}
|
||||
|
||||
// Get CPU cycle count. Needs to do magic to extens 24b HW to something longer
|
||||
/**
|
||||
@brief CPU cycle counter epoch (24-bit cycle). For internal use
|
||||
*/
|
||||
volatile uint64_t _epoch = 0;
|
||||
/**
|
||||
@brief Get the count of CPU clock cycles since power on.
|
||||
|
||||
@details
|
||||
The 32-bit count will overflow every 4 billion cycles, so consider using ``getCycleCount64`` for
|
||||
longer measurements
|
||||
|
||||
@returns CPU clock cycles since power up
|
||||
*/
|
||||
inline uint32_t getCycleCount() {
|
||||
#if !defined(__riscv) && !defined(__PROFILE)
|
||||
// Get CPU cycle count. Needs to do magic to extend 24b HW to something longer
|
||||
if (!__isFreeRTOS) {
|
||||
uint32_t epoch;
|
||||
uint32_t ctr;
|
||||
@@ -242,7 +269,11 @@ public:
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
@brief Get the count of CPU clock cycles since power on as a 64-bit quantrity
|
||||
|
||||
@returns CPU clock cycles since power up
|
||||
*/
|
||||
inline uint64_t getCycleCount64() {
|
||||
#if !defined(__riscv) && !defined(__PROFILE)
|
||||
if (!__isFreeRTOS) {
|
||||
@@ -261,23 +292,53 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Gets total unused heap (dynamic memory)
|
||||
|
||||
@details
|
||||
Note that the allocations of the size of the total free heap may fail due to fragmentation.
|
||||
For example, ``getFreeHeap`` can report 100KB available, but an allocation of 90KB may fail
|
||||
because there may not be a contiguous 90KB space available
|
||||
|
||||
@returns Free heap in bytes
|
||||
*/
|
||||
inline int getFreeHeap() {
|
||||
return getTotalHeap() - getUsedHeap();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Gets total used heap (dynamic memory)
|
||||
|
||||
@returns Used heap in bytes
|
||||
*/
|
||||
inline int getUsedHeap() {
|
||||
struct mallinfo m = mallinfo();
|
||||
return m.uordblks;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Gets total heap (dynamic memory) compiled into the program
|
||||
|
||||
@returns Total heap size in bytes
|
||||
*/
|
||||
inline int getTotalHeap() {
|
||||
return &__StackLimit - &__bss_end__;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief On the RP2350, returns the amount of heap (dynamic memory) available in PSRAM
|
||||
|
||||
@returns Total free heap in PSRAM, or 0 if no PSRAM present
|
||||
*/
|
||||
inline int getFreePSRAMHeap() {
|
||||
return getTotalPSRAMHeap() - getUsedPSRAMHeap();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief On the RP2350, returns the total amount of PSRAM heap (dynamic memory) used
|
||||
|
||||
@returns Bytes used in PSRAM, or 0 if no PSRAM present
|
||||
*/
|
||||
inline int getUsedPSRAMHeap() {
|
||||
#if defined(RP2350_PSRAM_CS)
|
||||
extern size_t __psram_total_used();
|
||||
@@ -287,6 +348,11 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@brief On the RP2350, gets total heap (dynamic memory) compiled into the program
|
||||
|
||||
@returns Total PSRAM heap size in bytes, or 0 if no PSRAM present
|
||||
*/
|
||||
inline int getTotalPSRAMHeap() {
|
||||
#if defined(RP2350_PSRAM_CS)
|
||||
extern size_t __psram_total_space();
|
||||
@@ -296,6 +362,11 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Gets the current stack pointer in a ARM/RISC-V safe manner
|
||||
|
||||
@returns Current SP
|
||||
*/
|
||||
inline uint32_t getStackPointer() {
|
||||
uint32_t *sp;
|
||||
#if defined(__riscv)
|
||||
@@ -306,6 +377,14 @@ public:
|
||||
return (uint32_t)sp;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Calculates approximately how much stack space is still available for the running core. Handles multiprocessing and separate stacks.
|
||||
|
||||
@details
|
||||
Not valid in FreeRTOS. Use the FreeRTOS internal functions to access this information.
|
||||
|
||||
@returns Approximation of the amount of stack available for use on the specific core
|
||||
*/
|
||||
inline int getFreeStack() {
|
||||
const unsigned int sp = getStackPointer();
|
||||
uint32_t ref = 0x20040000;
|
||||
@@ -319,6 +398,11 @@ public:
|
||||
return sp - ref;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief On the RP2350, gets the size of attached PSRAM
|
||||
|
||||
@returns PSRAM size in bytes, or 0 if no PSRAM present
|
||||
*/
|
||||
inline size_t getPSRAMSize() {
|
||||
#if defined(RP2350_PSRAM_CS)
|
||||
extern size_t __psram_size;
|
||||
@@ -328,20 +412,48 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Freezes the other core in a flash-write-safe state. Not generally needed by applications
|
||||
|
||||
@details
|
||||
When the external flash chip is erasing or writing, the Pico cannot fetch instructions from it.
|
||||
In this case both the core doing the writing and the other core (if active) need to run from a
|
||||
routine that's contained in RAM. This call forces the other core into a tight, RAM-based loop
|
||||
safe for this operation. When flash erase/write is completed, ``resumeOtherCore`` to return
|
||||
it to operation.
|
||||
|
||||
Be sure to disable any interrupts or task switches before calling to avoid deadlocks.
|
||||
|
||||
If the second core is not started, this is a no-op.
|
||||
*/
|
||||
void idleOtherCore() {
|
||||
fifo.idleOtherCore();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Resumes normal operation of the other core
|
||||
*/
|
||||
void resumeOtherCore() {
|
||||
fifo.resumeOtherCore();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Hard resets the 2nd core (CORE1).
|
||||
|
||||
@details
|
||||
Because core1 will restart with the heap and global variables not in the same state as
|
||||
power-on, this call may not work as desired and a full CPU reset may be necessary in
|
||||
certain cases.
|
||||
*/
|
||||
void restartCore1() {
|
||||
multicore_reset_core1();
|
||||
fifo.clear();
|
||||
multicore_launch_core1(main1);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Warm-reboots the chip in normal mode
|
||||
*/
|
||||
void reboot() {
|
||||
watchdog_reboot(0, 0, 10);
|
||||
while (1) {
|
||||
@@ -349,10 +461,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Warm-reboots the chip in normal mode
|
||||
*/
|
||||
inline void restart() {
|
||||
reboot();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Warm-reboots the chip into the USB bootloader mode
|
||||
*/
|
||||
inline void rebootToBootloader() {
|
||||
reset_usb_boot(0, 0);
|
||||
while (1) {
|
||||
@@ -364,16 +482,32 @@ public:
|
||||
static void enableDoubleResetBootloader();
|
||||
#endif
|
||||
|
||||
/**
|
||||
@brief Starts the hardware watchdog timer. The CPU will reset if the watchdog is not fed every delay_ms
|
||||
|
||||
@param [in] delay_ms Milliseconds without a wdt_reset before rebooting
|
||||
*/
|
||||
void wdt_begin(uint32_t delay_ms) {
|
||||
watchdog_enable(delay_ms, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Feeds the watchdog timer, resetting it for another delay_ms countdown
|
||||
*/
|
||||
void wdt_reset() {
|
||||
watchdog_update();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Best-effort reasons for chip reset
|
||||
*/
|
||||
enum resetReason_t {UNKNOWN_RESET, PWRON_RESET, RUN_PIN_RESET, SOFT_RESET, WDT_RESET, DEBUG_RESET, GLITCH_RESET, BROWNOUT_RESET};
|
||||
|
||||
/**
|
||||
@brief Attempts to determine the reason for the last chip reset. May not always be able to determine accurately
|
||||
|
||||
@returns Reason for reset
|
||||
*/
|
||||
resetReason_t getResetReason(void) {
|
||||
io_rw_32 *WD_reason_reg = (io_rw_32 *)(WATCHDOG_BASE + WATCHDOG_REASON_OFFSET);
|
||||
|
||||
@@ -427,6 +561,10 @@ public:
|
||||
return UNKNOWN_RESET;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Get unique ID string for the running board
|
||||
@returns String with the unique board ID as determined by the SDK
|
||||
*/
|
||||
const char *getChipID() {
|
||||
static char id[2 * PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 1] = { 0 };
|
||||
if (!id[0]) {
|
||||
@@ -437,6 +575,17 @@ public:
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("Os")
|
||||
/**
|
||||
@brief Perform a memcpy using a DMA engine for speed
|
||||
|
||||
@details
|
||||
Uses the DMA to copy to and from RAM. Only works on 4-byte aligned, 4-byte multiple length
|
||||
sources and destination (i.e. word-aligned, word-length). Falls back to normal memcpy otherwise.
|
||||
|
||||
@param [out] dest Memcpy destination, 4-byte aligned
|
||||
@param [in] src Memcpy source, 4-byte aligned
|
||||
@param [in] n Count in bytes to transfer (should be a multiple of 4 bytes)
|
||||
*/
|
||||
void *memcpyDMA(void *dest, const void *src, size_t n) {
|
||||
// Allocate a DMA channel on 1st call, reuse it every call after
|
||||
if (memcpyDMAChannel < 1) {
|
||||
@@ -465,14 +614,32 @@ public:
|
||||
}
|
||||
#pragma GCC pop_options
|
||||
|
||||
// Multicore comms FIFO
|
||||
/**
|
||||
@brief Multicore communications FIFO
|
||||
*/
|
||||
_MFIFO fifo;
|
||||
|
||||
|
||||
/**
|
||||
@brief Return a 32-bit from the hardware random number generator
|
||||
|
||||
@returns Random value using appropriate hardware (RP2350 has true RNG, RP2040 has a less true RNG method)
|
||||
*/
|
||||
uint32_t hwrand32() {
|
||||
return get_rand_32();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Determines if code is running on a Pico or a PicoW
|
||||
|
||||
@details
|
||||
Code compiled for the RP2040 PicoW can run on the RP2040 Pico. This call lets an application
|
||||
identify if the current device is really a Pico or PicoW and handle appropriately. For
|
||||
the RP2350, this runtime detection is not available and the call returns whether it was
|
||||
compiled for the CYW43 WiFi driver
|
||||
|
||||
@returns True if running on a PicoW board with CYW43 WiFi chip.
|
||||
*/
|
||||
bool isPicoW() {
|
||||
#if !defined(PICO_CYW43_SUPPORTED)
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#define ARDUINO_PICO_MAJOR 4
|
||||
#define ARDUINO_PICO_MINOR 4
|
||||
#define ARDUINO_PICO_REVISION 3
|
||||
#define ARDUINO_PICO_VERSION_STR "4.4.3"
|
||||
#define ARDUINO_PICO_MINOR 5
|
||||
#define ARDUINO_PICO_REVISION 2
|
||||
#define ARDUINO_PICO_VERSION_STR "4.5.2"
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
|
||||
// Input/output will be handled by OpenOCD
|
||||
|
||||
// From https://developer.arm.com/documentation/dui0471/g/Semihosting/Semihosting-operations?lang=en
|
||||
/**
|
||||
@brief Semihosting host API opcodes, from https://developer.arm.com/documentation/dui0471/g/Semihosting/Semihosting-operations?lang=en
|
||||
*/
|
||||
typedef enum {
|
||||
SEMIHOST_SYS_CLOSE = 0x02,
|
||||
SEMIHOST_SYS_CLOCK = 0x10,
|
||||
@@ -52,7 +54,13 @@ typedef enum {
|
||||
|
||||
#ifdef __arm__
|
||||
|
||||
// From https://github.com/ErichStyger/mcuoneclipse/blob/master/Examples/MCUXpresso/FRDM-K22F/FRDM-K22F_Semihosting/source/McuSemihost.c
|
||||
/**
|
||||
@brief Execute a semihosted request, from https://github.com/ErichStyger/mcuoneclipse/blob/master/Examples/MCUXpresso/FRDM-K22F/FRDM-K22F_Semihosting/source/McuSemihost.c
|
||||
|
||||
@param [in] reason Opcode to execute
|
||||
@param [in] arg Any arguments for the opcode
|
||||
@returns Result of operation
|
||||
*/
|
||||
static inline int __attribute__((always_inline)) Semihost(int reason, void *arg) {
|
||||
int value;
|
||||
__asm volatile(
|
||||
@@ -69,7 +77,13 @@ static inline int __attribute__((always_inline)) Semihost(int reason, void *arg)
|
||||
}
|
||||
#else
|
||||
|
||||
// https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/n-5VQ9PHZ4w/m/KbzH5t9MBgAJ
|
||||
/**
|
||||
@brief Execute a semihosted request, from https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/n-5VQ9PHZ4w/m/KbzH5t9MBgAJ
|
||||
|
||||
@param [in] reason Opcode to execute
|
||||
@param [in] argPack Any arguments for the opcode
|
||||
@returns Result of operation
|
||||
*/
|
||||
static inline int __attribute__((always_inline)) Semihost(int reason, void *argPack) {
|
||||
register int value asm("a0") = reason;
|
||||
register void *ptr asm("a1") = argPack;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "Arduino.h"
|
||||
#include "api/HardwareSerial.h"
|
||||
|
||||
class SerialSemiClass : public HardwareSerial {
|
||||
class SerialSemiClass : public arduino::HardwareSerial {
|
||||
public:
|
||||
SerialSemiClass() {
|
||||
/* noop */
|
||||
|
||||
+54
-10
@@ -32,15 +32,20 @@ extern void serialEvent1() __attribute__((weak));
|
||||
extern void serialEvent2() __attribute__((weak));
|
||||
|
||||
bool SerialUART::setRX(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({1, 13, 17, 29, 33, 45}) /* UART0 */,
|
||||
__bitset({5, 9, 21, 25, 37, 41}) /* UART1 */
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({1, 3, 13, 15, 17, 19, 29, 31, 33, 35, 45, 47}) /* UART0 */,
|
||||
__bitset({5, 7, 9, 11, 21, 23, 25, 27, 37, 39, 41, 43}) /* UART1 */
|
||||
};
|
||||
#elif defined(PICO_RP2350)
|
||||
constexpr uint64_t valid[2] = { __bitset({1, 3, 13, 15, 17, 19, 29}) /* UART0 */,
|
||||
__bitset({5, 7, 9, 11, 21, 23, 25, 27}) /* UART1 */
|
||||
};
|
||||
#else
|
||||
constexpr uint64_t valid[2] = { __bitset({1, 13, 17, 29}) /* UART0 */,
|
||||
__bitset({5, 9, 21, 25}) /* UART1 */
|
||||
};
|
||||
#endif
|
||||
|
||||
if ((!_running) && ((1LL << pin) & valid[uart_get_index(_uart)])) {
|
||||
_rx = pin;
|
||||
return true;
|
||||
@@ -59,9 +64,13 @@ bool SerialUART::setRX(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SerialUART::setTX(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({0, 12, 16, 28, 32, 44}) /* UART0 */,
|
||||
__bitset({4, 8, 20, 24, 36, 40}) /* UART1 */
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({0, 2, 12, 14, 16, 18, 28, 30, 32, 34, 44, 46}) /* UART0 */,
|
||||
__bitset({4, 6, 8, 10, 20, 22, 24, 26, 36, 38, 40, 42}) /* UART1 */
|
||||
};
|
||||
#elif defined(PICO_RP2350)
|
||||
constexpr uint64_t valid[2] = { __bitset({0, 2, 12, 14, 16, 18, 28}) /* UART0 */,
|
||||
__bitset({4, 6, 8, 10, 20, 22, 24, 26}) /* UART1 */
|
||||
};
|
||||
#else
|
||||
constexpr uint64_t valid[2] = { __bitset({0, 12, 16, 28}) /* UART0 */,
|
||||
@@ -86,7 +95,7 @@ bool SerialUART::setTX(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SerialUART::setRTS(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({3, 15, 19, 31, 35, 47}) /* UART0 */,
|
||||
__bitset({7, 11, 23, 27, 39, 43}) /* UART1 */
|
||||
};
|
||||
@@ -113,7 +122,7 @@ bool SerialUART::setRTS(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SerialUART::setCTS(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({2, 14, 18, 30, 34, 46}) /* UART0 */,
|
||||
__bitset({6, 10, 22, 26, 38, 42}) /* UART1 */
|
||||
};
|
||||
@@ -170,6 +179,41 @@ SerialUART::SerialUART(uart_inst_t *uart, pin_size_t tx, pin_size_t rx, pin_size
|
||||
static void _uart0IRQ();
|
||||
static void _uart1IRQ();
|
||||
|
||||
// Does the selected TX/RX need UART_AUX function (rp2350)
|
||||
static gpio_function_t __gpioFunction(int pin) {
|
||||
switch (pin) {
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
case 7:
|
||||
case 10:
|
||||
case 11:
|
||||
case 14:
|
||||
case 15:
|
||||
case 18:
|
||||
case 19:
|
||||
case 22:
|
||||
case 23:
|
||||
case 26:
|
||||
case 27:
|
||||
case 30:
|
||||
case 31:
|
||||
case 34:
|
||||
case 35:
|
||||
case 38:
|
||||
case 39:
|
||||
case 42:
|
||||
case 43:
|
||||
case 46:
|
||||
case 47:
|
||||
return GPIO_FUNC_UART_AUX;
|
||||
#endif
|
||||
default:
|
||||
return GPIO_FUNC_UART;
|
||||
}
|
||||
}
|
||||
|
||||
void SerialUART::begin(unsigned long baud, uint16_t config) {
|
||||
if (_running) {
|
||||
end();
|
||||
@@ -180,9 +224,9 @@ void SerialUART::begin(unsigned long baud, uint16_t config) {
|
||||
|
||||
_fcnTx = gpio_get_function(_tx);
|
||||
_fcnRx = gpio_get_function(_rx);
|
||||
gpio_set_function(_tx, GPIO_FUNC_UART);
|
||||
gpio_set_function(_tx, __gpioFunction(_tx));
|
||||
gpio_set_outover(_tx, _invertTX ? 1 : 0);
|
||||
gpio_set_function(_rx, GPIO_FUNC_UART);
|
||||
gpio_set_function(_rx, __gpioFunction(_rx));
|
||||
gpio_set_inover(_rx, _invertRX ? 1 : 0);
|
||||
if (_rts != UART_PIN_NOT_DEFINED) {
|
||||
_fcnRts = gpio_get_function(_rts);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,9 +22,18 @@
|
||||
|
||||
#include "SerialPIO.h"
|
||||
|
||||
/**
|
||||
@brief Implements a UART port using PIO for input and output
|
||||
*/
|
||||
class SoftwareSerial : public SerialPIO {
|
||||
public:
|
||||
// Note the rx/tx pins are swapped in PIO vs SWSerial
|
||||
/**
|
||||
@brief Constructs a PIO-based UART
|
||||
|
||||
@param [in] rx GPIO for RX pin or -1 for transmit-only
|
||||
@param [in] tx GPIO for TX pin or -1 for receive-only
|
||||
@param [in] invert True to invert the receive and transmit lines
|
||||
*/
|
||||
SoftwareSerial(pin_size_t rx, pin_size_t tx, bool invert = false) : SerialPIO(tx, rx) {
|
||||
_invert = invert;
|
||||
}
|
||||
@@ -32,18 +41,37 @@ public:
|
||||
~SoftwareSerial() {
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Starts the PIO UART
|
||||
|
||||
@param [in] baud Serial bit rate
|
||||
*/
|
||||
virtual void begin(unsigned long baud = 115200) override {
|
||||
begin(baud, SERIAL_8N1);
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Starts the PIO UART
|
||||
|
||||
@param [in] baud Serial bit rate
|
||||
@param [in] config Start/Stop/Len configuration (i.e. SERIAL_8N1 or SERIAL_7E2)
|
||||
*/
|
||||
void begin(unsigned long baud, uint16_t config) override {
|
||||
setInvertTX(_invert);
|
||||
setInvertRX(_invert);
|
||||
SerialPIO::begin(baud, config);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief No-op on this core
|
||||
*/
|
||||
void listen() { /* noop */ }
|
||||
|
||||
/**
|
||||
@brief No-op on this core
|
||||
|
||||
@returns True always
|
||||
*/
|
||||
bool isListening() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+37
-1
@@ -22,7 +22,11 @@
|
||||
#include "RP2040USB.h"
|
||||
#include <pico/stdlib.h>
|
||||
#include <pico/multicore.h>
|
||||
#include <hardware/vreg.h>
|
||||
#include <reent.h>
|
||||
#ifdef RP2350_PSRAM_CS
|
||||
#include "psram.h"
|
||||
#endif
|
||||
|
||||
RP2040 rp2040;
|
||||
extern "C" {
|
||||
@@ -80,9 +84,41 @@ static struct _reent *_impure_ptr1 = nullptr;
|
||||
|
||||
extern "C" int main() {
|
||||
#if (defined(PICO_RP2040) && (F_CPU != 125000000)) || (defined(PICO_RP2350) && (F_CPU != 150000000))
|
||||
set_sys_clock_khz(F_CPU / 1000, true);
|
||||
|
||||
#if defined(PICO_RP2040)
|
||||
// From runtime_init_clocks() to bump up RP2040 V for 200Mhz+ operation
|
||||
if ((F_CPU > 133000000) && (vreg_get_voltage() < VREG_VOLTAGE_1_15)) {
|
||||
vreg_set_voltage(VREG_VOLTAGE_1_15);
|
||||
// wait for voltage to settle; must use CPU cycles as TIMER is not yet clocked correctly
|
||||
busy_wait_at_least_cycles((uint32_t)((SYS_CLK_VREG_VOLTAGE_AUTO_ADJUST_DELAY_US * (uint64_t)XOSC_HZ) / 1000000));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RP2350_PSRAM_CS) && (F_CPU > 150000000)
|
||||
// Need to increase the qmi divider before upping sysclk to ensure we keep the output sck w/in legal bounds
|
||||
psram_reinit_timing(F_CPU);
|
||||
// Per datasheet, need to do a dummy access and memory barrier before it takes effect
|
||||
extern uint8_t __psram_start__;
|
||||
volatile uint8_t *x = &__psram_start__;
|
||||
*x ^= 0xff;
|
||||
*x ^= 0xff;
|
||||
asm volatile("" ::: "memory");
|
||||
#endif
|
||||
|
||||
set_sys_clock_khz(F_CPU / 1000, true);
|
||||
|
||||
#if defined(RP2350_PSRAM_CS) && (F_CPU < 150000000)
|
||||
psram_reinit_timing();
|
||||
// Per datasheet, need to do a dummy access and memory barrier before it takes effect
|
||||
extern uint8_t __psram_start__;
|
||||
volatile uint8_t *x = &__psram_start__;
|
||||
*x ^= 0xff;
|
||||
*x ^= 0xff;
|
||||
asm volatile("" ::: "memory");
|
||||
#endif
|
||||
|
||||
#endif // over/underclock
|
||||
|
||||
// Let rest of core know if we're using FreeRTOS
|
||||
__isFreeRTOS = initFreeRTOS ? true : false;
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -195,10 +195,7 @@ static size_t __no_inline_not_in_flash_func(get_psram_size)(void) {
|
||||
///
|
||||
/// @note This function expects interrupts to be enabled on entry
|
||||
|
||||
static void __no_inline_not_in_flash_func(set_psram_timing)(void) {
|
||||
// Get secs / cycle for the system clock - get before disabling interrupts.
|
||||
uint32_t sysHz = (uint32_t)clock_get_hz(clk_sys);
|
||||
|
||||
static void __no_inline_not_in_flash_func(set_psram_timing)(uint32_t sysHz) {
|
||||
// Calculate the clock divider - goal to get clock used for PSRAM <= what
|
||||
// the PSRAM IC can handle - which is defined in SFE_PSRAM_MAX_SCK_HZ
|
||||
volatile uint8_t clockDivider = (sysHz + SFE_PSRAM_MAX_SCK_HZ - 1) / SFE_PSRAM_MAX_SCK_HZ;
|
||||
@@ -283,7 +280,7 @@ static void __no_inline_not_in_flash_func(runtime_init_setup_psram)(/*uint32_t p
|
||||
|
||||
// check our interrupts and setup the timing
|
||||
restore_interrupts(intr_stash);
|
||||
set_psram_timing();
|
||||
set_psram_timing((uint32_t)clock_get_hz(clk_sys));
|
||||
|
||||
// and now stash interrupts again
|
||||
intr_stash = save_and_disable_interrupts();
|
||||
@@ -323,8 +320,11 @@ static void __no_inline_not_in_flash_func(runtime_init_setup_psram)(/*uint32_t p
|
||||
PICO_RUNTIME_INIT_FUNC_RUNTIME(runtime_init_setup_psram, PICO_RUNTIME_INIT_PSRAM);
|
||||
|
||||
// update timing -- used if the system clock/timing was changed.
|
||||
void psram_reinit_timing() {
|
||||
set_psram_timing();
|
||||
void psram_reinit_timing(uint32_t hz) {
|
||||
if (!hz) {
|
||||
hz = (uint32_t)clock_get_hz(clk_sys);
|
||||
}
|
||||
set_psram_timing(hz);
|
||||
}
|
||||
|
||||
static bool __psram_heap_init() {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
void psram_reinit_timing();
|
||||
void psram_reinit_timing(uint32_t hz = 0);
|
||||
void *__psram_malloc(size_t size);
|
||||
void __psram_free(void *ptr);
|
||||
void *__psram_realloc(void *ptr, size_t size);
|
||||
|
||||
@@ -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);
|
||||
|
||||
+7
-6
@@ -12,9 +12,9 @@ need to be periodically sampled to be read by applications, easily, such as:
|
||||
* Light dependent resistors (LDR), etc.
|
||||
|
||||
|
||||
Up to 4 analog samples can be recorded by the hardware (``A0`` ... ``A3``), and all
|
||||
recording is done at 16-bit levels (but be aware that the ADC in the Pico will only
|
||||
ever return values between 0...4095).
|
||||
Up to 4 (or 8 in the case of the RP2350B) analog samples can be recorded by the
|
||||
hardware (``A0`` ... ``A3``), and all recording is done at 16-bit levels (but be
|
||||
aware that the ADC in the Pico will only ever return values between 0...4095).
|
||||
|
||||
The interface for the ``ADCInput`` device is very similar to the ``I2S`` input
|
||||
device, and most code can be ported simply by instantiating a ``ADCInput``
|
||||
@@ -26,11 +26,12 @@ allowed while in use.
|
||||
ADC Input API
|
||||
-------------
|
||||
|
||||
ADCInput(pin0 [, pin1, pin2, pin3])
|
||||
ADCInput(pin0 [, pin1, pin2, pin3[, pin4, pin5, pin6, pin7])
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Creates an ADC input object which will record the pins specified in the code.
|
||||
Only pins ``A0`` ... ``A3`` can be used, and they must be specified in increasing
|
||||
order (i.e. ``ADCInput(A0, A1);`` is valid, but ``ADCInput(A1, A0)`` is not.
|
||||
Only pins ``A0`` ... ``A3`` (``A7`` on RP2350B) can be used, and they must be
|
||||
specified in increasing order (i.e. ``ADCInput(A0, A1);`` is valid,
|
||||
but ``ADCInput(A1, A0)`` is not.
|
||||
|
||||
bool setBuffers(size_t buffers, size_t bufferWords)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+2
-2
@@ -54,9 +54,9 @@ author = u'Earle F. Philhower, III'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = u'4.4.3'
|
||||
version = u'4.5.2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = u'4.4.3'
|
||||
release = u'4.5.2'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
+2
-2
@@ -112,7 +112,7 @@ For only RP2350A variants (using the compile options, not the onboard ID registe
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
#if defined(PICO_RP2350) && !defined(PICO_RP2350B)
|
||||
#if defined(PICO_RP2350A) && PICO_RP2350A
|
||||
...RP2350A only code...
|
||||
#endif
|
||||
|
||||
@@ -121,7 +121,7 @@ and not the chip ID register):
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
#if defined(PICO_RP2350B)
|
||||
#if defined(PICO_RP2350A) && !PICO_RP2350A
|
||||
...48-GPIO version code here
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#define PICO_SDK_VERSION_MAJOR 2
|
||||
#define PICO_SDK_VERSION_MINOR 1
|
||||
#define PICO_SDK_VERSION_REVISION 0
|
||||
#define PICO_SDK_VERSION_STRING "2.1.0"
|
||||
#define PICO_SDK_VERSION_REVISION 2
|
||||
#define PICO_SDK_VERSION_STRING "2.1.2-develop"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#define PICO_SDK_VERSION_MAJOR 2
|
||||
#define PICO_SDK_VERSION_MINOR 1
|
||||
#define PICO_SDK_VERSION_REVISION 0
|
||||
#define PICO_SDK_VERSION_STRING "2.1.0"
|
||||
#define PICO_SDK_VERSION_REVISION 2
|
||||
#define PICO_SDK_VERSION_STRING "2.1.2-develop"
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,5 +10,6 @@
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/src
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/decoder/include
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/encoder/include
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/yxml
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/platform/embedded
|
||||
-iwithprefixbefore/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RP2040/Include
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,4 +15,5 @@
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/src
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/decoder/include
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/encoder/include
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/yxml
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/platform/embedded
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,4 +13,5 @@
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/src
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/decoder/include
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/bluedroid/encoder/include
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/3rd-party/yxml
|
||||
-iwithprefixbefore/pico-sdk/lib/btstack/platform/embedded
|
||||
|
||||
@@ -49,7 +49,7 @@ bool ADCInput::setBuffers(size_t buffers, size_t bufferWords) {
|
||||
|
||||
int ADCInput::_mask(pin_size_t p) {
|
||||
switch (p) {
|
||||
#if !defined(PICO_RP2350B)
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
case 26: return 1;
|
||||
case 27: return 2;
|
||||
case 28: return 4;
|
||||
@@ -106,7 +106,7 @@ bool ADCInput::begin() {
|
||||
// Set up the GPIOs to go to ADC
|
||||
adc_init();
|
||||
int cnt = 0;
|
||||
#if !defined(PICO_RP2350B)
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
int startpin = 26;
|
||||
int maxpin = 29;
|
||||
#else
|
||||
|
||||
@@ -223,7 +223,7 @@ size_t A2DPSource::write(const uint8_t *buffer, size_t size) {
|
||||
size = std::min((size_t)availableForWrite(), size);
|
||||
|
||||
size_t count = 0;
|
||||
size /= 2;
|
||||
size /= sizeof(int16_t); // Convert size to samples
|
||||
|
||||
// First copy from writer to either end of
|
||||
uint32_t start = _pcmWriter;
|
||||
@@ -262,7 +262,7 @@ int A2DPSource::availableForWrite() {
|
||||
} else {
|
||||
avail = _pcmBufferSize - _pcmWriter + _pcmReader - 1;
|
||||
}
|
||||
avail /= sizeof(uint32_t); // availableForWrite always 32b sample pairs in this core...
|
||||
avail *= sizeof(int16_t); // Convert samples to bytes
|
||||
return avail;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,14 @@ public:
|
||||
return _hci.scan(mask, scanTimeSec, async);
|
||||
}
|
||||
|
||||
bool scanAsyncDone() {
|
||||
return _hci.scanAsyncDone();
|
||||
}
|
||||
|
||||
std::vector<BTDeviceInfo> scanAsyncResult() {
|
||||
return _hci.scanAsyncResult();
|
||||
}
|
||||
|
||||
bool connect(const uint8_t *addr = nullptr);
|
||||
|
||||
bool connected() {
|
||||
@@ -151,6 +159,7 @@ public:
|
||||
}
|
||||
|
||||
// from Print (see notes on write() methods below)
|
||||
// Writes only full samples (size must be divisible by sample size in bytes)
|
||||
virtual size_t write(const uint8_t *buffer, size_t size) override;
|
||||
virtual int availableForWrite() override;
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ bool I2S::setLSBJFormat() {
|
||||
}
|
||||
|
||||
bool I2S::setTDMFormat() {
|
||||
if (_running || !_isOutput || _isInput) {
|
||||
if (_running || !_isOutput) {
|
||||
return false;
|
||||
}
|
||||
_isTDM = true;
|
||||
@@ -186,7 +186,7 @@ bool I2S::setTDMFormat() {
|
||||
}
|
||||
|
||||
bool I2S::setTDMChannels(int channels) {
|
||||
if (_running || !_isOutput || _isInput) {
|
||||
if (_running || !_isOutput) {
|
||||
return false;
|
||||
}
|
||||
_tdmChannels = channels;
|
||||
@@ -255,9 +255,9 @@ bool I2S::begin() {
|
||||
_isHolding = 0;
|
||||
int off = 0;
|
||||
if (!_swapClocks) {
|
||||
_i2s = new PIOProgram(_isOutput ? (_isInput ? &pio_i2s_inout_program : (_isTDM ? &pio_tdm_out_program : (_isLSBJ ? &pio_lsbj_out_program : &pio_i2s_out_program))) : &pio_i2s_in_program);
|
||||
_i2s = new PIOProgram(_isOutput ? (_isInput ? (_isTDM ? &pio_tdm_inout_program : &pio_i2s_inout_program) : (_isTDM ? &pio_tdm_out_program : (_isLSBJ ? &pio_lsbj_out_program : &pio_i2s_out_program))) : &pio_i2s_in_program);
|
||||
} else {
|
||||
_i2s = new PIOProgram(_isOutput ? (_isInput ? &pio_i2s_inout_swap_program : (_isTDM ? &pio_tdm_out_swap_program : (_isLSBJ ? &pio_lsbj_out_swap_program : &pio_i2s_out_swap_program))) : &pio_i2s_in_swap_program);
|
||||
_i2s = new PIOProgram(_isOutput ? (_isInput ? (_isTDM ? &pio_tdm_inout_swap_program : &pio_i2s_inout_swap_program) : (_isTDM ? &pio_tdm_out_swap_program : (_isLSBJ ? &pio_lsbj_out_swap_program : &pio_i2s_out_swap_program))) : &pio_i2s_in_swap_program);
|
||||
}
|
||||
int minpin, maxpin;
|
||||
if (_isOutput && _isInput) {
|
||||
@@ -278,7 +278,11 @@ bool I2S::begin() {
|
||||
}
|
||||
if (_isOutput) {
|
||||
if (_isInput) {
|
||||
pio_i2s_inout_program_init(_pio, _sm, off, _pinDIN, _pinDOUT, _pinBCLK, _bps, _swapClocks);
|
||||
if (_isTDM) {
|
||||
pio_tdm_inout_program_init(_pio, _sm, off, _pinDIN, _pinDOUT, _pinBCLK, _bps, _swapClocks, _tdmChannels);
|
||||
} else {
|
||||
pio_i2s_inout_program_init(_pio, _sm, off, _pinDIN, _pinDOUT, _pinBCLK, _bps, _swapClocks);
|
||||
}
|
||||
} else if (_isTDM) {
|
||||
pio_tdm_out_program_init(_pio, _sm, off, _pinDOUT, _pinBCLK, _bps, _swapClocks, _tdmChannels);
|
||||
} else if (_isLSBJ) {
|
||||
|
||||
@@ -104,6 +104,41 @@ lastbit:
|
||||
; Loop back to the beginning
|
||||
|
||||
|
||||
.program pio_tdm_inout
|
||||
.side_set 2 ; 0 = bclk, 1 = wclk
|
||||
; The C code should place (number of bits * channels - 1) in Y and update SHIFTCTRL
|
||||
; to be 32 (as per the TDM specs)
|
||||
; +----- WCLK
|
||||
; |+---- BCLK
|
||||
mov x, y side 0b01 [1]
|
||||
bitloop:
|
||||
out pins, 1 side 0b00 ; Output changes on falling edge
|
||||
in pins, 1 side 0b00 ; Sample input on falling edge
|
||||
jmp x-- bitloop side 0b11 [1] ; Last bit toggles WCLK to mark frame boundary
|
||||
|
||||
lastbit:
|
||||
in pins, 1 side 0b10
|
||||
out pins, 1 side 0b10
|
||||
; Loop back to the beginning
|
||||
|
||||
|
||||
.program pio_tdm_inout_swap
|
||||
.side_set 2 ; 0 = bclk, 1 = wclk
|
||||
; The C code should place (number of bits * channels - 1) in Y and update SHIFTCTRL
|
||||
; to be 32 (as per the TDM specs)
|
||||
; +----- WCLK
|
||||
; |+---- BCLK
|
||||
mov x, y side 0b10 [1]
|
||||
bitloop:
|
||||
out pins, 1 side 0b00 ; Output changes on falling edge
|
||||
in pins, 1 side 0b00 ; Sample input on falling edge
|
||||
jmp x-- bitloop side 0b11 [1] ; Last bit toggles WCLK to mark frame boundary
|
||||
|
||||
lastbit:
|
||||
in pins, 1 side 0b01
|
||||
out pins, 1 side 0b01
|
||||
; Loop back to the beginning
|
||||
|
||||
|
||||
.program pio_lsbj_out
|
||||
.side_set 2 ; 0 = bclk, 1=wclk
|
||||
@@ -313,6 +348,42 @@ static inline void pio_tdm_out_program_init(PIO pio, uint sm, uint offset, uint
|
||||
pio_sm_exec(pio, sm, pio_encode_out(pio_osr, 32));
|
||||
}
|
||||
|
||||
static inline void pio_tdm_inout_program_init(PIO pio, uint sm, uint offset, uint data_in_pin, uint data_out_pin, uint clock_pin_base, uint bits, bool swap, uint channels) {
|
||||
pio_gpio_init(pio, data_in_pin);
|
||||
pio_gpio_init(pio, data_out_pin);
|
||||
pio_gpio_init(pio, clock_pin_base);
|
||||
pio_gpio_init(pio, clock_pin_base + 1);
|
||||
|
||||
pio_sm_config c = swap ? pio_tdm_inout_swap_program_get_default_config(offset) : pio_tdm_inout_program_get_default_config(offset);
|
||||
|
||||
sm_config_set_in_pins(&c, data_in_pin);
|
||||
sm_config_set_out_pins(&c, data_out_pin, 1);
|
||||
sm_config_set_sideset_pins(&c, clock_pin_base);
|
||||
sm_config_set_in_shift(&c, false, true, 32);
|
||||
sm_config_set_out_shift(&c, false, true, 32);
|
||||
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_NONE);
|
||||
|
||||
pio_sm_init(pio, sm, offset, &c);
|
||||
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, data_in_pin, 1, false);
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, data_out_pin, 1, true);
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, clock_pin_base, 2, true);
|
||||
pio_sm_set_set_pins(pio, sm, data_out_pin, 1);
|
||||
pio_sm_set_set_pins(pio, sm, clock_pin_base, 2);
|
||||
|
||||
// Initialize PIO state for TDM
|
||||
// Can't set constant > 31, so push and pop/mov if needed
|
||||
if (bits * channels - 1 > 31) {
|
||||
pio_sm_put_blocking(pio, sm, bits * channels - 2);
|
||||
pio_sm_exec(pio, sm, pio_encode_pull(false, false));
|
||||
pio_sm_exec(pio, sm, pio_encode_mov(pio_y, pio_osr));
|
||||
} else {
|
||||
pio_sm_exec(pio, sm, pio_encode_set(pio_y, bits * channels - 2));
|
||||
}
|
||||
|
||||
// Need to make OSR believe there's nothing left to shift out
|
||||
pio_sm_exec(pio, sm, pio_encode_out(pio_osr, 32));
|
||||
}
|
||||
|
||||
static inline void pio_lsbj_out_program_init(PIO pio, uint sm, uint offset, uint data_pin, uint clock_pin_base, uint bits, bool swap) {
|
||||
pio_gpio_init(pio, data_pin);
|
||||
|
||||
@@ -193,6 +193,80 @@ static inline pio_sm_config pio_tdm_out_swap_program_get_default_config(uint off
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------- //
|
||||
// pio_tdm_inout //
|
||||
// ------------- //
|
||||
|
||||
#define pio_tdm_inout_wrap_target 0
|
||||
#define pio_tdm_inout_wrap 5
|
||||
|
||||
static const uint16_t pio_tdm_inout_program_instructions[] = {
|
||||
// .wrap_target
|
||||
0xa922, // 0: mov x, y side 1 [1]
|
||||
0x6001, // 1: out pins, 1 side 0
|
||||
0x4001, // 2: in pins, 1 side 0
|
||||
0x1941, // 3: jmp x--, 1 side 3 [1]
|
||||
0x5001, // 4: in pins, 1 side 2
|
||||
0x7001, // 5: out pins, 1 side 2
|
||||
// .wrap
|
||||
};
|
||||
|
||||
#if !PICO_NO_HARDWARE
|
||||
static const struct pio_program pio_tdm_inout_program = {
|
||||
.instructions = pio_tdm_inout_program_instructions,
|
||||
.length = 6,
|
||||
.origin = -1,
|
||||
.pio_version = 0,
|
||||
#if PICO_PIO_VERSION > 0
|
||||
.used_gpio_ranges = 0x0
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline pio_sm_config pio_tdm_inout_program_get_default_config(uint offset) {
|
||||
pio_sm_config c = pio_get_default_sm_config();
|
||||
sm_config_set_wrap(&c, offset + pio_tdm_inout_wrap_target, offset + pio_tdm_inout_wrap);
|
||||
sm_config_set_sideset(&c, 2, false, false);
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------ //
|
||||
// pio_tdm_inout_swap //
|
||||
// ------------------ //
|
||||
|
||||
#define pio_tdm_inout_swap_wrap_target 0
|
||||
#define pio_tdm_inout_swap_wrap 5
|
||||
|
||||
static const uint16_t pio_tdm_inout_swap_program_instructions[] = {
|
||||
// .wrap_target
|
||||
0xb122, // 0: mov x, y side 2 [1]
|
||||
0x6001, // 1: out pins, 1 side 0
|
||||
0x4001, // 2: in pins, 1 side 0
|
||||
0x1941, // 3: jmp x--, 1 side 3 [1]
|
||||
0x4801, // 4: in pins, 1 side 1
|
||||
0x6801, // 5: out pins, 1 side 1
|
||||
// .wrap
|
||||
};
|
||||
|
||||
#if !PICO_NO_HARDWARE
|
||||
static const struct pio_program pio_tdm_inout_swap_program = {
|
||||
.instructions = pio_tdm_inout_swap_program_instructions,
|
||||
.length = 6,
|
||||
.origin = -1,
|
||||
.pio_version = 0,
|
||||
#if PICO_PIO_VERSION > 0
|
||||
.used_gpio_ranges = 0x0
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline pio_sm_config pio_tdm_inout_swap_program_get_default_config(uint offset) {
|
||||
pio_sm_config c = pio_get_default_sm_config();
|
||||
sm_config_set_wrap(&c, offset + pio_tdm_inout_swap_wrap_target, offset + pio_tdm_inout_swap_wrap);
|
||||
sm_config_set_sideset(&c, 2, false, false);
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------ //
|
||||
// pio_lsbj_out //
|
||||
// ------------ //
|
||||
@@ -490,6 +564,36 @@ static inline void pio_tdm_out_program_init(PIO pio, uint sm, uint offset, uint
|
||||
// Need to make OSR believe there's nothing left to shift out, or the 1st word will be the count we just passed in, not a sample
|
||||
pio_sm_exec(pio, sm, pio_encode_out(pio_osr, 32));
|
||||
}
|
||||
static inline void pio_tdm_inout_program_init(PIO pio, uint sm, uint offset, uint data_in_pin, uint data_out_pin, uint clock_pin_base, uint bits, bool swap, uint channels) {
|
||||
pio_gpio_init(pio, data_in_pin);
|
||||
pio_gpio_init(pio, data_out_pin);
|
||||
pio_gpio_init(pio, clock_pin_base);
|
||||
pio_gpio_init(pio, clock_pin_base + 1);
|
||||
pio_sm_config c = swap ? pio_tdm_inout_swap_program_get_default_config(offset) : pio_tdm_inout_program_get_default_config(offset);
|
||||
sm_config_set_in_pins(&c, data_in_pin);
|
||||
sm_config_set_out_pins(&c, data_out_pin, 1);
|
||||
sm_config_set_sideset_pins(&c, clock_pin_base);
|
||||
sm_config_set_in_shift(&c, false, true, 32);
|
||||
sm_config_set_out_shift(&c, false, true, 32);
|
||||
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_NONE);
|
||||
pio_sm_init(pio, sm, offset, &c);
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, data_in_pin, 1, false);
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, data_out_pin, 1, true);
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, clock_pin_base, 2, true);
|
||||
pio_sm_set_set_pins(pio, sm, data_out_pin, 1);
|
||||
pio_sm_set_set_pins(pio, sm, clock_pin_base, 2);
|
||||
// Initialize PIO state for TDM
|
||||
// Can't set constant > 31, so push and pop/mov if needed
|
||||
if (bits * channels - 1 > 31) {
|
||||
pio_sm_put_blocking(pio, sm, bits * channels - 2);
|
||||
pio_sm_exec(pio, sm, pio_encode_pull(false, false));
|
||||
pio_sm_exec(pio, sm, pio_encode_mov(pio_y, pio_osr));
|
||||
} else {
|
||||
pio_sm_exec(pio, sm, pio_encode_set(pio_y, bits * channels - 2));
|
||||
}
|
||||
// Need to make OSR believe there's nothing left to shift out
|
||||
pio_sm_exec(pio, sm, pio_encode_out(pio_osr, 32));
|
||||
}
|
||||
static inline void pio_lsbj_out_program_init(PIO pio, uint sm, uint offset, uint data_pin, uint clock_pin_base, uint bits, bool swap) {
|
||||
pio_gpio_init(pio, data_pin);
|
||||
pio_gpio_init(pio, clock_pin_base);
|
||||
|
||||
@@ -263,7 +263,7 @@ void SPIClassRP2040::abortAsync() {
|
||||
|
||||
|
||||
bool SPIClassRP2040::setRX(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({0, 4, 16, 20, 32, 26}) /* SPI0 */,
|
||||
__bitset({8, 12, 24, 28, 40, 44}) /* SPI1 */
|
||||
};
|
||||
@@ -290,7 +290,7 @@ bool SPIClassRP2040::setRX(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SPIClassRP2040::setCS(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({1, 5, 17, 21, 33, 37}) /* SPI0 */,
|
||||
__bitset({9, 13, 25, 29, 41, 45}) /* SPI1 */
|
||||
};
|
||||
@@ -317,7 +317,7 @@ bool SPIClassRP2040::setCS(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SPIClassRP2040::setSCK(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({2, 6, 18, 22, 34, 38}) /* SPI0 */,
|
||||
__bitset({10, 14, 26, 30, 42, 46}) /* SPI1 */
|
||||
};
|
||||
@@ -344,7 +344,7 @@ bool SPIClassRP2040::setSCK(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SPIClassRP2040::setTX(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({3, 7, 19, 23, 35, 39}) /* SPI0 */,
|
||||
__bitset({11, 15, 27, 31, 43, 47}) /* SPI1 */
|
||||
};
|
||||
|
||||
+166
-12
@@ -25,65 +25,219 @@
|
||||
#include <hardware/spi.h>
|
||||
#include "SPIHelper.h"
|
||||
|
||||
/**
|
||||
@brief Implements a hardware-based SPI interface using the Pico's SPI blocks
|
||||
*/
|
||||
class SPIClassRP2040 : public arduino::HardwareSPI {
|
||||
public:
|
||||
/**
|
||||
@brief Create a PIO-based SPI instance, pins can be changed before begin() call
|
||||
|
||||
@param [in] spi SPI hardware instance (spi0/spi1)
|
||||
@param [in] rx MISO GPIO
|
||||
@param [in] cs CS GPIO
|
||||
@param [in] sck SCK GPIO
|
||||
@param [in] tx MOSI GPIO
|
||||
*/
|
||||
SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_size_t sck, pin_size_t tx);
|
||||
|
||||
// Send or receive 8- or 16-bit data. Returns read back value
|
||||
/**
|
||||
@brief Send an 8-bit byte of data and return read-back 8-bit value
|
||||
|
||||
@param [in] data Data to send
|
||||
@returns Read back byte from SPI interface
|
||||
*/
|
||||
byte transfer(uint8_t data) override;
|
||||
|
||||
/**
|
||||
@brief Send a 16-bit quantity over SPI and return read-back 16-bit value under a single CS assertion
|
||||
|
||||
@param [in] data Data to send
|
||||
@returns Read back 16-bit quantity
|
||||
*/
|
||||
uint16_t transfer16(uint16_t data) override;
|
||||
|
||||
// Sends buffer in 8 bit chunks. Overwrites buffer with read data
|
||||
|
||||
/**
|
||||
@brief Sends buffer in 8 bit chunks under a single CS. Overwrites buffer with read data
|
||||
|
||||
@param [in, out] buf Buffer to read and write back into
|
||||
@param [in] count Number of bytes to transmit/read
|
||||
*/
|
||||
void transfer(void *buf, size_t count) override;
|
||||
|
||||
// Sends one buffer and receives into another, much faster! can set rx or txbuf to nullptr
|
||||
/**
|
||||
@brief Sends one buffer and receives into another under a single CS. Can set rx or txbuf to nullptr
|
||||
|
||||
@param [in] txbuf Buffer to transmit or nullptr to send 0s
|
||||
@param [out] rxbuf Buffer to read back into or nullptr to ignore returned data
|
||||
@param [in] count Numbner of bytes to transmit/receive
|
||||
*/
|
||||
void transfer(const void *txbuf, void *rxbuf, size_t count) override;
|
||||
|
||||
// DMA/asynchronous transfers. Do not combime with synchronous runs or bad stuff will happen
|
||||
// All buffers must be valid for entire DMA and not touched until `finished()` returns true.
|
||||
/**
|
||||
@brief Perform a transfer() using DMA in the background. Returns immediately, need to check for completion
|
||||
|
||||
@details
|
||||
Do not combine asynchronous and synchronous transfers. All buffers must be valid until
|
||||
the transfer reports that it is completed (``finished`` returns true).
|
||||
|
||||
@param [in] send Buffer to transmit, must remain valid through entire operation
|
||||
@param [out] recv Buffer to receive, must remain valid through entire operation
|
||||
@param [in] bytes Number of bytes to transfer under single CS
|
||||
*/
|
||||
bool transferAsync(const void *send, void *recv, size_t bytes);
|
||||
bool finishedAsync(); // Call to check if the async operations is completed and the buffer can be reused/read
|
||||
void abortAsync(); // Cancel an outstanding async operation
|
||||
/**
|
||||
@brief Call to check if the async operations is completed and the buffer can be reused/read
|
||||
|
||||
@returns True if the asynchronous SPI operation has completed and ``recv`` buffer is valid
|
||||
*/
|
||||
bool finishedAsync();
|
||||
|
||||
/**
|
||||
@brief Aborts an ongoing asynchronous SPI operation, if one is still operating
|
||||
|
||||
@details
|
||||
Not normally needed, but in the case where a large, long SPI operation needs to be aborted
|
||||
this call allows an application to safely stop the SPI and dispose of the ``recv`` and
|
||||
``send`` buffers
|
||||
*/
|
||||
void abortAsync();
|
||||
|
||||
|
||||
// Call before/after every complete transaction
|
||||
/**
|
||||
@brief Begin an SPI transaction, sets SPI speed and masks necessary interrupts
|
||||
|
||||
@param [in] SPISettings SPI configuration parameters, including the clock speed
|
||||
*/
|
||||
void beginTransaction(SPISettings settings) override;
|
||||
|
||||
/**
|
||||
@brief Ends an SPI transaction, unmasks and masked GPIO interrupts
|
||||
*/
|
||||
void endTransaction(void) override;
|
||||
|
||||
// Assign pins, call before begin()
|
||||
/**
|
||||
@brief Sets the MISO(RX) pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
bool setRX(pin_size_t pin);
|
||||
|
||||
/**
|
||||
@brief Sets the MISO(RX) pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
inline bool setMISO(pin_size_t pin) {
|
||||
return setRX(pin);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Sets the CS pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
bool setCS(pin_size_t pin);
|
||||
|
||||
/**
|
||||
@brief Sets the SCK pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
bool setSCK(pin_size_t pin);
|
||||
|
||||
/**
|
||||
@brief Sets the MOSI(TX) pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
bool setTX(pin_size_t pin);
|
||||
|
||||
/**
|
||||
@brief Sets the MOSI(TX) pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
inline bool setMOSI(pin_size_t pin) {
|
||||
return setTX(pin);
|
||||
}
|
||||
|
||||
// Call once to init/deinit SPI class, select pins, etc.
|
||||
/**
|
||||
@brief Call once to init/deinit SPI class, select pins, etc.
|
||||
*/
|
||||
virtual void begin() override {
|
||||
begin(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Call once to init/deinit SPI class, select pins, etc.
|
||||
|
||||
@param [in] hwCS Pass in true to enable HW-controlled CS. Otherwise application needs to assert/deassert CS.
|
||||
*/
|
||||
void begin(bool hwCS);
|
||||
|
||||
/**
|
||||
@brief Call to deinit and disable the SPI interface.
|
||||
*/
|
||||
void end() override;
|
||||
|
||||
// Deprecated - do not use!
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
|
||||
@param [in] order Deprecated
|
||||
*/
|
||||
void setBitOrder(BitOrder order) __attribute__((deprecated));
|
||||
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
|
||||
@param [in] order Deprecated
|
||||
*/
|
||||
void setDataMode(uint8_t uc_mode) __attribute__((deprecated));
|
||||
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
|
||||
@param [in] order Deprecated
|
||||
*/
|
||||
void setClockDivider(uint8_t uc_div) __attribute__((deprecated));
|
||||
|
||||
// List of GPIO IRQs to disable during a transaction
|
||||
/**
|
||||
@brief Ensure specific GPIO interrupt is disabled during and SPI transaction to protect against re-entrancy. Multiple GPIOs supported by multiple calls.
|
||||
|
||||
@param [in] interruptNumber GPIO pin to mask
|
||||
*/
|
||||
virtual void usingInterrupt(int interruptNumber) override {
|
||||
_helper.usingInterrupt(interruptNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Remove a GPIO from the masked-during-transaction list.
|
||||
|
||||
@param [in] interruptNumber GPIO pin to unmask
|
||||
*/
|
||||
virtual void notUsingInterrupt(int interruptNumber) override {
|
||||
_helper.notUsingInterrupt(interruptNumber);
|
||||
}
|
||||
virtual void attachInterrupt() override { /* noop */ }
|
||||
virtual void detachInterrupt() override { /* noop */ }
|
||||
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
*/
|
||||
virtual void attachInterrupt() override __attribute__((deprecated)) { /* noop */ }
|
||||
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
*/
|
||||
virtual void detachInterrupt() override __attribute__((deprecated)) { /* noop */ }
|
||||
|
||||
private:
|
||||
void adjustBuffer(const void *s, void *d, size_t cnt, bool by16);
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
return (reverseByte(w & 0xff) << 8) | (reverseByte(w >> 8));
|
||||
}
|
||||
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
static constexpr int GPIOIRQREGS = 6;
|
||||
#else
|
||||
static constexpr int GPIOIRQREGS = 4;
|
||||
@@ -108,6 +108,9 @@ public:
|
||||
@brief Disables any GPIO interrupts registered before an SPI transaction begins
|
||||
*/
|
||||
void maskInterrupts() {
|
||||
if (_usingIRQs.empty()) {
|
||||
return;
|
||||
}
|
||||
noInterrupts(); // Avoid possible race conditions if IRQ comes in while main app is in middle of this
|
||||
// Disable any IRQs that are being used for SPI
|
||||
io_bank0_irq_ctrl_hw_t *irq_ctrl_base = get_core_num() ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl;
|
||||
@@ -134,6 +137,9 @@ public:
|
||||
@brief Restores GPIO interrupts masks after an SPI transaction completes
|
||||
*/
|
||||
void unmaskInterrupts() {
|
||||
if (_usingIRQs.empty()) {
|
||||
return;
|
||||
}
|
||||
noInterrupts(); // Avoid race condition so the GPIO IRQs won't come back until all state is restored
|
||||
DEBUGSPI("SPI::endTransaction()\n");
|
||||
// Re-enable IRQs
|
||||
|
||||
@@ -79,7 +79,7 @@ inline spi_cpha_t SPISlaveClass::cpha(SPISettings _spis) {
|
||||
}
|
||||
|
||||
bool SPISlaveClass::setRX(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({0, 4, 16, 20, 32, 26}) /* SPI0 */,
|
||||
__bitset({8, 12, 24, 28, 40, 44}) /* SPI1 */
|
||||
};
|
||||
@@ -106,7 +106,7 @@ bool SPISlaveClass::setRX(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SPISlaveClass::setCS(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({1, 5, 17, 21, 33, 37}) /* SPI0 */,
|
||||
__bitset({9, 13, 25, 29, 41, 45}) /* SPI1 */
|
||||
};
|
||||
@@ -133,7 +133,7 @@ bool SPISlaveClass::setCS(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SPISlaveClass::setSCK(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({2, 6, 18, 22, 34, 38}) /* SPI0 */,
|
||||
__bitset({10, 14, 26, 30, 42, 46}) /* SPI1 */
|
||||
};
|
||||
@@ -160,7 +160,7 @@ bool SPISlaveClass::setSCK(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool SPISlaveClass::setTX(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({3, 7, 19, 23, 35, 39}) /* SPI0 */,
|
||||
__bitset({11, 15, 27, 31, 43, 47}) /* SPI1 */
|
||||
};
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
#include <api/HardwareSPI.h>
|
||||
#include <hardware/spi.h>
|
||||
|
||||
/**
|
||||
@brief Implements a PIO-based SPI interface without pin restrictions
|
||||
*/
|
||||
class SoftwareSPI : public arduino::HardwareSPI {
|
||||
public:
|
||||
/**
|
||||
@@ -37,53 +40,170 @@ public:
|
||||
*/
|
||||
SoftwareSPI(pin_size_t sck, pin_size_t miso, pin_size_t mosi, pin_size_t cs = -1);
|
||||
|
||||
// Send or receive 8- or 16-bit data. Returns read back value
|
||||
/**
|
||||
@brief Send an 8-bit byte of data and return read-back 8-bit value
|
||||
|
||||
@param [in] data Data to send
|
||||
@returns Read back byte from SPI interface
|
||||
*/
|
||||
byte transfer(uint8_t data) override;
|
||||
|
||||
/**
|
||||
@brief Send a 16-bit quantity over SPI and return read-back 16-bit value under a single CS assertion
|
||||
|
||||
@param [in] data Data to send
|
||||
@returns Read back 16-bit quantity
|
||||
*/
|
||||
uint16_t transfer16(uint16_t data) override;
|
||||
|
||||
// Sends buffer in 8 bit chunks. Overwrites buffer with read data
|
||||
/**
|
||||
@brief Sends buffer in 8 bit chunks under a single CS. Overwrites buffer with read data
|
||||
|
||||
@param [in, out] buf Buffer to read and write back into
|
||||
@param [in] count Number of bytes to transmit/read
|
||||
*/
|
||||
void transfer(void *buf, size_t count) override;
|
||||
|
||||
// Sends one buffer and receives into another, much faster! can set rx or txbuf to nullptr
|
||||
/**
|
||||
@brief Sends one buffer and receives into another under a single CS. Can set rx or txbuf to nullptr
|
||||
|
||||
@param [in] txbuf Buffer to transmit or nullptr to send 0s
|
||||
@param [out] rxbuf Buffer to read back into or nullptr to ignore returned data
|
||||
@param [in] count Numbner of bytes to transmit/receive
|
||||
*/
|
||||
void transfer(const void *txbuf, void *rxbuf, size_t count) override;
|
||||
|
||||
// Call before/after every complete transaction
|
||||
/**
|
||||
@brief Begin an SPI transaction, sets SPI speed and masks necessary interrupts
|
||||
|
||||
@param [in] SPISettings SPI configuration parameters, including the clock speed
|
||||
*/
|
||||
void beginTransaction(SPISettings settings) override;
|
||||
|
||||
/**
|
||||
@brief Ends an SPI transaction, unmasks and masked GPIO interrupts
|
||||
*/
|
||||
void endTransaction(void) override;
|
||||
|
||||
// Assign pins, call before begin()
|
||||
/**
|
||||
@brief Sets the MISO(RX) pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
bool setMISO(pin_size_t pin);
|
||||
|
||||
/**
|
||||
@brief Sets the MISO(RX) pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
inline bool setRX(pin_size_t pin) {
|
||||
return setMISO(pin);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Sets the CS pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
bool setCS(pin_size_t pin);
|
||||
|
||||
/**
|
||||
@brief Sets the SCK pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
bool setSCK(pin_size_t pin);
|
||||
|
||||
/**
|
||||
@brief Sets the MOSI(TX) pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
bool setMOSI(pin_size_t pin);
|
||||
|
||||
/**
|
||||
@brief Sets the MOSI(TX) pin. Call before begin()
|
||||
|
||||
@param [in] pin The GPIO number to assign to
|
||||
@returns True on success
|
||||
*/
|
||||
inline bool setTX(pin_size_t pin) {
|
||||
return setMOSI(pin);
|
||||
}
|
||||
|
||||
// Call once to init/deinit SPI class, select pins, etc.
|
||||
/**
|
||||
@brief Call once to init/deinit SPI class, select pins, etc.
|
||||
*/
|
||||
virtual void begin() override {
|
||||
begin(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Call once to init/deinit SPI class, select pins, etc.
|
||||
|
||||
@param [in] hwCS Pass in true to enable HW-controlled CS. Otherwise application needs to assert/deassert CS.
|
||||
*/
|
||||
void begin(bool hwCS);
|
||||
|
||||
/**
|
||||
@brief Call to deinit and disable the SPI interface.
|
||||
*/
|
||||
void end() override;
|
||||
|
||||
// Deprecated - do not use!
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
|
||||
@param [in] order Deprecated
|
||||
*/
|
||||
void setBitOrder(BitOrder order) __attribute__((deprecated));
|
||||
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
|
||||
@param [in] uc_mode Deprecated
|
||||
*/
|
||||
void setDataMode(uint8_t uc_mode) __attribute__((deprecated));
|
||||
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
|
||||
@param [in] uc_div Deprecated
|
||||
*/
|
||||
void setClockDivider(uint8_t uc_div) __attribute__((deprecated));
|
||||
|
||||
// List of GPIO IRQs to disable during a transaction
|
||||
/**
|
||||
@brief Ensure specific GPIO interrupt is disabled during and SPI transaction to protect against re-entrancy. Multiple GPIOs supported by multiple calls.
|
||||
|
||||
@param [in] interruptNumber GPIO pin to mask
|
||||
*/
|
||||
virtual void usingInterrupt(int interruptNumber) override {
|
||||
_helper.usingInterrupt(interruptNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Remove a GPIO from the masked-during-transaction list.
|
||||
|
||||
@param [in] interruptNumber GPIO pin to unmask
|
||||
*/
|
||||
virtual void notUsingInterrupt(int interruptNumber) override {
|
||||
_helper.notUsingInterrupt(interruptNumber);
|
||||
}
|
||||
virtual void attachInterrupt() override { /* noop */ }
|
||||
virtual void detachInterrupt() override { /* noop */ }
|
||||
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
*/
|
||||
virtual void attachInterrupt() override __attribute__((deprecated)) { /* noop */ }
|
||||
|
||||
/**
|
||||
@brief Deprecated, do not use
|
||||
*/
|
||||
virtual void detachInterrupt() override __attribute__((deprecated)) { /* noop */ }
|
||||
|
||||
private:
|
||||
void _adjustPIO(int bits);
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
#if USE_WIFI
|
||||
#include <WiFi.h>
|
||||
#elif USE_WIRED
|
||||
#include <W5500lwIP.h> // Or W5100lwIP.h or ENC28J60lwIP.h
|
||||
Wiznet5500lwIP eth(1 /* chip select */); // or Wiznet5100lwIP or ENC28J60lwIP
|
||||
#include <W5500lwIP.h> // or W6100lwIP.h or W5100lwIP.h or ENC28J60lwIP.h
|
||||
Wiznet5500lwIP eth(1 /* SPI chip select */); // or Wiznet6100lwIP or Wiznet5100lwIP or ENC28J60lwIP
|
||||
#endif
|
||||
|
||||
#include <WiFiClient.h>
|
||||
|
||||
@@ -216,9 +216,9 @@ void handleFileList() {
|
||||
// as an HTTP chunk
|
||||
Serial.println(output);
|
||||
server.sendContent(output);
|
||||
output = ',';
|
||||
output = ",";
|
||||
} else {
|
||||
output = '[';
|
||||
output = "[";
|
||||
}
|
||||
|
||||
output += "{\"type\":\"";
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Udp.h>
|
||||
#include <include/slist.h>
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ TwoWire::TwoWire(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl) {
|
||||
}
|
||||
|
||||
bool TwoWire::setSDA(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44}) /* I2C0 */,
|
||||
__bitset({2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46}) /* I2C1 */
|
||||
};
|
||||
@@ -76,7 +76,7 @@ bool TwoWire::setSDA(pin_size_t pin) {
|
||||
}
|
||||
|
||||
bool TwoWire::setSCL(pin_size_t pin) {
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
constexpr uint64_t valid[2] = { __bitset({1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45}) /* I2C0 */,
|
||||
__bitset({3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47}) /* I2C1 */
|
||||
};
|
||||
@@ -489,6 +489,14 @@ void TwoWire::flush(void) {
|
||||
// data transfer.
|
||||
}
|
||||
|
||||
bool TwoWire::busIdle() {
|
||||
// Check hardware status
|
||||
uint32_t status = _i2c->hw->status;
|
||||
bool tfe = (status & I2C_IC_STATUS_TFE_BITS);
|
||||
bool mast = (status & I2C_IC_STATUS_MST_ACTIVITY_BITS);
|
||||
return (tfe && !mast);
|
||||
}
|
||||
|
||||
// DMA/asynchronous transfers. Do not combime with synchronous runs or bad stuff will happen
|
||||
// All buffers must be valid for entire DMA and not touched until `finishedAsync()` returns true.
|
||||
bool TwoWire::writeReadAsync(uint8_t address, const void *wbuffer, size_t wbytes, const void *rbuffer, size_t rbytes, bool sendStop) {
|
||||
@@ -496,6 +504,10 @@ bool TwoWire::writeReadAsync(uint8_t address, const void *wbuffer, size_t wbytes
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!busIdle()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_dmaRunning) {
|
||||
beginAsync();
|
||||
if (!_dmaRunning) {
|
||||
@@ -507,7 +519,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 +530,7 @@ bool TwoWire::writeReadAsync(uint8_t address, const void *wbuffer, size_t wbytes
|
||||
if (!_dmaSendBuffer) {
|
||||
return false;
|
||||
}
|
||||
_dmaSendBufferLen = bufLen;
|
||||
}
|
||||
|
||||
// Fill the dma command buffer
|
||||
|
||||
@@ -87,6 +87,7 @@ public:
|
||||
bool writeReadAsync(uint8_t address, const void *wbuffer, size_t wbytes, const void *rbuffer, size_t rbytes, bool sendStop = true);
|
||||
bool writeAsync(uint8_t address, const void *buffer, size_t bytes, bool sendStop = true);
|
||||
bool readAsync(uint8_t address, void *buffer, size_t bytes, bool sendStop = true);
|
||||
bool busIdle();
|
||||
bool finishedAsync(); // Call to check if the async operations is completed and the buffer can be reused/read
|
||||
void abortAsync(); // Cancel an outstanding async I2C operation
|
||||
void onFinishedAsync(void(*function)(void)); // Set callback for async operation
|
||||
|
||||
@@ -75,7 +75,7 @@ void __removeEthernetPacketHandler(int id) {
|
||||
}
|
||||
|
||||
#define GPIOSTACKSIZE 8
|
||||
#ifdef PICO_RP2350B
|
||||
#if defined(PICO_RP2350) && !PICO_RP2350A // RP2350B
|
||||
#define GPIOIRQREGS 6
|
||||
#define GPIOIRQREGSINIT 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff
|
||||
#else
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
const char* host = "djxmmx.net";
|
||||
const uint16_t port = 17;
|
||||
|
||||
Wiznet55rp20lwIP eth(1 /* chip select */);
|
||||
Wiznet55rp20lwIP eth(20 /* chip select */);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
Constructor that uses the default hardware SPI pins
|
||||
@param cs the Arduino Chip Select / Slave Select pin (default 10)
|
||||
*/
|
||||
Wiznet55rp20(int8_t cs = SS, SPIClass& spi = SPI, int8_t intr = -1);
|
||||
Wiznet55rp20(int8_t cs = WIZNET_PIO_SPI_CS_PIN, SPIClass& spi = SPI, int8_t intr = -1);
|
||||
//Wiznet55rp20();
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "framework-arduinopico",
|
||||
"version": "1.40403.0",
|
||||
"version": "1.40502.0",
|
||||
"description": "Arduino Wiring-based Framework (RPi Pico RP2040, RP2350)",
|
||||
"keywords": [
|
||||
"framework",
|
||||
|
||||
@@ -80,12 +80,21 @@
|
||||
{
|
||||
"name": "Adafruit KB2040"
|
||||
},
|
||||
{
|
||||
"name": "Adafruit Feather RP2350 Adalogger"
|
||||
},
|
||||
{
|
||||
"name": "Adafruit Feather RP2350 HSTX"
|
||||
},
|
||||
{
|
||||
"name": "Adafruit Floppsy"
|
||||
},
|
||||
{
|
||||
"name": "Adafruit Metro RP2350"
|
||||
},
|
||||
{
|
||||
"name": "Adafruit Fruit Jam RP2350"
|
||||
},
|
||||
{
|
||||
"name": "Amken BunnyBoard"
|
||||
},
|
||||
@@ -206,6 +215,12 @@
|
||||
{
|
||||
"name": "iLabs Challenger 2350 BConnect"
|
||||
},
|
||||
{
|
||||
"name": "Makerbase MKS THR36"
|
||||
},
|
||||
{
|
||||
"name": "Makerbase MKS THR42"
|
||||
},
|
||||
{
|
||||
"name": "Melopero Cookie RP2040"
|
||||
},
|
||||
@@ -228,10 +243,13 @@
|
||||
"name": "nullbits Bit-C PRO"
|
||||
},
|
||||
{
|
||||
"name": "Olimex RP2040-Pico30 2MB"
|
||||
"name": "Olimex Pico2XL"
|
||||
},
|
||||
{
|
||||
"name": "Olimex RP2040-Pico30 16MB"
|
||||
"name": "Olimex Pico2XXL"
|
||||
},
|
||||
{
|
||||
"name": "Olimex RP2040-Pico30"
|
||||
},
|
||||
{
|
||||
"name": "Pimoroni PGA2040"
|
||||
@@ -251,6 +269,9 @@
|
||||
{
|
||||
"name": "Pimoroni Plasma2350"
|
||||
},
|
||||
{
|
||||
"name": "Pimoroni Servo2040"
|
||||
},
|
||||
{
|
||||
"name": "Pimoroni Tiny2040"
|
||||
},
|
||||
@@ -284,6 +305,9 @@
|
||||
{
|
||||
"name": "Solder Party RP2350 Stamp XL"
|
||||
},
|
||||
{
|
||||
"name": "SparkFun IoT RedBoard RP2350"
|
||||
},
|
||||
{
|
||||
"name": "SparkFun MicroMod RP2040"
|
||||
},
|
||||
@@ -302,6 +326,12 @@
|
||||
{
|
||||
"name": "SparkFun IoT Node LoRaWAN"
|
||||
},
|
||||
{
|
||||
"name": "SparkFun XRP Controller (Beta)"
|
||||
},
|
||||
{
|
||||
"name": "SparkFun XRP Controller"
|
||||
},
|
||||
{
|
||||
"name": "Seeed INDICATOR RP2040"
|
||||
},
|
||||
|
||||
+1
-1
Submodule pico-sdk updated: 95ea6acad1...b1676c18a3
+1
-1
@@ -20,7 +20,7 @@
|
||||
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
|
||||
|
||||
name=Raspberry Pi RP2040/RP2350 Boards
|
||||
version=4.4.3
|
||||
version=4.5.2
|
||||
|
||||
# Required discoveries and monitors
|
||||
# ---------------------------------
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x239A",
|
||||
"usb_pid": "0x816D"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_ADAFRUIT_FEATHER_RP2350_ADALOGGER -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x816D"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "adafruit_feather_rp2350_adalogger"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Feather RP2350 Adalogger",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Adafruit"
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x239A",
|
||||
"usb_pid": "0x816B"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_ADAFRUIT_FRUITJAM_RP2350 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x816B"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "adafruit_fruitjam"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Fruit Jam RP2350",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 16777216,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"blackmagic",
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
],
|
||||
"psram_length": 8388608
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Adafruit"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -3,13 +3,13 @@
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x15BA",
|
||||
"usb_pid": "0x0026"
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x000A"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-DARDUINO_OLIMEX_RP2040_PICO30_16MB -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"extra_flags": "-DARDUINO_MAKERBASE_MKSTHR36 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
@@ -17,12 +17,12 @@
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x15BA",
|
||||
"0x0026"
|
||||
"0x2E8A",
|
||||
"0x000A"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "olimex_rp2040pico30_16mb"
|
||||
"variant": "mksthr36"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
@@ -32,10 +32,10 @@
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "RP2040-Pico30 16MB",
|
||||
"name": "MKS THR36",
|
||||
"upload": {
|
||||
"maximum_ram_size": 262144,
|
||||
"maximum_size": 16777216,
|
||||
"maximum_size": 1048576,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
@@ -51,5 +51,5 @@
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Olimex"
|
||||
"vendor": "Makerbase"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x000A"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-DARDUINO_MAKERBASE_MKSTHR42 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x000A"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "mksthr42"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "MKS THR42",
|
||||
"upload": {
|
||||
"maximum_ram_size": 262144,
|
||||
"maximum_size": 1048576,
|
||||
"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": "Makerbase"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x15BA",
|
||||
"usb_pid": "0x0026"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_OLIMEX_PICO2XL -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x15BA",
|
||||
"0x0026"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "olimex_pico2xl"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Pico2XL",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 2097152,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"blackmagic",
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Olimex"
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x15BA",
|
||||
"usb_pid": "0x0026"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_OLIMEX_PICO2XXL -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x15BA",
|
||||
"0x0026"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "olimex_pico2xxl"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Pico2XXL",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 16777216,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"blackmagic",
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
],
|
||||
"psram_length": 8388608
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Olimex"
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-DARDUINO_OLIMEX_RP2040_PICO30_2MB -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"extra_flags": "-DARDUINO_OLIMEX_RP2040_PICO30 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 ",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
@@ -22,7 +22,7 @@
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "olimex_rp2040pico30_2mb"
|
||||
"variant": "olimex_rp2040pico30"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
@@ -32,7 +32,7 @@
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "RP2040-Pico30 2MB",
|
||||
"name": "RP2040-Pico30",
|
||||
"upload": {
|
||||
"maximum_ram_size": 262144,
|
||||
"maximum_size": 2097152,
|
||||
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_PIMORONI_PLASMA2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
|
||||
"extra_flags": "-DARDUINO_PIMORONI_PLASMA2350 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x2E8A",
|
||||
"usb_pid": "0x10A5"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-DARDUINO_PIMORONI_SERVO2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 ",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x10A5"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "pimoroni_servo2040"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Servo2040",
|
||||
"upload": {
|
||||
"maximum_ram_size": 262144,
|
||||
"maximum_size": 2097152,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"blackmagic",
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "Pimoroni"
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
"name": "XIAO RP2350",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 16777216,
|
||||
"maximum_size": 2097152,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
@@ -48,8 +48,7 @@
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
],
|
||||
"psram_length": 8388608
|
||||
]
|
||||
},
|
||||
"url": "https://www.seeedstudio.com/Seeed-XIAO-RP2350-p-5944.html",
|
||||
"vendor": "Seeed"
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x1B4F",
|
||||
"usb_pid": "0x0047"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_SPARKFUN_IOTREDBOARD_RP2350 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x1B4F",
|
||||
"0x0047"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "sparkfun_iotredboard_rp2350"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "IoT RedBoard RP2350",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 16777216,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"blackmagic",
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
],
|
||||
"psram_length": 8388608
|
||||
},
|
||||
"url": "https://www.sparkfun.com/sparkfun-iot-redboard-rp2350.html",
|
||||
"vendor": "SparkFun"
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "none.S",
|
||||
"usb_vid": "0x1B4F",
|
||||
"usb_pid": "0x0046"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m33",
|
||||
"extra_flags": "-DARDUINO_SPARKFUN_XRP_CONTROLLER -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
|
||||
"f_cpu": "150000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x1B4F",
|
||||
"0x0046"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2350",
|
||||
"variant": "sparkfun_xrp_controller"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2350_0",
|
||||
"openocd_target": "rp2350.cfg",
|
||||
"svd_path": "rp2350.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "XRP Controller",
|
||||
"upload": {
|
||||
"maximum_ram_size": 524288,
|
||||
"maximum_size": 16777216,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"blackmagic",
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
],
|
||||
"psram_length": 8388608
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "SparkFun"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"earlephilhower": {
|
||||
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
|
||||
"usb_vid": "0x1B4F",
|
||||
"usb_pid": "0x0045"
|
||||
}
|
||||
},
|
||||
"core": "earlephilhower",
|
||||
"cpu": "cortex-m0plus",
|
||||
"extra_flags": "-DARDUINO_SPARKFUN_XRP_CONTROLLER_BETA -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DPICO_CYW43_SUPPORTED=1 -DCYW43_PIN_WL_DYNAMIC=1",
|
||||
"f_cpu": "133000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2E8A",
|
||||
"0x00C0"
|
||||
],
|
||||
[
|
||||
"0x1B4F",
|
||||
"0x0045"
|
||||
]
|
||||
],
|
||||
"mcu": "rp2040",
|
||||
"variant": "sparkfun_xrp_controller_beta"
|
||||
},
|
||||
"debug": {
|
||||
"jlink_device": "RP2040_M0_0",
|
||||
"openocd_target": "rp2040.cfg",
|
||||
"svd_path": "rp2040.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "XRP Controller (Beta)",
|
||||
"upload": {
|
||||
"maximum_ram_size": 262144,
|
||||
"maximum_size": 2097152,
|
||||
"require_upload_port": true,
|
||||
"native_usb": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": false,
|
||||
"protocol": "picotool",
|
||||
"protocols": [
|
||||
"blackmagic",
|
||||
"cmsis-dap",
|
||||
"jlink",
|
||||
"raspberrypi-swd",
|
||||
"picotool",
|
||||
"picoprobe"
|
||||
]
|
||||
},
|
||||
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
|
||||
"vendor": "SparkFun"
|
||||
}
|
||||
+29
-13
@@ -39,7 +39,7 @@ def BuildDebugLevel(name):
|
||||
|
||||
def BuildFreq(name, defmhz):
|
||||
out = 0
|
||||
for f in [ defmhz, 50, 100, 120, 125, 128, 133, 150, 175, 200, 225, 240, 250, 275, 300]:
|
||||
for f in [ defmhz, 50, 100, 120, 125, 128, 133, 150, 176, 200, 225, 240, 250, 276, 300]:
|
||||
warn = ""
|
||||
if f > defmhz: warn = " (Overclock)"
|
||||
if (out == 1) and (f == defmhz):
|
||||
@@ -85,7 +85,7 @@ def BuildPSRAMFreq(name):
|
||||
print("%s.menu.psramfreq.freq%d.build.psram_freq=-DRP2350_PSRAM_MAX_SCK_HZ=%d" % (name, s, s * 1000000))
|
||||
|
||||
def BuildRP2350Variant(name):
|
||||
for l in [ ("RP2350A", "-DPICO_RP2350A=1"), ("RP2530B", "-DPICO_RP2350B=1") ]:
|
||||
for l in [ ("RP2350A", "-D__PICO_RP2350A=1"), ("RP2530B", "-D__PICO_RP2350A=0") ]:
|
||||
print("%s.menu.variantchip.%s=%s" % (name, l[0], l[0]))
|
||||
print("%s.menu.variantchip.%s.build.variantdefines=%s" % (name, l[0], l[1]))
|
||||
|
||||
@@ -313,7 +313,8 @@ def BuildWifiType(name):
|
||||
print("%s.menu.espwifitype.esp_hosted.build.espwifitype=-DESPHOSTSPI=SPI1" % (name))
|
||||
|
||||
def MakeBoard(name, chip, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, psramsize, boot2, extra = None, board_url = None):
|
||||
fssizelist = [ 0, 64 * 1024, 128 * 1024, 256 * 1024, 512 * 1024 ]
|
||||
smallfs = [ 0, 64 * 1024, 128 * 1024, 256 * 1024, 512 * 1024 ]
|
||||
fssizelist = list(smallfs)
|
||||
for i in range(1, flashsizemb):
|
||||
fssizelist.append(i * 1024 * 1024)
|
||||
if chip == "rp2040":
|
||||
@@ -329,17 +330,21 @@ def MakeBoard(name, chip, vendor_name, product_name, vid, pid, pwr, boarddefine,
|
||||
raise Exception("Unknown board type " + str(chip));
|
||||
BuildHeader(name, chip, tup, opts, vendor_name, product_name, vid, pid, pwr, boarddefine, name, flashsizemb * 1024 * 1024, psramsize, boot2, extra)
|
||||
if (name == "generic") or (name == "generic_rp2350") or (name == "vccgnd_yd_rp2040"):
|
||||
BuildFlashMenu(name, chip, 2*1024*1024, [0, 1*1024*1024])
|
||||
smfs = [ 0, 64 * 1024, 128 * 1024, 256 * 1024, 512 * 1024 ]
|
||||
BuildFlashMenu(name, chip, 2*1024*1024, [*smallfs, 1024 * 1024])
|
||||
BuildFlashMenu(name, chip, 4*1024*1024, [0, 3*1024*1024, 2*1024*1024])
|
||||
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 == "pimoroni_tiny2040":
|
||||
BuildFlashMenu(name, chip, 2*1024*1024, fssizelist)
|
||||
BuildFlashMenu(name, chip, 2*1024*1024, [*smallfs, 1024 * 1024])
|
||||
BuildFlashMenu(name, chip, 8*1024*1024, [0, 7*1024*1024, 4*1024*1024, 2*1024*1024])
|
||||
elif name == "akana_r1":
|
||||
BuildFlashMenu(name, chip, 2*1024*1024, [0, 1*1024*1024])
|
||||
BuildFlashMenu(name, chip, 2*1024*1024, [*smallfs, 1024 * 1024])
|
||||
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 == "olimex_rp2040pico30":
|
||||
BuildFlashMenu(name, chip, 2*1024*1024, [*smallfs, 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 == "challenger_2350_wifi6_ble5") or (name == "challenger_2040_wifi_ble"):
|
||||
BuildWifiType(name)
|
||||
BuildCountry(name)
|
||||
@@ -363,7 +368,7 @@ def MakeBoard(name, chip, vendor_name, product_name, vid, pid, pwr, boarddefine,
|
||||
# Optional, user needs to solder themselves
|
||||
BuildPSRAM(name)
|
||||
else:
|
||||
BuildFreq(name, 133)
|
||||
BuildFreq(name, 200)
|
||||
BuildOptimize(name)
|
||||
BuildProfile(name)
|
||||
BuildRTTI(name)
|
||||
@@ -372,7 +377,7 @@ def MakeBoard(name, chip, vendor_name, product_name, vid, pid, pwr, boarddefine,
|
||||
BuildDebugPort(name)
|
||||
BuildDebugLevel(name)
|
||||
BuildUSBStack(name)
|
||||
if name in ["rpipicow", "pimoroni_pico_plus_2w", "sparkfun_thingplusrp2350"]:
|
||||
if name in ["rpipicow", "rpipico2w", "pimoroni_pico_plus_2w", "sparkfun_thingplusrp2350"]:
|
||||
BuildCountry(name)
|
||||
BuildIPBTStack(name)
|
||||
if name == "generic":
|
||||
@@ -514,9 +519,11 @@ MakeBoard("adafruit_stemmafriend", "rp2040", "Adafruit", "STEMMA Friend RP2040",
|
||||
MakeBoard("adafruit_trinkeyrp2040qt", "rp2040", "Adafruit", "Trinkey RP2040 QT", "0x239a", "0x8109", 250, "ADAFRUIT_TRINKEYQT_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("adafruit_macropad2040", "rp2040", "Adafruit", "MacroPad RP2040", "0x239a", "0x8107", 250, "ADAFRUIT_MACROPAD_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("adafruit_kb2040", "rp2040", "Adafruit", "KB2040", "0x239a", "0x8105", 250, "ADAFRUIT_KB2040_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("adafruit_feather_rp2350_adalogger", "rp2350", "Adafruit", "Feather RP2350 Adalogger", "0x239a", "0x816D", 250, "ADAFRUIT_FEATHER_RP2350_ADALOGGER", 8, 0, "none")
|
||||
MakeBoard("adafruit_feather_rp2350_hstx", "rp2350", "Adafruit", "Feather RP2350 HSTX", "0x239a", "0x814f", 250, "ADAFRUIT_FEATHER_RP2350_HSTX", 8, 0, "none")
|
||||
MakeBoard("adafruit_floppsy", "rp2040", "Adafruit", "Floppsy", "0x239a", "0x8151", 250, "ADAFRUIT_FLOPPSY_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
MakeBoard("adafruit_metro_rp2350", "rp2350", "Adafruit", "Metro RP2350", "0x239a", "0x814d", 250, "ADAFRUIT_METRO_RP2350", 16, 0, "none")
|
||||
MakeBoard("adafruit_fruitjam", "rp2350", "Adafruit", "Fruit Jam RP2350", "0x239a", "0x816B", 250, "ADAFRUIT_FRUITJAM_RP2350", 16, 8, "none")
|
||||
# Amken
|
||||
MakeBoard("amken_bunny", "rp2040","Amken","BunnyBoard","0x2770",["0x7303"],250,"AMKEN_BB",128,0,"boot2_w25q128jvxq_4_padded_checksum","","https://www.amken3d.com")
|
||||
MakeBoard("amken_revelop", "rp2040","Amken","Revelop","0x2770",["0x7304"],250,"AMKEN_REVELOP",32,0,"boot2_W25Q32JVxQ_4_padded_checksum","","https://www.amken3d.com")
|
||||
@@ -591,6 +598,10 @@ MakeBoard("ilabs_rpico32", "rp2040", "iLabs", "RPICO32", "0x2e8a", "0x1010", 250
|
||||
MakeBoard("challenger_2350_wifi6_ble5", "rp2350", "iLabs", "Challenger 2350 WiFi/BLE", "0x2e8a", "0x109a", 500, "CHALLENGER_2350_WIFI_BLE_RP2350", 8, 8, "none")
|
||||
MakeBoard("challenger_2350_bconnect", "rp2350", "iLabs", "Challenger 2350 BConnect", "0x2e8a", "0x109b", 500, "CHALLENGER_2350_BCONNECT_RP2350", 8, 8, "none")
|
||||
|
||||
# Makerbase
|
||||
MakeBoard("mksthr36", "rp2040", "Makerbase", "MKS THR36", "0x2e8a", "0x000a", 250, "MAKERBASE_MKSTHR36", 1, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("mksthr42", "rp2040", "Makerbase", "MKS THR42", "0x2e8a", "0x000a", 250, "MAKERBASE_MKSTHR42", 1, 0, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# Melopero
|
||||
MakeBoard("melopero_cookie_rp2040", "rp2040", "Melopero", "Cookie RP2040", "0x2e8a", "0x1011", 250, "MELOPERO_COOKIE_RP2040", 8, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("melopero_shake_rp2040", "rp2040", "Melopero", "Shake RP2040", "0x2e8a", "0x1005", 250, "MELOPERO_SHAKE_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
|
||||
@@ -611,8 +622,9 @@ MakeBoard("newsan_archi", "rp2040", "Newsan", "Archi", "0x2E8A", "0x1043", 250,
|
||||
MakeBoard("nullbits_bit_c_pro", "rp2040", "nullbits", "Bit-C PRO", "0x2e8a", "0x6e61", 500, "NULLBITS_BIT_C_PRO", 4, 0, "boot2_w25x10cl_4_padded_checksum")
|
||||
|
||||
# Olimex
|
||||
MakeBoard("olimex_rp2040pico30_2mb", "rp2040", "Olimex", "RP2040-Pico30 2MB", "0x15ba", "0x0026", 250, "OLIMEX_RP2040_PICO30_2MB", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("olimex_rp2040pico30_16mb", "rp2040", "Olimex", "RP2040-Pico30 16MB", "0x15ba", "0x0026", 250, "OLIMEX_RP2040_PICO30_16MB", 16, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("olimex_pico2xl", "rp2350", "Olimex", "Pico2XL", "0x15ba", "0x0026", 250, "OLIMEX_PICO2XL", 2, 0, "none")
|
||||
MakeBoard("olimex_pico2xxl", "rp2350", "Olimex", "Pico2XXL", "0x15ba", "0x0026", 500, "OLIMEX_PICO2XXL", 16, 8, "none")
|
||||
MakeBoard("olimex_rp2040pico30", "rp2040", "Olimex", "RP2040-Pico30", "0x15ba", "0x0026", 250, "OLIMEX_RP2040_PICO30", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
# Pimoroni
|
||||
MakeBoard("pimoroni_pga2040", "rp2040", "Pimoroni", "PGA2040", "0x2e8a", "0x1008", 250, "PIMORONI_PGA2040", 8, 0, "boot2_w25q64jv_4_padded_checksum")
|
||||
@@ -620,7 +632,8 @@ MakeBoard("pimoroni_pga2350", "rp2350", "Pimoroni", "PGA2350", "0x2e8a", "0x1018
|
||||
MakeBoard("pimoroni_pico_plus_2", "rp2350", "Pimoroni", "PicoPlus2", "0x2e8a", "0x100a", 500, "PIMORONI_PICO_PLUS_2", 16, 8, "none")
|
||||
MakeBoard("pimoroni_pico_plus_2w", "rp2350", "Pimoroni", "PicoPlus2W", "0x2e8a", "0x100a", 500, "PIMORONI_PICO_PLUS_2W", 16, 8, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
|
||||
MakeBoard("pimoroni_plasma2040", "rp2040", "Pimoroni", "Plasma2040", "0x2e8a", "0x100a", 500, "PIMORONI_PLASMA2040", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("pimoroni_plasma2350", "rp2350", "Pimoroni", "Plasma2350", "0x2e8a", "0x10a5", 500, "PIMORONI_PLASMA2040", 2, 0, "none")
|
||||
MakeBoard("pimoroni_plasma2350", "rp2350", "Pimoroni", "Plasma2350", "0x2e8a", "0x10a5", 500, "PIMORONI_PLASMA2350", 2, 0, "none")
|
||||
MakeBoard("pimoroni_servo2040", "rp2040", "Pimoroni", "Servo2040", "0x2e8a", "0x10a5", 500, "PIMORONI_SERVO2040", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("pimoroni_tiny2040", "rp2040", "Pimoroni", "Tiny2040", "0x2e8a", "0x100a", 500, "PIMORONI_TINY2040", 2, 0, "boot2_w25q64jv_4_padded_checksum")
|
||||
MakeBoard("pimoroni_tiny2350", "rp2350", "Pimoroni", "Tiny2350", "0x2e8a", "0x100b", 500, "PIMORONI_TINY2350", 4, 0, "none")
|
||||
|
||||
@@ -646,17 +659,20 @@ MakeBoard("solderparty_rp2350_stamp", "rp2350", "Solder Party", "RP2350 Stamp",
|
||||
MakeBoard("solderparty_rp2350_stamp_xl", "rp2350", "Solder Party", "RP2350 Stamp XL", "0x1209", "0xa184", 500, "SOLDERPARTY_RP2350_STAMP_XL", 16, 0, "none", None, "https://www.solder.party/docs/rp2350-stamp-xl/")
|
||||
|
||||
# SparkFun
|
||||
MakeBoard("sparkfun_iotredboard_rp2350", "rp2350", "SparkFun", "IoT RedBoard RP2350", "0x1b4f", "0x0047", 250, "SPARKFUN_IOTREDBOARD_RP2350", 16, 8, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"], "https://www.sparkfun.com/sparkfun-iot-redboard-rp2350.html")
|
||||
MakeBoard("sparkfun_micromodrp2040", "rp2040", "SparkFun", "MicroMod RP2040", "0x1b4f", "0x0026", 250, "SPARKFUN_MICROMOD_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("sparkfun_promicrorp2040", "rp2040", "SparkFun", "ProMicro RP2040", "0x1b4f", "0x0026", 250, "SPARKFUN_PROMICRO_RP2040", 16, 0, "boot2_generic_03h_4_padded_checksum")
|
||||
MakeBoard("sparkfun_promicrorp2350", "rp2350", "SparkFun", "ProMicro RP2350", "0x1b4f", "0x0026", 250, "SPARKFUN_PROMICRO_RP2350", 16, 8, "none")
|
||||
MakeBoard("sparkfun_thingplusrp2040", "rp2040", "SparkFun", "Thing Plus RP2040", "0x1b4f", "0x0026", 250, "SPARKFUN_THINGPLUS_RP2040", 16, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("sparkfun_thingplusrp2350", "rp2350", "SparkFun", "Thing Plus RP2350", "0x1b4f", "0x0038", 250, "SPARKFUN_THINGPLUS_RP2350", 16, 8, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
|
||||
MakeBoard("sparkfun_iotnode_lorawanrp2350", "rp2350", "SparkFun", "IoT Node LoRaWAN", "0x1b4f", "0x0044", 250, "SPARKFUN_IOTNODE_LORAWAN_RP2350", 16, 8, "none")
|
||||
MakeBoard("sparkfun_xrp_controller_beta", "rp2040", "SparkFun", "XRP Controller (Beta)", "0x1b4f", "0x0045", 250, "SPARKFUN_XRP_CONTROLLER_BETA", 2, 0, "boot2_w25q080_2_padded_checksum", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
|
||||
MakeBoard("sparkfun_xrp_controller", "rp2350", "SparkFun", "XRP Controller", "0x1b4f", "0x0046", 250, "SPARKFUN_XRP_CONTROLLER", 16, 8, "none", ["PICO_CYW43_SUPPORTED=1", "CYW43_PIN_WL_DYNAMIC=1"])
|
||||
|
||||
# Seeed
|
||||
MakeBoard("seeed_indicator_rp2040", "rp2040", "Seeed", "INDICATOR RP2040", "0x2886", "0x0050", 250, "SEEED_INDICATOR_RP2040", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("seeed_xiao_rp2040", "rp2040", "Seeed", "XIAO RP2040", "0x2e8a", "0x000a", 250, "SEEED_XIAO_RP2040", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
MakeBoard("seeed_xiao_rp2350", "rp2350", "Seeed", "XIAO RP2350", "0x2886", "0x0058", 250, "SEEED_XIAO_RP2350", 16, 8, "none", None, "https://www.seeedstudio.com/Seeed-XIAO-RP2350-p-5944.html")
|
||||
MakeBoard("seeed_xiao_rp2350", "rp2350", "Seeed", "XIAO RP2350", "0x2886", "0x0058", 250, "SEEED_XIAO_RP2350", 2, 0, "none", None, "https://www.seeedstudio.com/Seeed-XIAO-RP2350-p-5944.html")
|
||||
|
||||
# Upesy
|
||||
MakeBoard("upesy_rp2040_devkit", "rp2040", "uPesy", "RP2040 DevKit", "0x2e8a", "0x1007", 250, "UPESY_RP2040_DEVKIT", 2, 0, "boot2_w25q080_2_padded_checksum")
|
||||
|
||||
@@ -5,89 +5,96 @@ import sys
|
||||
import time
|
||||
import threading
|
||||
|
||||
|
||||
toolspath = os.path.dirname(os.path.realpath(__file__))
|
||||
try:
|
||||
sys.path.insert(0, os.path.join(toolspath, ".")) # Add pyserial dir to search path
|
||||
sys.path.insert(0, os.path.join(toolspath, ".")) # Add uf2conv dir to search path
|
||||
import uf2conv # If this fails, we can't continue and will bomb below
|
||||
except ImportError:
|
||||
sys.stderr.write("uf2conv not found next to this tool.\n")
|
||||
sys.exit(1)
|
||||
|
||||
scannerStop = threading.Event()
|
||||
dropDead = False
|
||||
|
||||
scannerGo = False
|
||||
class ScannerDarkly(threading.Thread):
|
||||
|
||||
loopTime = 0.0 # Set to 0 for 1st pass to get immediate response for arduino-cli, then bumped to 2.0 for ongoing checks
|
||||
|
||||
# https://stackoverflow.com/questions/12435211/threading-timer-repeat-function-every-n-seconds
|
||||
def __init__(self, event):
|
||||
threading.Thread.__init__(self)
|
||||
self.stopped = event
|
||||
|
||||
def run(self):
|
||||
global dropDead
|
||||
boards = False;
|
||||
while not self.stopped.wait(self.loopTime):
|
||||
if self.stopped.is_set() or dropDead:
|
||||
return
|
||||
self.loopTime = 2.0
|
||||
l = uf2conv.get_drives()
|
||||
if (len(l) > 0) and not boards:
|
||||
boards = True
|
||||
print ("""{
|
||||
"eventType": "add",
|
||||
"port": {
|
||||
"address": "UF2_Board",
|
||||
"label": "UF2 Board",
|
||||
"protocol": "uf2conv",
|
||||
"protocolLabel": "UF2 Devices",
|
||||
"properties": {
|
||||
"mac": "ffffffffffff",
|
||||
"pid" : "0x2e8a",
|
||||
"vid" : "0x000a"
|
||||
}
|
||||
}
|
||||
}""", flush=True)
|
||||
elif (len(l) == 0) and boards:
|
||||
boards = False
|
||||
print("""{
|
||||
"eventType": "remove",
|
||||
"port": {
|
||||
"address": "UF2_Board",
|
||||
"protocol": "uf2conv"
|
||||
}
|
||||
}""", flush = True)
|
||||
|
||||
def scanner():
|
||||
global scannerGo
|
||||
scannerGo = True
|
||||
boards = False
|
||||
while scannerGo:
|
||||
l = uf2conv.get_drives()
|
||||
if (len(l) > 0) and scannerGo and not boards:
|
||||
boards = True
|
||||
print ("""{
|
||||
"eventType": "add",
|
||||
"port": {
|
||||
"address": "UF2_Board",
|
||||
"label": "UF2 Board",
|
||||
"protocol": "uf2conv",
|
||||
"protocolLabel": "UF2 Devices",
|
||||
"properties": {
|
||||
"mac": "ffffffffffff",
|
||||
"pid" : "0x2e8a",
|
||||
"vid" : "0x000a"
|
||||
}
|
||||
}
|
||||
}""", flush=True)
|
||||
elif (len(l) == 0) and scannerGo and boards:
|
||||
boards = False
|
||||
print("""{
|
||||
"eventType": "remove",
|
||||
"port": {
|
||||
"address": "UF2_Board",
|
||||
"protocol": "uf2conv"
|
||||
}
|
||||
}""", flush = True)
|
||||
n = time.time() + 2
|
||||
while scannerGo and (time.time() < n):
|
||||
time.sleep(.1)
|
||||
scannerGo = True
|
||||
|
||||
def main():
|
||||
global scannerGo
|
||||
while True:
|
||||
cmdline = input()
|
||||
cmd = cmdline.split()[0]
|
||||
if cmd == "HELLO":
|
||||
print(""" {
|
||||
global scannerStop
|
||||
global dropDead
|
||||
try:
|
||||
while True:
|
||||
cmdline = input()
|
||||
cmd = cmdline.split()[0]
|
||||
if cmd == "HELLO":
|
||||
print(""" {
|
||||
"eventType": "hello",
|
||||
"message": "OK",
|
||||
"protocolVersion": 1
|
||||
}""", flush = True)
|
||||
elif cmd == "START":
|
||||
print("""{
|
||||
elif cmd == "START":
|
||||
print("""{
|
||||
"eventType": "start",
|
||||
"message": "OK"
|
||||
}""", flush = True);
|
||||
elif cmd == "STOP":
|
||||
scannerGo = False
|
||||
while not scannerGo:
|
||||
time.sleep(.1)
|
||||
print("""{
|
||||
elif cmd == "STOP":
|
||||
scannerStop.set()
|
||||
print("""{
|
||||
"eventType": "stop",
|
||||
"message": "OK"
|
||||
}""", flush = True)
|
||||
elif cmd == "QUIT":
|
||||
scannerGo = False
|
||||
print("""{
|
||||
elif cmd == "QUIT":
|
||||
scannerStop.set()
|
||||
print("""{
|
||||
"eventType": "quit",
|
||||
"message": "OK"
|
||||
}""", flush = True)
|
||||
return
|
||||
elif cmd == "LIST":
|
||||
l = uf2conv.get_drives()
|
||||
if len(l) > 0:
|
||||
print ("""{
|
||||
return
|
||||
elif cmd == "LIST":
|
||||
l = uf2conv.get_drives()
|
||||
if len(l) > 0:
|
||||
print ("""{
|
||||
"eventType": "list",
|
||||
"ports": [
|
||||
{
|
||||
@@ -103,18 +110,19 @@ def main():
|
||||
}
|
||||
]
|
||||
}""", flush=True)
|
||||
else:
|
||||
print ("""{
|
||||
else:
|
||||
print ("""{
|
||||
"eventType": "list",
|
||||
"ports": [ ]
|
||||
}""", flush=True)
|
||||
elif cmd == "START_SYNC":
|
||||
print("""{
|
||||
elif cmd == "START_SYNC":
|
||||
print("""{
|
||||
"eventType": "start_sync",
|
||||
"message": "OK"
|
||||
}""", flush = True)
|
||||
scannerGo = True
|
||||
threading.Thread(target = scanner).start()
|
||||
time.sleep(.5)
|
||||
thread = ScannerDarkly(scannerStop)
|
||||
thread.start()
|
||||
except:
|
||||
dropDead = True
|
||||
|
||||
main()
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#define PICO_RP2350A 1
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (7u)
|
||||
|
||||
#define PIN_NEOPIXEL (21u)
|
||||
#define NUM_NEOPIXEL (1)
|
||||
|
||||
// SD Card connector
|
||||
#define PIN_CARD_DETECT (13u)
|
||||
#define PIN_SD_CLK (14u)
|
||||
#define PIN_SD_CMD_MOSI (15u)
|
||||
#define PIN_SD_DAT0_MISO (16u)
|
||||
#define PIN_SD_DAT1 (17u)
|
||||
#define PIN_SD_DAT2 (18u)
|
||||
#define PIN_SD_DAT3_CS (19u)
|
||||
|
||||
// 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 PIN_SPI0_MISO (20u)
|
||||
#define PIN_SPI0_MOSI (23u)
|
||||
#define PIN_SPI0_SCK (22u)
|
||||
#define PIN_SPI0_SS (13u)
|
||||
#define __SPI0_DEVICE spi0
|
||||
|
||||
// SPI1 for SD card
|
||||
#define PIN_SPI1_MISO PIN_SD_DAT0_MISO
|
||||
#define PIN_SPI1_MOSI PIN_SD_CMD_MOSI
|
||||
#define PIN_SPI1_SCK PIN_SD_CLK
|
||||
#define PIN_SPI1_SS PIN_SD_DAT3_CS
|
||||
#define __SPI1_DEVICE spi1
|
||||
|
||||
// Wire
|
||||
#define __WIRE0_DEVICE i2c0
|
||||
#define PIN_WIRE0_SDA (2u)
|
||||
#define PIN_WIRE0_SCL (3u)
|
||||
|
||||
#define __WIRE1_DEVICE i2c1
|
||||
#define PIN_WIRE1_SDA (31u) // not pinned out
|
||||
#define PIN_WIRE1_SCL (31u)
|
||||
|
||||
#define SERIAL_HOWMANY (1u)
|
||||
#define SPI_HOWMANY (2u)
|
||||
#define WIRE_HOWMANY (1u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#define PICO_RP2350A 1
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (7u)
|
||||
|
||||
@@ -39,4 +41,14 @@
|
||||
#define RP2350_PSRAM_CS (8u)
|
||||
#define RP2350_PSRAM_MAX_SCK_HZ (109*1000*1000)
|
||||
|
||||
// DVI connector
|
||||
#define PIN_CKN (15u)
|
||||
#define PIN_CKP (14u)
|
||||
#define PIN_D0N (19u)
|
||||
#define PIN_D0P (18u)
|
||||
#define PIN_D1N (17u)
|
||||
#define PIN_D1P (16u)
|
||||
#define PIN_D2N (13u)
|
||||
#define PIN_D2P (12u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
#define PICO_RP2350A 0
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED (29u)
|
||||
|
||||
#define PIN_NEOPIXEL (32u)
|
||||
#define NUM_NEOPIXEL (5u)
|
||||
|
||||
// 'Boot0' button also on GPIO #0
|
||||
#define PIN_BUTTON (0u)
|
||||
#define PIN_BUTTON1 (4u)
|
||||
#define PIN_BUTTON2 (5u)
|
||||
|
||||
// USB host connector
|
||||
#define PIN_USB_HOST_DP (1u)
|
||||
#define PIN_USB_HOST_DM (2u)
|
||||
#define PIN_5V_EN (11u)
|
||||
#define PIN_5V_EN_STATE (1u)
|
||||
|
||||
// SDIO
|
||||
#define PIN_SD_DETECT (33u)
|
||||
#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)
|
||||
|
||||
// I2S
|
||||
#define PIN_I2S_DATAOUT (24u)
|
||||
#define PIN_I2S_WORDSEL (25u)
|
||||
#define PIN_I2S_BITCLK (26u)
|
||||
#define PIN_I2S_MCLK (27u)
|
||||
|
||||
#define PIN_PERIPHERAL_RESET (22u)
|
||||
|
||||
#define __PIN_A0 (40u)
|
||||
#define __PIN_A1 (41u)
|
||||
#define __PIN_A2 (42u)
|
||||
#define __PIN_A3 (43u)
|
||||
#define __PIN_A4 (44u)
|
||||
#define __PIN_A5 (45u)
|
||||
|
||||
// UARTs
|
||||
#define PIN_SERIAL1_TX (8u)
|
||||
#define PIN_SERIAL1_RX (9u)
|
||||
#define PIN_SERIAL2_TX (99u) // not pinned out
|
||||
#define PIN_SERIAL2_RX (99u)
|
||||
|
||||
// SPI
|
||||
#define __SPI1_DEVICE spi1
|
||||
#define PIN_SPI1_MISO (28u)
|
||||
#define PIN_SPI1_MOSI (31u)
|
||||
#define PIN_SPI1_SCK (30u)
|
||||
#define PIN_SPI1_SS (46u)
|
||||
|
||||
#define __SPI0_DEVICE spi0
|
||||
#define PIN_SPI0_MISO (36u)
|
||||
#define PIN_SPI0_MOSI (35u)
|
||||
#define PIN_SPI0_SCK (34u)
|
||||
#define PIN_SPI0_SS (39u)
|
||||
|
||||
// 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)
|
||||
|
||||
// DVI connector
|
||||
#define PIN_CKN (12u)
|
||||
#define PIN_CKP (13u)
|
||||
#define PIN_D0N (14u)
|
||||
#define PIN_D0P (15u)
|
||||
#define PIN_D1N (16u)
|
||||
#define PIN_D1P (17u)
|
||||
#define PIN_D2N (18u)
|
||||
#define PIN_D2P (19u)
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
|
||||
#define PICO_RP2350A 0 // RP2350B
|
||||
|
||||
// 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)
|
||||
|
||||
// DVI connector
|
||||
#define PIN_CKN (15u)
|
||||
#define PIN_CKP (14u)
|
||||
#define PIN_D0N (19u)
|
||||
#define PIN_D0P (18u)
|
||||
#define PIN_D1N (17u)
|
||||
#define PIN_D1P (16u)
|
||||
#define PIN_D2N (13u)
|
||||
#define PIN_D2P (12u)
|
||||
|
||||
|
||||
#include "../generic/common.h"
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#define PICO_RP2350A 1
|
||||
|
||||
#define PINS_COUNT (30u)
|
||||
#define NUM_DIGITAL_PINS (30u)
|
||||
#define NUM_ANALOG_INPUTS (4u)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#define PICO_RP2350A 1
|
||||
|
||||
#define PINS_COUNT (30u)
|
||||
#define NUM_DIGITAL_PINS (30u)
|
||||
#define NUM_ANALOG_INPUTS (4u)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user