Compare commits

..
38 Commits
Author SHA1 Message Date
Earle F. Philhower, III bd64b97a20 Update version 2024-08-08 11:00:00 -07:00
Earle F. Philhower, III 525408e181 Add RP2040.memcpyDMA for DMA-managed memory copies (#2324)
RP2040::memcpyDMA implements a DMA-controlled memory copy call identical in
function to standard memcpy, but using an onboard DMA engine.  For large
memory transfers this can be significantly faster than using the CPU-based
memcpy.  Only 4-byte aligned source, destination, and counts are allowed.
If any inputs are not 4-byte aligned, then standard memcpy will occur so
it will behave correctly for any inputs.
2024-08-08 10:49:33 -07:00
Earle F. Philhower, III e022d47e80 Minor BearSSL changes for 8266/upstream (#2323)
No functionality differences expected.
2024-08-08 08:44:17 -07:00
Earle F. Philhower, III 28b0edac21 Add checks for Adafruit TinyUSB to USB libs (#2319)
The included USB libraries are not compatible with Adafruit TinyUSB, so
add a #error message when they're built with the define set.
2024-08-04 10:10:08 -07:00
Dominic Pearman 4bd7d99c96 Documentation: moved 'ESP32 Compatibility' to subsection (#2311)
Lowered level of segment 'ESP32 Compatibility' in documentation of 'WiFiClientSecure Class' to be a subsection thereof.
2024-08-03 07:32:39 -07:00
Earle F. Philhower, III 06572e365b Fix minor LWIP wrapper errors (#2310)
Somehow returning the results of a `void` function from another `void`
wrapper didn't trigger any warnings.  Also missed tcp_bind actual
GCC wrapping.
2024-08-02 16:24:54 -07:00
Earle F. Philhower, III e86f8f5002 Really remove dup'd TUSB GAMEPAD16 HID descriptor (#2306) 2024-07-30 09:54:12 -07:00
Earle F. Philhower, III 4f4e638aee Replace most remaining ESP_ debug macros (#2305)
In ported libraries there were still some remaining DEBUG_ESP_PORT
references.  Moved to their RP2040 equivalents.
2024-07-28 09:36:10 -07:00
Earle F. Philhower, III 34f386a21b LwIpIntfDev.end() check _started to prevent crash (#2304)
From @JAndrassy https://github.com/esp8266/Arduino/pull/9173
2024-07-27 11:46:39 -07:00
Earle F. Philhower, III dd1c9095e8 Factor out cut-n-pasted GAMEPAD16 HID structures (#2302)
Create a single spot with the gamepad16's HID report descriptor and
report structure.  Avoids cut-n-pasted code.
2024-07-26 09:11:41 -07:00
Earle F. Philhower, III 8140c354c7 Fix HTTPClient debug output (#2300)
Found via #2296, the HTTPClient was looking for old ESP8266 defines and
not the RP2040 core ones to enable it.  Now dump on `Core` level.
2024-07-25 22:21:38 -07:00
Earle F. Philhower, III 5c4eb022c1 Rename Picoprobe upload to DebugProbe new name (#2298)
Picoprobe was rechristened Debugprobe earlier this year, add a note
in the menus to be specific about it.

See https://github.com/raspberrypi/debugprobe
2024-07-25 10:10:33 -07:00
Earle F. Philhower, III 6e5b3897b7 Fix BT/BLE Joystick reports (#2293)
Underlying HID_Joystick now always using 16-bit format axes, need to update
BT and BLE descriptors sent to the BT master or it will misinterpret the
reports and the reported joystick state will be read as garbage.

Fixes bug introduced in #2276, oops!
2024-07-23 21:11:08 -07:00
Earle F. Philhower, III f3b8c58157 Remove obsolete TRAVIS CI variables (#2292)
Use GH native ones instead.
2024-07-23 09:48:33 -07:00
Earle F. Philhower, III 6d115cdcec Update version 2024-07-22 12:51:07 -07:00
Earle F. Philhower, III 9f66e834d4 Split variant build, combine spell + style checks (#2291)
Variant builds were taking longer than the actual individual CI jobs, so
split it up.

Combine the spelling and style checks, they ran very fast and spent more
time in checking out than in running.
2024-07-22 12:46:47 -07:00
Earle F. Philhower, III 096990123d Fix timeout in WebServer::_uploadReadByte and handleClient() (#2290)
Upstream patch https://github.com/espressif/arduino-esp32/pull/9991
2024-07-22 12:21:42 -07:00
Earle F. Philhower, III ea2de469a2 FreeRTOS/Arduino header include fix (#2288)
Fixes #2287
2024-07-21 05:13:43 -07:00
deltaford 80196d570b Add Pintronix PinMax board (#2286) 2024-07-20 13:08:05 -07:00
Amken USAandH.Keni 1f71135a2b Add 4 Amken boards (#2283)
Added 4 new boards from Amken LLC.
* Amken Bunny
* Amken Revelop
* Amken Revelop Plus
* Amken Revelop eS

Co-authored-by: H.Keni <151807089+hrken1@users.noreply.github.com>
2024-07-19 14:17:53 -07:00
Earle F. Philhower, III c4e713247e Make CI use current JSON, not upstream (#2277) 2024-07-18 16:33:23 -07:00
Earle F. Philhower, III bd902a93f5 Add true 10- and 16-bit joystick modes (#2276)
Fixes #2275

Adds `Joystick.use10bit` and `Joystick.use16bit` methods.  10-bit is
unsigned from 0...1023 while 16-bit is signed -32767..32767.
Defines a new HID descriptor to support the increased resolution.
2024-07-18 16:07:29 -07:00
Heng Teng YiandHTY2003 372fef06e1 Add board EVN Alpha (#2263)
Co-authored-by: HTY2003 <randumbperson@gmail.com>
2024-07-13 11:21:04 -07:00
Earle F. Philhower, III 41ce4b2f8b Ensure makeboards.py writes UNIX newlines (#2264)
The repo and development use only '\n' (UNIX) EOLs.  When a user runs
makeboards on a Windows system they end up changing every line in boards.txt
and the JSON files to Windows '\r\n' format.

Explicitly set the newline character when opening the output files to
avoid this.
2024-07-12 17:53:34 -07:00
Earle F. Philhower, III e8a2654296 Add a build of all variants to CI (#2262)
* Add a build of all variants to CI using P.IO
* Split out into separate job, use BOOTSEL sketch
* Fix Breadstick variant
* Fix Bridgetech boards with illegal define names
  Dash(-) to underscore(_) in define and variant for the -7 and -43.
* Bridgetech JSON updates
* Temporarily remove Bridgetech boards from CI
  Needs an update to the P.IO external repo to work since the names
  of the boards have changed.
2024-07-12 15:50:03 -07:00
AcThPaU a584d10321 Fix D pin mapping on Adafruit IB/Feather RP2040 (#2259)
* Fix D pins on Adafruit IB RP2040
* Fix Adafruit Feather D pins mapping as well
* Change common.h to accept D pin def per board
2024-07-12 14:41:06 -07:00
Earle F. Philhower, III 5cdd58dfb8 Add FreeRTOS functionality tests (#2257)
FreeRTOS often seems to have interesting corner cases.  Add two simple
tests that have been useful while debugging issues found from users or
from FreeRTOS updates.
2024-07-08 18:07:28 -07:00
Earle F. Philhower, III 96a2e925cf Fix leak in HTTPSClient (#2256)
Fixes #2254

The faked certificate was allocated but not deleted in certain cases.  Make sure
to clean up in the destructor.
2024-07-08 09:21:46 -07:00
Maximilian Gerhardt 8cb8807573 Fix assembler flags (#2255)
An oversight in the order of updating the ASFLAGS with a copy of the CCFLAGS (see line 110) and then updating the CCFLAGS (without resyncing the ASFLAGS) leads to a fatal compilation error in the Adafruit PicoDVI library, in which `tmds_encode.S` fails to find the `pico/config.h` include file. This fix updates the ASFLAGS manually after changing the CCFLAGS so that they're equal again, and the library can be compiled.
2024-07-08 09:02:15 -07:00
Earle F. Philhower, III 2cde8bd789 Avoid deadlock BT/LE HID send when disconnected (#2252)
Fixes #2251

The 2-phase send could get out of whack if transmission was attempted when
no device was connected. Clear things up so if things aren't connected,
then no data gets set as pending.
2024-07-04 13:58:33 -07:00
Earle F. Philhower, III 99b32b8436 Update to latest FreeRTOS main, not SMP branch (#2250)
FreeRTOS has merged the SMP branch into its main, so move to that and
adjust the core accordingly.  V11.1.0 + several minor edits.
2024-07-03 17:31:22 -07:00
Pontus OldbergandPontus Oldberg 91240567ce Fixed incorrect AVR compatibility macros. (#2249)
* Fixed incorrect AVR compatibility macros.

---------

Co-authored-by: Pontus Oldberg <pontus.oldberg@non.se.com>
2024-07-03 08:01:20 -07:00
chungsoftvn-tuannguyenandTuan Nguyen 247e48fa85 Add board BridgeTek IDM2040-43A (#2246)
- Board information brtchip.com/product/idm2040-43a

Signed-off-by: Tuan Nguyen <tuan.nguyen@brtchip.com>
Co-authored-by: Tuan Nguyen <tuan.nguyen@brtchip.com>
2024-06-27 11:30:53 -07:00
Earle F. Philhower, III 268d0aa1c5 On Timer::once execution, delete the alarm_id (#2245)
A Timer is not active after the alarm fires once, so clear the
alarm ID so we know we're not running.
2024-06-24 16:07:19 -07:00
Earle F. Philhower, III 553f7604ea Add ESP32-compatible Ticker library (#2244)
Uses the Pico SDK alarms and repeated-timers to provide for IRQ-level
periodic tasks to be scheduled.
2024-06-24 14:47:46 -07:00
Earle F. Philhower, III 1357e4a37b Receive GATT characteristic updates in BTStackLib (#2241)
Fixes #2231
2024-06-24 08:48:07 -07:00
Earle F. Philhower, III fdc361aff9 Remove old ESP8266 files from AsyncUDP (#2238) 2024-06-19 15:51:34 -07:00
Earle F. Philhower, III 7df8c35e81 Use built-in LWIP call to determine NetBIOS IP (#2235)
Instead of manually iterating over netifs to find the one a packet came
in over for NetBIOS name lookup, use a built-in LWIP macro that's
available for udp_recv callbacks.  Shrinks and simplifies NetBIOS code.
2024-06-18 13:42:23 -07:00
106 changed files with 5524 additions and 567 deletions
+61 -21
View File
@@ -6,35 +6,23 @@ name: Arduino-Pico CI
on:
pull_request:
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
jobs:
# Me no spell so good
code-spell:
name: Check spelling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Run codespell
uses: codespell-project/actions-codespell@master
with:
skip: ./ArduinoCore-API,./libraries/ESP8266SdFat,./libraries/Adafruit_TinyUSB_Arduino,./libraries/LittleFS/lib,./tools/pyserial,./pico-sdk,./.github,./docs/i2s.rst,./cores/rp2040/api,./libraries/FreeRTOS,./tools/libbearssl/bearssl,./include,./libraries/WiFi/examples/BearSSL_Server,./ota/uzlib,./libraries/http-parser/lib,./libraries/WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino,./libraries/HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino,./.git,./libraries/FatFS/lib/fatfs,./libraries/FatFS/src/diskio.h,./libraries/FatFS/src/ff.cpp,./libraries/FatFS/src/ffconf.h,./libraries/FatFS/src/ffsystem.cpp,./libraries/FatFS/src/ff.h,./libraries/lwIP_WINC1500/src/driver,./libraries/lwIP_WINC1500/src/common,./libraries/lwIP_WINC1500/src/bus_wrapper,./libraries/lwIP_WINC1500/src/spi_flash
ignore_words_list: ser,dout,shiftIn,acount
# Consistent style
# Consistent style, spelling
astyle:
name: Style, Boards, Package
name: Spelling, Style, Boards, Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Run codespell
uses: codespell-project/actions-codespell@master
with:
skip: ./ArduinoCore-API,./libraries/ESP8266SdFat,./libraries/Adafruit_TinyUSB_Arduino,./libraries/LittleFS/lib,./tools/pyserial,./pico-sdk,./.github,./docs/i2s.rst,./cores/rp2040/api,./libraries/FreeRTOS,./tools/libbearssl/bearssl,./include,./libraries/WiFi/examples/BearSSL_Server,./ota/uzlib,./libraries/http-parser/lib,./libraries/WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino,./libraries/HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino,./.git,./libraries/FatFS/lib/fatfs,./libraries/FatFS/src/diskio.h,./libraries/FatFS/src/ff.cpp,./libraries/FatFS/src/ffconf.h,./libraries/FatFS/src/ffsystem.cpp,./libraries/FatFS/src/ff.h,./libraries/lwIP_WINC1500/src/driver,./libraries/lwIP_WINC1500/src/common,./libraries/lwIP_WINC1500/src/bus_wrapper,./libraries/lwIP_WINC1500/src/spi_flash
ignore_words_list: ser,dout,shiftIn,acount
- name: Get submodules for following tests
run: git submodule update --init
- name: Check package references
run: |
./tests/ci/pkgrefs_test.sh
@@ -223,3 +211,55 @@ jobs:
run: pio ci --board=rpipicow -O "platform_packages=framework-arduinopico@symlink:///home/runner/work/arduino-pico/arduino-pico" libraries/ArduinoOTA/examples/SignedOTA/SignedOTA.ino
- name: Build Bluetooth Example
run: pio ci --board=rpipicow -O "platform_packages=framework-arduinopico@symlink:///home/runner/work/arduino-pico/arduino-pico" -O "build_flags=-DPIO_FRAMEWORK_ARDUINO_ENABLE_BLUETOOTH" libraries/MouseBLE/examples/BLECircle/BLECircle.ino
# Build every variant using PIO for simplicity
build-variants:
name: Build Every Variant ${{ matrix.chunk }}
runs-on: ubuntu-latest
strategy:
matrix:
chunk: [0, 1]
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Initialize needed submodules
run: |
cd pico-sdk
git submodule update --init
cd ../libraries/Adafruit_TinyUSB_Arduino
git submodule update --init
cd ../..
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pio pkg install --global --platform https://github.com/maxgerhardt/platform-raspberrypi.git
pio pkg install --global --tool symlink://.
cp -f /home/runner/work/arduino-pico/arduino-pico/tools/json/*.json /home/runner/.platformio/platforms/raspberrypi/boards/.
- name: Build Every Variant
run: |
cnt=0
for b in $(cut -f1 -d. /home/runner/work/arduino-pico/arduino-pico/boards.txt | sed 's/#.*//' | sed 's/^menu$//' | sort -u); do
cnt=$((cnt + 1))
rem=$((cnt % 2))
if [ $rem == ${{ matrix.chunk }} ]; then
pio ci --board=$b -O "platform_packages=framework-arduinopico@symlink:///home/runner/work/arduino-pico/arduino-pico" libraries/rp2040/examples/Bootsel/Bootsel.ino
fi
done
-1
View File
@@ -33,7 +33,6 @@ jobs:
# pip install --upgrade platformio
- name: Deploy updated JSON
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
BUILD_TYPE: package
CI_GITHUB_API_KEY: ${{ secrets.GITHUB_TOKEN }}
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}
@@ -24,7 +24,6 @@ jobs:
python-version: '3.x'
- name: Build package JSON
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
BUILD_TYPE: package
CI_GITHUB_API_KEY: ${{ secrets.GITHUB_TOKEN }}
run: |
+7
View File
@@ -25,10 +25,15 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* Adafruit QTPy RP2040
* Adafruit STEMMA Friend RP2040
* Adafruit Trinkey RP2040 QT
* Amken Bunny
* Amken Revelop
* Amken Revelop Plus
* Amken Revelop eS
* Arduino Nano RP2040 Connect
* ArtronShop RP2 Nano
* Breadstick Raspberry
* BridgeTek IDM2040-7A
* BridgeTek IDM2040-43A
* Cytron Maker Pi RP2040
* Cytron Maker Nano RP2040
* Cytron Maker Uno RP2040
@@ -37,6 +42,7 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* DeRuiLab FlyBoard2040 Core
* DFRobot Beetle RP2040
* ElectronicCats Hunter Cat NFC
* EVN Alpha
* ExtremeElectronics RC2040
* GroundStudio Marble Pico
* Invector Labs Challenger RP2040 WiFi
@@ -59,6 +65,7 @@ Read the [Contributing Guide](https://github.com/earlephilhower/arduino-pico/blo
* Pimoroni PGA2040
* Pimoroni Plasma2040
* Pimoroni Tiny2040
* Pintronix PinMax
* RAKwireless RAK11300
* Redscorp RP2040-Eins
* Redscorp RP2040-ProMini
+3352 -353
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,23 @@
// Padded and checksummed version of: generated\Winbond\W25Q32JVxQ\boot2.bin
.cpu cortex-m0plus
.thumb
.section .boot2, "ax"
.byte 0xf7, 0xb5, 0x73, 0x46, 0x21, 0x22, 0x02, 0x25, 0x01, 0x93, 0x29, 0x4b, 0xc0, 0x24, 0x5a, 0x60
.byte 0x9a, 0x68, 0x01, 0x26, 0xaa, 0x43, 0xda, 0x60, 0x9a, 0x60, 0x1a, 0x61, 0x5a, 0x61, 0x00, 0x23
.byte 0x64, 0x05, 0xa3, 0x60, 0x04, 0x33, 0x63, 0x61, 0x22, 0x4b, 0x28, 0x00, 0x1e, 0x60, 0xe0, 0x23
.byte 0xdb, 0x02, 0x23, 0x60, 0x35, 0x23, 0xa6, 0x60, 0x23, 0x66, 0x23, 0x66, 0x00, 0xf0, 0x4a, 0xf8
.byte 0xc0, 0xb2, 0xa8, 0x42, 0x12, 0xd0, 0x06, 0x23, 0x30, 0x00, 0x23, 0x66, 0x00, 0xf0, 0x42, 0xf8
.byte 0x31, 0x23, 0x28, 0x00, 0x23, 0x66, 0x25, 0x66, 0x00, 0xf0, 0x3c, 0xf8, 0x03, 0x35, 0x25, 0x66
.byte 0x02, 0x20, 0x25, 0x66, 0x00, 0xf0, 0x36, 0xf8, 0x30, 0x42, 0xf8, 0xd1, 0x00, 0x25, 0x12, 0x4b
.byte 0xa5, 0x60, 0x12, 0x4f, 0x23, 0x60, 0x12, 0x4b, 0x65, 0x60, 0x01, 0x26, 0x3b, 0x60, 0xeb, 0x23
.byte 0xa6, 0x60, 0x23, 0x66, 0x4b, 0x3b, 0x23, 0x66, 0x02, 0x20, 0x00, 0xf0, 0x23, 0xf8, 0x0d, 0x4b
.byte 0xa5, 0x60, 0x3b, 0x60, 0xa6, 0x60, 0x01, 0x9b, 0xab, 0x42, 0x08, 0xd1, 0x0a, 0x4b, 0x0b, 0x4a
.byte 0x13, 0x60, 0x1b, 0x68, 0x83, 0xf3, 0x08, 0x88, 0x09, 0x4b, 0x1b, 0x68, 0x18, 0x47, 0xf7, 0xbd
.byte 0x00, 0x00, 0x02, 0x40, 0xf0, 0x00, 0x00, 0x18, 0x00, 0x03, 0x5f, 0x00, 0xf4, 0x00, 0x00, 0x18
.byte 0x21, 0x22, 0x00, 0x00, 0x22, 0x20, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x10, 0x08, 0xed, 0x00, 0xe0
.byte 0x04, 0x01, 0x00, 0x10, 0xc0, 0x23, 0x02, 0x00, 0x04, 0x21, 0x5b, 0x05, 0x98, 0x6a, 0x08, 0x42
.byte 0xfc, 0xd0, 0x01, 0x21, 0x98, 0x6a, 0x08, 0x42, 0xfc, 0xd1, 0x18, 0x6e, 0x01, 0x2a, 0x00, 0xd0
.byte 0x18, 0x6e, 0x70, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x2d, 0x68, 0xca
+3 -3
View File
@@ -65,9 +65,9 @@ void noInterrupts();
#define digitalPinToTimer(pin) (0)
#define digitalPinToInterrupt(pin) (pin)
#define NOT_AN_INTERRUPT (-1)
#define portOutputRegister(port) ((volatile uint32_t*) sio_hw->gpio_out)
#define portInputRegister(port) ((volatile uint32_t*) sio_hw->gpio_in)
#define portModeRegister(port) ((volatile uint32_t*) sio_hw->gpio_oe)
#define portOutputRegister(port) ((volatile uint32_t *)&(sio_hw->gpio_out))
#define portInputRegister(port) ((volatile uint32_t *)&(sio_hw->gpio_in))
#define portModeRegister(port) ((volatile uint32_t *)&(sio_hw->gpio_oe))
#define digitalWriteFast(pin, val) (val ? sio_hw->gpio_set = (1 << pin) : sio_hw->gpio_clr = (1 << pin))
#define digitalReadFast(pin) ((1 << pin) & sio_hw->gpio_in)
#define sei() interrupts()
+32
View File
@@ -27,6 +27,7 @@
#include <hardware/structs/rosc.h>
#include <hardware/structs/systick.h>
#include <pico/multicore.h>
#include <hardware/dma.h>
#include <pico/rand.h>
#include <pico/util/queue.h>
#include <pico/bootrom.h>
@@ -311,6 +312,36 @@ public:
return id;
}
#pragma GCC push_options
#pragma GCC optimize ("Os")
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) {
memcpyDMAChannel = dma_claim_unused_channel(true);
dma_channel_config c = dma_channel_get_default_config(memcpyDMAChannel);
channel_config_set_transfer_data_size(&c, DMA_SIZE_32);
channel_config_set_read_increment(&c, true);
channel_config_set_write_increment(&c, true);
channel_config_set_irq_quiet(&c, true);
dma_channel_set_config(memcpyDMAChannel, &c, false);
}
// If there's any misalignment or too small, use regular memcpy which can handle it
if ((n < 64) || (((uint32_t)dest) | ((uint32_t)src) | n) & 3) {
return memcpy(dest, src, n);
}
int words = n / 4;
dma_channel_set_read_addr(memcpyDMAChannel, src, false);
dma_channel_set_write_addr(memcpyDMAChannel, dest, false);
dma_channel_set_trans_count(memcpyDMAChannel, words, false);
dma_channel_start(memcpyDMAChannel);
while (dma_channel_is_busy(memcpyDMAChannel)) {
/* busy wait dma */
}
return dest;
}
#pragma GCC pop_options
// Multicore comms FIFO
_MFIFO fifo;
@@ -336,4 +367,5 @@ private:
PIO _pio;
int _sm;
PIOProgram *_ccountPgm;
int memcpyDMAChannel = -1;
};
+3 -2
View File
@@ -36,6 +36,7 @@
#include <hardware/watchdog.h>
#include <pico/bootrom.h>
#include "sdkoverride/tusb_absmouse.h"
#include "sdkoverride/tusb_gamepad16.h"
#include <device/usbd_pvt.h>
// Big, global USB mutex, shared with all USB devices to make sure we don't
@@ -159,7 +160,7 @@ void __SetupDescHIDReport() {
//allocate memory for the HID report descriptors. We don't use them, but need the size here.
uint8_t desc_hid_report_mouse[] = { TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(1)) };
uint8_t desc_hid_report_absmouse[] = { TUD_HID_REPORT_DESC_ABSMOUSE(HID_REPORT_ID(1)) };
uint8_t desc_hid_report_joystick[] = { TUD_HID_REPORT_DESC_GAMEPAD(HID_REPORT_ID(1)) };
uint8_t desc_hid_report_joystick[] = { TUD_HID_REPORT_DESC_GAMEPAD16(HID_REPORT_ID(1)) };
uint8_t desc_hid_report_keyboard[] = { TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(1)), TUD_HID_REPORT_DESC_CONSUMER(HID_REPORT_ID(2)) };
int size = 0;
@@ -229,7 +230,7 @@ void __SetupDescHIDReport() {
reportid++;
offset += sizeof(desc_hid_report_absmouse);
}
uint8_t desc_local[] = { TUD_HID_REPORT_DESC_GAMEPAD(HID_REPORT_ID(reportid)) };
uint8_t desc_local[] = { TUD_HID_REPORT_DESC_GAMEPAD16(HID_REPORT_ID(reportid)) };
memcpy(__hid_report + offset, desc_local, sizeof(desc_local));
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
#pragma once
#define ARDUINO_PICO_MAJOR 3
#define ARDUINO_PICO_MINOR 9
#define ARDUINO_PICO_REVISION 3
#define ARDUINO_PICO_VERSION_STR "3.9.3"
#define ARDUINO_PICO_REVISION 5
#define ARDUINO_PICO_VERSION_STR "3.9.5"
-2
View File
@@ -31,12 +31,10 @@ extern bool __isFreeRTOS;
extern volatile bool __freeRTOSinitted;
extern "C" {
#ifndef INC_FREERTOS_H
struct QueueDefinition; /* Using old naming convention so as not to break kernel aware debuggers. */
typedef struct QueueDefinition * QueueHandle_t;
typedef QueueHandle_t SemaphoreHandle_t;
typedef int32_t BaseType_t;
#endif
extern bool __freertos_check_if_in_isr() __attribute__((weak));
+3 -3
View File
@@ -247,19 +247,19 @@ extern "C" {
extern void __real_tcp_setprio(struct tcp_pcb *pcb, u8_t prio);
void __wrap_tcp_setprio(struct tcp_pcb *pcb, u8_t prio) {
LWIPMutex m;
return __real_tcp_setprio(pcb, prio);
__real_tcp_setprio(pcb, prio);
}
extern void __real_tcp_backlog_delayed(struct tcp_pcb* pcb);
void __wrap_tcp_backlog_delayed(struct tcp_pcb* pcb) {
LWIPMutex m;
return __real_tcp_backlog_delayed(pcb);
__real_tcp_backlog_delayed(pcb);
}
extern void __real_tcp_backlog_accepted(struct tcp_pcb* pcb);
void __wrap_tcp_backlog_accepted(struct tcp_pcb* pcb) {
LWIPMutex m;
return __real_tcp_backlog_accepted(pcb);
__real_tcp_backlog_accepted(pcb);
}
extern struct udp_pcb *__real_udp_new(void);
struct udp_pcb *__wrap_udp_new(void) {
+75
View File
@@ -0,0 +1,75 @@
/*
16-bit axis gamepad definition
Copyright (c) 2024 Earle F. Philhower, III <earlephilhower@yahoo.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include "tusb.h"
#include "class/hid/hid_device.h"
#define TUD_HID_REPORT_DESC_GAMEPAD16(...) \
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_GAMEPAD ) ,\
HID_COLLECTION ( HID_COLLECTION_APPLICATION ) ,\
/* Report ID if any */\
__VA_ARGS__ \
/* 16 bit X, Y, Z, Rz, Rx, Ry (min -32767, max 32767 ) */ \
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_X ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_Y ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_Z ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_RZ ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_RX ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_RY ) ,\
HID_LOGICAL_MIN_N ( -32767, 2 ) ,\
HID_LOGICAL_MAX_N ( 32767, 2 ) ,\
HID_REPORT_COUNT ( 6 ) ,\
HID_REPORT_SIZE ( 16 ) ,\
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
/* 8 bit DPad/Hat Button Map */ \
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ) ,\
HID_USAGE ( HID_USAGE_DESKTOP_HAT_SWITCH ) ,\
HID_LOGICAL_MIN ( 1 ) ,\
HID_LOGICAL_MAX ( 8 ) ,\
HID_PHYSICAL_MIN ( 0 ) ,\
HID_PHYSICAL_MAX_N ( 315, 2 ) ,\
HID_REPORT_COUNT ( 1 ) ,\
HID_REPORT_SIZE ( 8 ) ,\
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
/* 32 bit Button Map */ \
HID_USAGE_PAGE ( HID_USAGE_PAGE_BUTTON ) ,\
HID_USAGE_MIN ( 1 ) ,\
HID_USAGE_MAX ( 32 ) ,\
HID_LOGICAL_MIN ( 0 ) ,\
HID_LOGICAL_MAX ( 1 ) ,\
HID_REPORT_COUNT ( 32 ) ,\
HID_REPORT_SIZE ( 1 ) ,\
HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ) ,\
HID_COLLECTION_END \
// HID Gamepad Protocol Report.
typedef struct TU_ATTR_PACKED {
int16_t x; ///< Delta x movement of left analog-stick
int16_t y; ///< Delta y movement of left analog-stick
int16_t z; ///< Delta z movement of right analog-joystick
int16_t rz; ///< Delta Rz movement of right analog-joystick
int16_t rx; ///< Delta Rx movement of analog left trigger
int16_t ry; ///< Delta Ry movement of analog right trigger
uint8_t hat; ///< Buttons mask for currently pressed buttons in the DPad/hat
uint32_t buttons; ///< Buttons mask for currently pressed buttons
} hid_gamepad16_report_t;
+1 -1
View File
@@ -120,7 +120,7 @@ Valid values for min and max are `BR_TLS10`, `BR_TLS11`, `BR_TLS12`. Min and ma
ESP32 Compatibility
===================
~~~~~~~~~~~~~~~~~~~
Simple ESP32 ``WiFiClientSecure`` compatibility is built-in, allow for some sketches to run without any modification.
The following methods are implemented:
+2 -2
View File
@@ -54,9 +54,9 @@ author = u'Earle F. Philhower, III'
# built documents.
#
# The short X.Y version.
version = u'3.9.3'
version = u'3.9.5'
# The full version, including alpha/beta/rc tags.
release = u'3.9.3'
release = u'3.9.5'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
+10
View File
@@ -99,3 +99,13 @@ bootloader.
void rp2040.rebootToBootloader()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Will reboot the RP2040 into USB UF2 upload mode.
DMA-based MEMCPY
----------------
The onboard DMA engines can copy 4-byte aligned quantities faster than the CPU.
void \*rp2040.memcpyDMA(void \*dest, const void \*src, size_t count);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Uses a DMA engine to transfer data from src to dest in 4-byte chunks without CPU
intervention. If any arguments are not 4-byte aligned, or if the count is not a
multiple of 4, then it will fall back to CPU-managed memcpy.
+1 -1
View File
@@ -1,2 +1,2 @@
// Do not edit -- Automatically generated by tools/sdk/ssl/bearssl/Makefile
#define BEARSSL_GIT f294aa0
#define BEARSSL_GIT 5166f2b
BIN
View File
Binary file not shown.
+1
View File
@@ -166,6 +166,7 @@
-Wl,--wrap=tcp_arg
-Wl,--wrap=tcp_new
-Wl,--wrap=tcp_bind
-Wl,--wrap=tcp_listen
-Wl,--wrap=tcp_listen_with_backlog
-Wl,--wrap=tcp_accept
+8 -9
View File
@@ -22,23 +22,22 @@
#include <functional>
#include <WiFiUdp.h>
#include "ArduinoOTA.h"
#include "MD5Builder.h"
#include <MD5Builder.h>
#include <PicoOTA.h>
#include <StreamString.h>
#include "lwip/udp.h"
#include "include/UdpContext.h"
#include <lwip/udp.h>
#include <include/UdpContext.h>
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
#include <LEAmDNS.h>
#endif
//#ifdef DEBUG_ESP_OTA
//#ifdef DEBUG_ESP_PORT
//#define OTA_DEBUG DEBUG_ESP_PORT
//#endif
//#endif
#define OTA_DEBUG Serial
#ifdef DEBUG_RP2040_CORE
#ifdef DEBUG_RP2040_PORT
#define OTA_DEBUG DEBUG_RP2040_PORT
#endif
#endif
ArduinoOTAClass::ArduinoOTAClass() {
}
+6
View File
@@ -526,6 +526,10 @@ const gatt_client_characteristic_t * BLECharacteristic::getCharacteristic(void)
return &characteristic;
}
gatt_client_notification_t *BLECharacteristic::getNotifier() {
return &notify;
}
BLEService::BLEService(void) {
}
@@ -703,6 +707,7 @@ int BTstackManager::writeCharacteristicWithoutResponse(BLEDevice * device, BLEC
}
int BTstackManager::subscribeForNotifications(BLEDevice * device, BLECharacteristic * characteristic) {
gattAction = gattActionSubscribe;
gatt_client_listen_for_characteristic_value_updates(characteristic->getNotifier(), gatt_client_callback, device->getHandle(), (gatt_client_characteristic_t*) characteristic->getCharacteristic());
return gatt_client_write_client_characteristic_configuration(gatt_client_callback, device->getHandle(), (gatt_client_characteristic_t*) characteristic->getCharacteristic(),
GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION);
}
@@ -713,6 +718,7 @@ int BTstackManager::subscribeForIndications(BLEDevice * device, BLECharacteristi
}
int BTstackManager::unsubscribeFromNotifications(BLEDevice * device, BLECharacteristic * characteristic) {
gattAction = gattActionUnsubscribe;
gatt_client_stop_listening_for_characteristic_value_updates(characteristic->getNotifier());
return gatt_client_write_client_characteristic_configuration(gatt_client_callback, device->getHandle(), (gatt_client_characteristic_t*) characteristic->getCharacteristic(),
GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NONE);
}
+2
View File
@@ -84,6 +84,7 @@ extern "C" {
class BLECharacteristic {
private:
gatt_client_notification_t notify;
gatt_client_characteristic_t characteristic;
UUID uuid;
public:
@@ -93,6 +94,7 @@ extern "C" {
bool matches(UUID * uuid);
bool isValueHandle(uint16_t value_handle);
const gatt_client_characteristic_t * getCharacteristic();
gatt_client_notification_t *getNotifier();
};
class BLEService {
+2 -2
View File
@@ -24,8 +24,8 @@
#include <lwip/def.h>
#include <Arduino.h>
#ifdef DEBUG_ESP_PORT
#define CONSOLE DEBUG_ESP_PORT
#ifdef DEBUG_RP2040_PORT
#define CONSOLE DEBUG_RP2040_PORT
#else
#define CONSOLE Serial
#endif
+4
View File
@@ -19,6 +19,10 @@
#pragma once
#ifdef USE_TINYUSB
#error FatFSUSB is not compatible with Adafruit TinyUSB
#endif
#include <Arduino.h>
class FatFSUSBClass {
+15 -6
View File
@@ -1,10 +1,10 @@
#define configNUM_CORES 2
#define configUSE_CORE_AFFINITY 1
#define configRUN_MULTIPLE_PRIORITIES 1
#define configNUMBER_OF_CORES 2
#define configUSE_CORE_AFFINITY 1
#define configRUN_MULTIPLE_PRIORITIES 1
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_MINIMAL_IDLE_HOOK 1
#define configUSE_PASSIVE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( ( unsigned long ) F_CPU )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
@@ -38,7 +38,7 @@ extern unsigned long ulMainGetRunTimeCounterValue(void);
#define portGET_RUN_TIME_COUNTER_VALUE() ulMainGetRunTimeCounterValue()
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 1
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
@@ -99,7 +99,14 @@ extern unsigned long ulMainGetRunTimeCounterValue(void);
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
extern void rtosFatalError(void);
#ifdef __cplusplus
extern "C" {
#endif
void rtosFatalError(void);
#ifdef __cplusplus
};
#endif
#define configASSERT( x ) \
if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); rtosFatalError(); }
@@ -107,4 +114,6 @@ extern void rtosFatalError(void);
#define configSUPPORT_PICO_SYNC_INTEROP 1
#define configSUPPORT_PICO_TIME_INTEROP 1
#define LIB_PICO_MULTICORE 1
#include "rp2040_config.h"
@@ -1 +0,0 @@
#include "../lib/FreeRTOS-Kernel/portable/ThirdParty/GCC/RP2040/idle_task_static_memory.c"
+2 -2
View File
@@ -1,6 +1,6 @@
#include "../lib/FreeRTOS-Kernel/tasks.c"
//See https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/496
// See https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/496
struct _reent* __wrap___getreent(void) {
// No lock needed because if this changes, we won't be running anymore.
TCB_t *pxCurTask = xTaskGetCurrentTaskHandle();
@@ -9,6 +9,6 @@ struct _reent* __wrap___getreent(void) {
return _GLOBAL_REENT;
} else {
// We have a task; return its reentrant struct.
return &pxCurTask->xNewLib_reent;
return &pxCurTask->xTLSBlock;
}
}
+23 -7
View File
@@ -258,7 +258,7 @@ void vApplicationIdleHook(void) {
#endif /* configUSE_IDLE_HOOK == 1 */
/*-----------------------------------------------------------*/
#if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
//#if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
/*
Call the user defined minimalIdle() function from within the idle task.
This allows the application designer to add background functionality
@@ -267,17 +267,17 @@ void vApplicationIdleHook(void) {
NOTE: vApplicationMinimalIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES, CALL A FUNCTION THAT MIGHT BLOCK.
*/
void minimalIdle(void) __attribute__((weak));
void minimalIdle() {} //Empty minimalIdle function
void passiveIdle(void) __attribute__((weak));
void passiveIdle() {} //Empty minimalIdle function
extern "C"
void vApplicationMinimalIdleHook(void) __attribute__((weak));
//void vApplicationPassiveIdleHook(void) __attribute__((weak));
void vApplicationMinimalIdleHook(void) {
minimalIdle();
void vApplicationPassiveIdleHook(void) {
passiveIdle();
}
#endif /* configUSE_MINIMAL_IDLE_HOOK == 1 */
//#endif /* configUSE_MINIMAL_IDLE_HOOK == 1 */
/*-----------------------------------------------------------*/
#if ( configUSE_TICK_HOOK == 1 )
@@ -394,6 +394,22 @@ void vApplicationStackOverflowHook(TaskHandle_t xTask __attribute__((unused)),
#endif /* configCHECK_FOR_STACK_OVERFLOW >= 1 */
/*-----------------------------------------------------------*/
extern "C" void vApplicationGetPassiveIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer,
StackType_t ** ppxIdleTaskStackBuffer,
configSTACK_DEPTH_TYPE * puxIdleTaskStackSize,
BaseType_t xPassiveIdleTaskIndex) {
static StaticTask_t xIdleTaskTCBs[ configNUMBER_OF_CORES ];
static StackType_t uxIdleTaskStacks[ configNUMBER_OF_CORES ][ configMINIMAL_STACK_SIZE ];
*ppxIdleTaskTCBBuffer = &(xIdleTaskTCBs[ xPassiveIdleTaskIndex ]);
*ppxIdleTaskStackBuffer = &(uxIdleTaskStacks[ xPassiveIdleTaskIndex ][ 0 ]);
*puxIdleTaskStackSize = configMINIMAL_STACK_SIZE;
}
#if ( configSUPPORT_STATIC_ALLOCATION >= 1 )
extern "C"
+1
View File
@@ -0,0 +1 @@
This folder contains FreeRTOS functionality tests, not generally useful for users.
@@ -0,0 +1,32 @@
// Simple stress test to ensure each thread has its own Newlib reent structure
// The random numbers from each task should be identical.
#include <FreeRTOS.h>
#include <task.h>
void go(void *param) {
(void) param;
srand(0);
int i = 0;
while(1) {
char buff[100];
TaskStatus_t st;
vTaskGetInfo(NULL, &st, pdFALSE, eInvalid);
sprintf(buff, "task %ld: %d = %d\n", st.xTaskNumber, i++, rand());
Serial.print(buff);
delay(1000);
}
}
void setup() {
delay(5000);
// put your setup code here, to run once:
xTaskCreate(go, "c1", 1024, nullptr, 1, nullptr);
xTaskCreate(go, "c2", 1024, nullptr, 1, nullptr);
xTaskCreate(go, "c3", 1024, nullptr, 1, nullptr);
}
void loop() {
// put your main code here, to run repeatedly:
}
@@ -0,0 +1,319 @@
// FreeRTOS system call/mutex stress test
#include <Arduino.h>
#include <FreeRTOS.h>
#include <task.h>
#include <semphr.h>
#define DELAY 1
#define SERIAL_DEBUG Serial1
#define STACK_SIZE 512
#define CORE_0 (1 << 0)
#define CORE_1 (1 << 1)
void semphrTakeConditional(bool useMutexOn, SemaphoreHandle_t xSemaphore);
void semphrGiveConditional(bool useMutexOn, SemaphoreHandle_t xSemaphore);
/*
I want to keep the possibility of using different and independent
mutexes for each of the functions that operate on the heap.
If you want to enable the use of these mutexes remove the defines
on lines 30 and 31 and enable the their initialization in setup()
*/
SemaphoreHandle_t xSemaphoreMalloc = NULL;
// SemaphoreHandle_t xSemaphoreRealloc = NULL;
// SemaphoreHandle_t xSemaphoreFree = NULL;
/*
A lazy way to use the same mutex for malloc, realloc and free
in order to bring us back to the same situation as the MCVE
posted here: https://github.com/earlephilhower/arduino-pico/issues/795#issuecomment-1227122082
*/
#define xSemaphoreRealloc xSemaphoreMalloc
#define xSemaphoreFree xSemaphoreMalloc
const bool useMutexOnMalloc = false;
const bool useMutexOnRealloc = false;
const bool useMutexOnFree = false;
/*
Enabling this, a realloc will be performed and the string "_realloc"
will be concateneted to *tmp
*/
const bool tryRealloc = true;
TaskHandle_t loop2Handle = NULL;
TaskHandle_t loop3Handle = NULL;
TaskHandle_t loop4Handle = NULL;
TaskHandle_t loop5Handle = NULL;
TaskHandle_t loop6Handle = NULL;
TaskHandle_t loop7Handle = NULL;
void loop2(void *pvPramaters);
void loop3(void *pvPramaters);
void loop4(void *pvPramaters);
void loop5(void *pvPramaters);
void loop6(void *pvPramaters);
void loop7(void *pvPramaters);
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
xSemaphoreMalloc = xSemaphoreCreateMutex();
// xSemaphoreRealloc = xSemaphoreCreateMutex();
// xSemaphoreFree = xSemaphoreCreateMutex();
xTaskCreate(loop2, "loop2", STACK_SIZE, NULL, 1, &loop2Handle);
vTaskCoreAffinitySet(loop2Handle, CORE_0);
xTaskCreate(loop3, "loop3", STACK_SIZE, NULL, 1, &loop3Handle);
vTaskCoreAffinitySet(loop3Handle, CORE_1);
xTaskCreate(loop4, "loop4", STACK_SIZE, NULL, 1, &loop4Handle);
vTaskCoreAffinitySet(loop4Handle, CORE_0);
xTaskCreate(loop5, "loop5", STACK_SIZE, NULL, 1, &loop5Handle);
vTaskCoreAffinitySet(loop5Handle, CORE_1);
xTaskCreate(loop6, "loop6", STACK_SIZE, NULL, 1, &loop6Handle);
vTaskCoreAffinitySet(loop6Handle, CORE_0);
xTaskCreate(loop7, "loop7", STACK_SIZE, NULL, 1, &loop7Handle);
vTaskCoreAffinitySet(loop7Handle, CORE_1);
}
static int _loop[8];
void loop()
{
while (1)
{
_loop[0]++;
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
for (int i=0; i<8; i++) Serial.printf("%d ", _loop[i]);
Serial.println("");
}
}
void loop1()
{
while (1)
{
_loop[1]++;
char *tmp;
semphrTakeConditional(useMutexOnMalloc, xSemaphoreMalloc);
tmp = (char *)malloc(10 * sizeof(char));
semphrGiveConditional(useMutexOnMalloc, xSemaphoreMalloc);
strcpy(tmp, "foo");
if (tryRealloc)
{
semphrTakeConditional(useMutexOnRealloc, xSemaphoreRealloc);
tmp = (char *)realloc(tmp, 20 * sizeof(char));
semphrGiveConditional(useMutexOnRealloc, xSemaphoreRealloc);
strcat(tmp, "_realloc");
}
semphrTakeConditional(useMutexOnFree, xSemaphoreFree);
free(tmp);
semphrGiveConditional(useMutexOnFree, xSemaphoreFree);
delay(DELAY);
}
}
void loop2(void *pvPramaters)
{
(void) pvPramaters;
while (1)
{
_loop[2]++;
char *tmp;
semphrTakeConditional(useMutexOnMalloc, xSemaphoreMalloc);
tmp = (char *)malloc(10 * sizeof(char));
semphrGiveConditional(useMutexOnMalloc, xSemaphoreMalloc);
strcpy(tmp, "bar");
if (tryRealloc)
{
semphrTakeConditional(useMutexOnRealloc, xSemaphoreRealloc);
tmp = (char *)realloc(tmp, 20 * sizeof(char));
semphrGiveConditional(useMutexOnRealloc, xSemaphoreRealloc);
strcat(tmp, "_realloc");
}
semphrTakeConditional(useMutexOnFree, xSemaphoreFree);
free(tmp);
semphrGiveConditional(useMutexOnFree, xSemaphoreFree);
delay(DELAY);
}
}
void loop3(void *pvPramaters)
{
(void) pvPramaters;
while (1)
{
_loop[3]++;
char *tmp;
semphrTakeConditional(useMutexOnMalloc, xSemaphoreMalloc);
tmp = (char *)malloc(10 * sizeof(char));
semphrGiveConditional(useMutexOnMalloc, xSemaphoreMalloc);
strcpy(tmp, "yeah");
if (tryRealloc)
{
semphrTakeConditional(useMutexOnRealloc, xSemaphoreRealloc);
tmp = (char *)realloc(tmp, 20 * sizeof(char));
semphrGiveConditional(useMutexOnRealloc, xSemaphoreRealloc);
strcat(tmp, "_realloc");
}
semphrTakeConditional(useMutexOnFree, xSemaphoreFree);
free(tmp);
semphrGiveConditional(useMutexOnFree, xSemaphoreFree);
delay(DELAY);
}
}
void loop4(void *pvPramaters)
{
(void) pvPramaters;
while (1)
{
_loop[4]++;
char *tmp;
semphrTakeConditional(useMutexOnMalloc, xSemaphoreMalloc);
tmp = (char *)malloc(10 * sizeof(char));
semphrGiveConditional(useMutexOnMalloc, xSemaphoreMalloc);
strcpy(tmp, "baz");
if (tryRealloc)
{
semphrTakeConditional(useMutexOnRealloc, xSemaphoreRealloc);
tmp = (char *)realloc(tmp, 20 * sizeof(char));
semphrGiveConditional(useMutexOnRealloc, xSemaphoreRealloc);
strcat(tmp, "_realloc");
}
semphrTakeConditional(useMutexOnFree, xSemaphoreFree);
free(tmp);
semphrGiveConditional(useMutexOnFree, xSemaphoreFree);
delay(DELAY);
}
}
void loop5(void *pvPramaters)
{
(void) pvPramaters;
while (1)
{
_loop[5]++;
char *tmp;
semphrTakeConditional(useMutexOnMalloc, xSemaphoreMalloc);
tmp = (char *)malloc(10 * sizeof(char));
semphrGiveConditional(useMutexOnMalloc, xSemaphoreMalloc);
strcpy(tmp, "asd");
if (tryRealloc)
{
semphrTakeConditional(useMutexOnRealloc, xSemaphoreRealloc);
tmp = (char *)realloc(tmp, 20 * sizeof(char));
semphrGiveConditional(useMutexOnRealloc, xSemaphoreRealloc);
strcat(tmp, "_realloc");
}
semphrTakeConditional(useMutexOnFree, xSemaphoreFree);
free(tmp);
semphrGiveConditional(useMutexOnFree, xSemaphoreFree);
delay(DELAY);
}
}
void loop6(void *pvPramaters)
{
(void) pvPramaters;
while (1)
{
_loop[6]++;
char *tmp;
semphrTakeConditional(useMutexOnMalloc, xSemaphoreMalloc);
tmp = (char *)malloc(10 * sizeof(char));
semphrGiveConditional(useMutexOnMalloc, xSemaphoreMalloc);
strcpy(tmp, "lol");
if (tryRealloc)
{
semphrTakeConditional(useMutexOnRealloc, xSemaphoreRealloc);
tmp = (char *)realloc(tmp, 20 * sizeof(char));
semphrGiveConditional(useMutexOnRealloc, xSemaphoreRealloc);
strcat(tmp, "_realloc");
}
semphrTakeConditional(useMutexOnFree, xSemaphoreFree);
free(tmp);
semphrGiveConditional(useMutexOnFree, xSemaphoreFree);
delay(DELAY);
}
}
void loop7(void *pvPramaters)
{
(void) pvPramaters;
while (1)
{
_loop[7]++;
char *tmp;
semphrTakeConditional(useMutexOnMalloc, xSemaphoreMalloc);
tmp = (char *)malloc(10 * sizeof(char));
semphrGiveConditional(useMutexOnMalloc, xSemaphoreMalloc);
strcpy(tmp, "yay");
if (tryRealloc)
{
semphrTakeConditional(useMutexOnRealloc, xSemaphoreRealloc);
tmp = (char *)realloc(tmp, 20 * sizeof(char));
semphrGiveConditional(useMutexOnRealloc, xSemaphoreRealloc);
strcat(tmp, "_realloc");
}
semphrTakeConditional(useMutexOnFree, xSemaphoreFree);
free(tmp);
semphrGiveConditional(useMutexOnFree, xSemaphoreFree);
delay(DELAY);
}
}
void semphrTakeConditional(bool useMutexOn, SemaphoreHandle_t xSemaphore)
{
if (useMutexOn)
{
xSemaphoreTake(xSemaphore, TickType_t(portMAX_DELAY));
}
}
void semphrGiveConditional(bool useMutexOn, SemaphoreHandle_t xSemaphore)
{
if (useMutexOn)
{
xSemaphoreGive(xSemaphore);
}
}
@@ -1,4 +1,5 @@
#include "HID_Bluetooth.h"
#include <sdkoverride/tusb_gamepad16.h>
//setup the report map.
//more generic function to be used with BLE & BT Classis
@@ -6,7 +7,7 @@ void __SetupHIDreportmap(void (*WeakMouse)(), void (*WeakKeyboard)(), void (*Wea
//allocate memory for the HID report descriptors. We don't use them, but need the size here.
uint8_t desc_hid_report_mouse[] = { TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(1)) };
uint8_t desc_hid_report_absmouse[] = { TUD_HID_REPORT_DESC_ABSMOUSE(HID_REPORT_ID(1)) };
uint8_t desc_hid_report_joystick[] = { TUD_HID_REPORT_DESC_GAMEPAD(HID_REPORT_ID(1)) };
uint8_t desc_hid_report_joystick[] = { TUD_HID_REPORT_DESC_GAMEPAD16(HID_REPORT_ID(1)) };
uint8_t desc_hid_report_keyboard[] = { TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(1)), TUD_HID_REPORT_DESC_CONSUMER(HID_REPORT_ID(2)) };
int size = 0;
@@ -111,7 +112,7 @@ void __SetupHIDreportmap(void (*WeakMouse)(), void (*WeakKeyboard)(), void (*Wea
reportid++;
offset += sizeof(desc_hid_report_absmouse);
}
uint8_t desc_local[] = { TUD_HID_REPORT_DESC_GAMEPAD(HID_REPORT_ID(reportid)) };
uint8_t desc_local[] = { TUD_HID_REPORT_DESC_GAMEPAD16(HID_REPORT_ID(reportid)) };
memcpy(*reportmap + offset, desc_local, sizeof(desc_local));
}
@@ -178,11 +178,13 @@ public:
while (connected() && _needToSend) {
/* noop busy wait */
}
_needToSend = true;
_sendReport = rpt;
_sendReportLen = len;
__lockBluetooth();
hids_device_request_can_send_now_event(_con_handle);
if (connected()) {
_needToSend = true;
_sendReport = rpt;
_sendReportLen = len;
hids_device_request_can_send_now_event(_con_handle);
}
__unlockBluetooth();
while (connected() && _needToSend) {
/* noop busy wait */
@@ -142,12 +142,14 @@ public:
}
bool send(int id, void *rpt, int len) {
_needToSend = true;
_sendReportID = id;
_sendReport = rpt;
_sendReportLen = len;
__lockBluetooth();
hid_device_request_can_send_now_event(getCID());
if (connected()) {
_needToSend = true;
_sendReportID = id;
_sendReport = rpt;
_sendReportLen = len;
hid_device_request_can_send_now_event(getCID());
}
__unlockBluetooth();
while (connected() && _needToSend) {
/* noop busy wait */
+8 -4
View File
@@ -35,9 +35,9 @@
#include <memory>
#include <vector>
#ifdef DEBUG_ESP_HTTP_CLIENT
#ifdef DEBUG_ESP_PORT
#define DEBUG_HTTPCLIENT(fmt, ...) DEBUG_ESP_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
#ifdef DEBUG_RP2040_CORE
#ifdef DEBUG_RP2040_PORT
#define DEBUG_HTTPCLIENT(fmt, ...) DEBUG_RP2040_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
#endif
#endif
@@ -179,7 +179,11 @@ typedef std::vector<Cookie> CookieJar;
class HTTPClient {
public:
HTTPClient() = default;
~HTTPClient() = default;
~HTTPClient() {
if (_clientMade) {
delete _clientMade;
}
}
HTTPClient(HTTPClient&&) = default;
HTTPClient& operator=(HTTPClient&&) = default;
+3 -3
View File
@@ -31,9 +31,9 @@
#include <WiFiUdp.h>
#include <HTTPClient.h>
#ifdef DEBUG_ESP_HTTP_UPDATE
#ifdef DEBUG_ESP_PORT
#define DEBUG_HTTP_UPDATE(fmt, ...) DEBUG_ESP_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
#ifdef DEBUG_RP2040_CORE
#ifdef DEBUG_RP2040_PORT
#define DEBUG_HTTP_UPDATE(fmt, ...) DEBUG_RP2040_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
#endif
#endif
+5 -2
View File
@@ -156,8 +156,6 @@ Switch axis value range between 10bit and 8bit.
* Default: 10bit, range for an axis from 0 to 1023
* 8bit mode: range from -127 to 127.
__Note:__ due to the gamepad descriptor of tinyUSB, the maximum range is -127/127. 10bit mode enables mapping, not a higher resolution.
#### Syntax
@@ -216,6 +214,11 @@ void loop() {
* [Joystick.sliderRight()](#joysticksliderright)
### `Joystick.use10bit()`
### `Joystick.use16bit()`
Set axis value range to 10-bit (0...1024) or 16-bit (-32767...32767).
### `Joystick.useManualSend()`
To fully control transmitting the USB-HID reports, enable manual sending.
@@ -33,8 +33,8 @@ void loop() {
}
Joystick.useManualSend(false);
Joystick.use10bit();
// Iterate all joystick axis
// Note: although you can use 0-1023 here (10bit), internally 8bits are used (-127 to 127)
Serial.println("Joystick X");
for (uint16_t i = 0; i < 1023; i++) {
Joystick.X(i);
@@ -74,7 +74,7 @@ void loop() {
// Use int8 mode for the axis.
// Note: hat is not used differently.
Serial.println("Now all axis in 8bit mode, -127 to 127");
Joystick.use8bit(true);
Joystick.use8bit();
Serial.println("Joystick X");
for (int16_t i = -127; i < 128; i++) {
Joystick.X(i);
@@ -105,6 +105,6 @@ void loop() {
Joystick.sliderRight(i);
delay(2);
} Joystick.sliderRight(0);
Joystick.use8bit(false);
Joystick.use10bit();
}
}
@@ -0,0 +1,22 @@
#include <Joystick.h>
// Set 1KHz polling frequency (1000/second)
int usb_hid_poll_interval = 1;
void setup() {
Joystick.use16bit();
Joystick.begin();
}
void loop() {
static int16_t delta = 1;
static int16_t p = 0;
if (p == 32767) {
delta = -1;
} else if (p == -32767) {
delta = 1;
}
p += delta;
Joystick.X(p);
Joystick.Y(-p);
}
+6 -5
View File
@@ -18,11 +18,14 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _JOYSTICK_h
#define _JOYSTICK_h
#pragma once
#ifdef USE_TINYUSB
#error Joystick is not compatible with Adafruit TinyUSB
#endif
#include <HID_Joystick.h>
#include "class/hid/hid.h"
#include <class/hid/hid.h>
//======================================================================
class Joystick_ : public HID_Joystick {
@@ -31,5 +34,3 @@ public:
virtual void send_now(void) override;
};
extern Joystick_ Joystick;
#endif /* _JOYSTICK_h */
+1 -1
View File
@@ -65,7 +65,7 @@ void JoystickBLE_::setBattery(int lvl) {
void JoystickBLE_::send_now() {
//insert report ID; not part of the hid_gamepad_report_t
uint8_t *report = (uint8_t *)malloc(sizeof(hid_gamepad_report_t) +1);
uint8_t *report = (uint8_t *)malloc(sizeof(hid_gamepad16_report_t) + 1);
if (report) {
report[0] = __BLEGetJoystickReportID();
memcpy(&report[1], (uint8_t*)&data, sizeof(data));
+5 -4
View File
@@ -20,8 +20,11 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KEYBOARD_h
#define KEYBOARD_h
#pragma once
#ifdef USE_TINYUSB
#error Keyboard is not compatible with Adafruit TinyUSB
#endif
#include <HID_Keyboard.h>
@@ -34,5 +37,3 @@ public:
Keyboard_(void);
};
extern Keyboard_ Keyboard;
#endif
+2 -2
View File
@@ -68,10 +68,10 @@ void KeyboardBLE_::sendReport(KeyReport* keys) {
memcpy(data.keycode, keys->keys, sizeof(data.keycode));
//stitch in report id
static uint8_t report[sizeof(hid_keyboard_report_t) +1];
static uint8_t report[sizeof(hid_keyboard_report_t) + 1];
report[0] = __BLEGetKeyboardReportID();
memcpy(&report[1], (uint8_t*)&data, sizeof(hid_keyboard_report_t));
PicoBluetoothBLEHID.send(&report, sizeof(hid_keyboard_report_t) +1);
PicoBluetoothBLEHID.send(&report, sizeof(hid_keyboard_report_t) + 1);
}
void KeyboardBLE_::sendConsumerReport(uint16_t key) {
+5 -4
View File
@@ -19,8 +19,11 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MOUSE_h
#define MOUSE_h
#pragma once
#ifdef USE_TINYUSB
#error Mouse is not compatible with Adafruit TinyUSB
#endif
#include <HID_Mouse.h>
@@ -30,5 +33,3 @@ public:
virtual void move(int x, int y, signed char wheel = 0) override;
};
extern Mouse_ Mouse;
#endif
+6 -5
View File
@@ -1,5 +1,5 @@
/*
Mouse.h
MouseAbsolute.h
Copyright (c) 2015, Arduino LLC
Original code (pre-library): Copyright (c) 2011, Peter Barrett
@@ -19,8 +19,11 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MOUSEABSOLUTE_h
#define MOUSEABSOLUTE_h
#pragma once
#ifdef USE_TINYUSB
#error MouseAbsolute is not compatible with Adafruit TinyUSB
#endif
#include <HID_Mouse.h>
@@ -30,5 +33,3 @@ public:
virtual void move(int x, int y, signed char wheel = 0) override;
};
extern MouseAbsolute_ MouseAbsolute;
#endif
+1 -1
View File
@@ -68,7 +68,7 @@ void MouseBLE_::setAbsolute(bool absolute) {
}
void MouseBLE_::move(int x, int y, signed char wheel) {
static uint8_t report[sizeof(hid_abs_mouse_report_t) +1];
static uint8_t report[sizeof(hid_abs_mouse_report_t) + 1];
if (!_absolute) {
hid_mouse_report_t data;
+2 -11
View File
@@ -1,5 +1,6 @@
#include "NetBIOS.h"
#include <functional>
#include <lwip/ip.h>
#include <lwip/netif.h>
#define NBNS_PORT 137
@@ -92,17 +93,7 @@ void NetBIOS::_onPacket(AsyncUDPPacket &packet) {
append_32((void *)&nbnsa.ttl, 300000);
append_16((void *)&nbnsa.data_len, 6);
append_16((void *)&nbnsa.flags, 0);
nbnsa.addr = packet.localIP(); // Wrong, but better than nothing
// Iterate over all netifs, see if the incoming address matches one of the netmaskes networks
// TODO - is there an easier way of seeing whicn netif produced a packet?
for (auto netif = netif_list; netif; netif = netif->next) {
auto maskedip = ip4_addr_get_u32(netif_ip4_addr(netif)) & ip4_addr_get_u32(netif_ip4_netmask(netif));
auto maskedin = ((uint32_t)packet.localIP()) & ip4_addr_get_u32(netif_ip4_netmask(netif));
if (maskedip == maskedin) {
nbnsa.addr = ip4_addr_get_u32(netif_ip4_addr(netif));
break;
}
}
nbnsa.addr = ip4_addr_get_u32(&ip_current_netif()->ip_addr);
_udp.writeTo((uint8_t *)&nbnsa, sizeof(nbnsa), packet.remoteIP(), NBNS_PORT);
}
}
+3 -3
View File
@@ -1,5 +1,5 @@
/*
SD.h - A thin shim for Arduino ESP8266 Filesystems
SD.h - A thin shim for Arduino RP2040 Filesystems
Copyright (c) 2019 Earle F. Philhower, III. All rights reserved.
This library is free software; you can redistribute it and/or
@@ -139,9 +139,9 @@ public:
size_t size() {
uint64_t sz = size64();
#ifdef DEBUG_ESP_PORT
#ifdef DEBUG_RP2040_PORT
if (sz > std::numeric_limits<uint32_t>::max()) {
DEBUG_ESP_PORT.printf_P(PSTR("WARNING: SD card size overflow (%lld >= 4GB). Please update source to use size64().\n"), (long long)sz);
DEBUG_RP2040_PORT.printf_P(PSTR("WARNING: SD card size overflow (%lld >= 4GB). Please update source to use size64().\n"), (long long)sz);
}
#endif
return (size_t)sz;
+2 -2
View File
@@ -115,10 +115,10 @@ public:
info.pageSize = i.pageSize;
info.maxOpenFiles = i.maxOpenFiles;
info.maxPathLength = i.maxPathLength;
#ifdef DEBUG_ESP_PORT
#ifdef DEBUG_RP2040_PORT
if (i.totalBytes > std::numeric_limits<uint32_t>::max()) {
// This catches both total and used cases, since used must always be < total.
DEBUG_ESP_PORT.printf_P(PSTR("WARNING: SD card size overflow (%lld >= 4GB). Please update source to use info64().\n"), (long long)i.totalBytes);
DEBUG_RP2040_PORT.printf_P(PSTR("WARNING: SD card size overflow (%lld >= 4GB). Please update source to use info64().\n"), (long long)i.totalBytes);
}
#endif
info.totalBytes = (size_t)i.totalBytes;
@@ -19,6 +19,10 @@
#pragma once
#ifdef USE_TINYUSB
#error SingleFileDrive is not compatible with Adafruit TinyUSB
#endif
#include <Arduino.h>
class SingleFileDrive {
@@ -0,0 +1,38 @@
#include <Arduino.h>
#include <Ticker.h>
#define LED_PIN LED_BUILTIN
Ticker blinker;
Ticker toggler;
Ticker changer;
float blinkerPace = 0.1; //seconds
const float togglePeriod = 5; //seconds
void change() {
blinkerPace = 0.5;
}
void blink() {
digitalWrite(LED_PIN, !digitalRead(LED_PIN));
}
void toggle() {
static bool isBlinking = false;
if (isBlinking) {
blinker.detach();
isBlinking = false;
} else {
blinker.attach(blinkerPace, blink);
isBlinking = true;
}
digitalWrite(LED_PIN, LOW); //make sure LED on on after toggling (pin LOW = led ON)
}
void setup() {
pinMode(LED_PIN, OUTPUT);
toggler.attach(togglePeriod, toggle);
changer.once(30, change);
}
void loop() {}
@@ -0,0 +1,48 @@
/*
Basic Ticker usage
Ticker is an object that will call a given function with a certain period.
Each Ticker calls one function. You can have as many Tickers as you like,
memory being the only limitation.
A function may be attached to a ticker and detached from the ticker.
There are two variants of the attach function: attach and attach_ms.
The first one takes period in seconds, the second one in milliseconds.
The built-in LED will be blinking.
*/
#include <Ticker.h>
#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif
Ticker flipper;
int count = 0;
void flip() {
int state = digitalRead(LED_BUILTIN); // get the current state of GPIO1 pin
digitalWrite(LED_BUILTIN, !state); // set pin to the opposite state
++count;
// when the counter reaches a certain value, start blinking like crazy
if (count == 20) {
flipper.attach(0.1, flip);
}
// when the counter reaches yet another value, stop blinking
else if (count == 120) {
flipper.detach();
}
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
// flip the pin every 0.3s
flipper.attach(0.3, flip);
}
void loop() {}
@@ -0,0 +1,53 @@
/*
Passing parameters to Ticker callbacks
Apart from void(void) functions, the Ticker library supports
functions taking one argument. This argument's size has to be less or
equal to 4 bytes (so char, short, int, float, void*, char* types will do).
This sample runs two tickers that both call one callback function,
but with different arguments.
The built-in LED will be pulsing.
*/
#include <Ticker.h>
#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif
Ticker tickerSetLow;
Ticker tickerSetHigh;
Ticker tickerSetChar;
void setPinLow() {
digitalWrite(LED_BUILTIN, 0);
}
void setPinHigh() {
digitalWrite(LED_BUILTIN, 1);
}
void setPin(int state) {
digitalWrite(LED_BUILTIN, state);
}
void setPinChar(char state) {
digitalWrite(LED_BUILTIN, state);
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
// every 25 ms, call setPinLow()
tickerSetLow.attach_ms(25, setPinLow);
// every 26 ms, call setPinHigh()
tickerSetHigh.attach_ms(26, setPinHigh);
// every 54 ms, call setPinChar(1)
tickerSetChar.attach_ms(26, setPinChar, (char)1);
}
void loop() {}
+18
View File
@@ -0,0 +1,18 @@
#######################################
# Datatypes (KEYWORD1)
#######################################
Ticker KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
attach KEYWORD2
attach_ms KEYWORD2
attach_us KEYWORD2
once KEYWORD2
once_ms KEYWORD2
once_us KEYWORD2
detach KEYWORD2
active KEYWORD2
+9
View File
@@ -0,0 +1,9 @@
name=Ticker
version=2.0.0
author=Bert Melis
maintainer=Earle F. Philhower, III <earlephilhower@yahoo.com>
sentence=Allows to call functions with a given interval.
paragraph=
category=Timing
url=
architectures=rp2040
+91
View File
@@ -0,0 +1,91 @@
/*
Ticker.cpp - RP2040 library that calls functions periodically
Ported 2024 to the RP2040 by Earle F. Philhower, III <earlephilhower@yahoo.com>
Copyright (c) 2017 Bert Melis. All rights reserved.
Based on the original work of:
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
The original version is part of the esp8266 core for Arduino environment.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "Ticker.h"
Ticker::Ticker() : _callback_function(nullptr), _callback_with_arg(nullptr), _alarm_id(-1), _repeating_timer(nullptr) { }
Ticker::~Ticker() {
detach();
}
bool Ticker::_attach_us(uint64_t micros, bool repeat, callback_with_arg_t callback, void *arg) {
detach();
_callback_with_arg = callback;
_callback_arg = arg;
if (repeat) {
_repeating_timer = new repeating_timer_t;
_repeating_timer->user_data = (void *)this;
return add_repeating_timer_us(micros, _repeating_callback, this, _repeating_timer);
} else {
_alarm_id = add_alarm_in_us(micros, _alarm_callback, this, true);
return _alarm_id != -1;
}
}
void Ticker::detach() {
if (_repeating_timer) {
cancel_repeating_timer(_repeating_timer);
delete _repeating_timer;
} else if (_alarm_id != -1) {
cancel_alarm(_alarm_id);
}
_repeating_timer = nullptr;
_alarm_id = -1;
_callback_with_arg = nullptr;
}
bool Ticker::active() const {
if (!_repeating_timer && (_alarm_id == -1)) {
return false;
}
return true;
}
void Ticker::_static_callback(void *arg) {
Ticker *_this = reinterpret_cast<Ticker *>(arg);
if (_this && _this->_callback_function) {
_this->_callback_function();
}
}
bool Ticker::_repeating_callback(repeating_timer_t *arg) {
Ticker *_this = reinterpret_cast<Ticker *>(arg->user_data);
if (_this && _this->_callback_function) {
_this->_callback_with_arg(_this->_callback_arg);
}
return true;
}
int64_t Ticker::_alarm_callback(alarm_id_t id, void *user_data) {
(void) id;
Ticker *_this = reinterpret_cast<Ticker *>(user_data);
if (_this && _this->_callback_function) {
_this->_callback_with_arg(_this->_callback_arg);
}
_this->_alarm_id = -1;
_this->_callback_with_arg = nullptr;
return 0; // These are only a 1-shot
}
+129
View File
@@ -0,0 +1,129 @@
/*
Ticker.h - esp32 library that calls functions periodically
Ported 2024 to the RP2040 by Earle F. Philhower, III <earlephilhower@yahoo.com>
Copyright (c) 2017 Bert Melis. All rights reserved.
Based on the original work of:
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
The original version is part of the esp8266 core for Arduino environment.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include <Arduino.h>
#include <functional>
// The templated function casting <4 bytes to a 4-byte variable causes
// warnings on GCC 12 (but no actual problem since the smallest arg
// that can be physically passed is 32-bits). Disable that specific
// warning for this file only.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
class Ticker {
public:
Ticker();
~Ticker();
typedef void (*callback_with_arg_t)(void *);
typedef std::function<void(void)> callback_function_t;
bool attach(float seconds, callback_function_t callback) {
_callback_function = std::move(callback);
return _attach_us(1000000ULL * seconds, true, _static_callback, this);
}
bool attach_ms(uint64_t milliseconds, callback_function_t callback) {
_callback_function = std::move(callback);
return _attach_us(1000ULL * milliseconds, true, _static_callback, this);
}
bool attach_us(uint64_t micros, callback_function_t callback) {
_callback_function = std::move(callback);
return _attach_us(micros, true, _static_callback, this);
}
template<typename TArg> bool attach(float seconds, void (*callback)(TArg), TArg arg) {
static_assert(sizeof(TArg) <= sizeof(void *), "attach() callback argument size must be <= sizeof(void*)");
// C-cast serves two purposes:
// static_cast for smaller integer types,
// reinterpret_cast + const_cast for pointer types
return _attach_us(1000000ULL * seconds, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
template<typename TArg> bool attach_ms(uint64_t milliseconds, void (*callback)(TArg), TArg arg) {
static_assert(sizeof(TArg) <= sizeof(void *), "attach() callback argument size must be <= sizeof(void*)");
return _attach_us(1000ULL * milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
template<typename TArg> bool attach_us(uint64_t micros, void (*callback)(TArg), TArg arg) {
static_assert(sizeof(TArg) <= sizeof(void *), "attach() callback argument size must be <= sizeof(void*)");
return _attach_us(micros, true, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
bool once(float seconds, callback_function_t callback) {
_callback_function = std::move(callback);
return _attach_us(1000000ULL * seconds, false, _static_callback, this);
}
bool once_ms(uint64_t milliseconds, callback_function_t callback) {
_callback_function = std::move(callback);
return _attach_us(1000ULL * milliseconds, false, _static_callback, this);
}
bool once_us(uint64_t micros, callback_function_t callback) {
_callback_function = std::move(callback);
return _attach_us(micros, false, _static_callback, this);
}
template<typename TArg> bool once(float seconds, void (*callback)(TArg), TArg arg) {
static_assert(sizeof(TArg) <= sizeof(void *), "attach() callback argument size must be <= sizeof(void*)");
return _attach_us(1000000ULL * seconds, false, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
template<typename TArg> bool once_ms(uint64_t milliseconds, void (*callback)(TArg), TArg arg) {
static_assert(sizeof(TArg) <= sizeof(void *), "attach() callback argument size must be <= sizeof(void*)");
return _attach_us(1000ULL * milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
template<typename TArg> bool once_us(uint64_t micros, void (*callback)(TArg), TArg arg) {
static_assert(sizeof(TArg) <= sizeof(void *), "attach() callback argument size must be <= sizeof(void*)");
return _attach_us(micros, false, reinterpret_cast<callback_with_arg_t>(callback), reinterpret_cast<void *>(arg));
}
void detach();
bool active() const;
protected:
static void _static_callback(void *arg);
static bool _repeating_callback(repeating_timer_t *arg);
static int64_t _alarm_callback(alarm_id_t id, void *user_data);
// No arguments
callback_function_t _callback_function = nullptr;
// Arguments
callback_with_arg_t _callback_with_arg = nullptr;
void * _callback_arg;
alarm_id_t _alarm_id;
repeating_timer_t *_repeating_timer;
private:
bool _attach_us(uint64_t micros, bool repeat, callback_with_arg_t callback, void *arg);
};
#pragma GCC diagnostic pop
+2 -2
View File
@@ -49,7 +49,7 @@ enum HTTPAuthMethod { BASIC_AUTH, DIGEST_AUTH };
#define HTTP_MAX_DATA_AVAILABLE_WAIT 30 //ms to wait for the client to send the request when there is another client with data available
#define HTTP_MAX_POST_WAIT 5000 //ms to wait for POST data to arrive
#define HTTP_MAX_SEND_WAIT 5000 //ms to wait for data chunk to be ACKed
#define HTTP_MAX_CLOSE_WAIT 2000 //ms to wait for the client to close the connection
#define HTTP_MAX_CLOSE_WAIT 5000 //ms to wait for the client to close the connection
#define CONTENT_LENGTH_UNKNOWN ((size_t) -1)
#define CONTENT_LENGTH_NOT_SET ((size_t) -2)
@@ -73,7 +73,7 @@ typedef struct {
HTTPRawStatus status;
size_t totalSize; // content size
size_t currentSize; // size of data currently in buf
uint8_t buf[HTTP_UPLOAD_BUFLEN];
uint8_t buf[HTTP_RAW_BUFLEN];
void *data; // additional data
} HTTPRaw;
+34 -5
View File
@@ -360,13 +360,42 @@ int HTTPServer::_uploadReadByte(WiFiClient * client) {
int res = client->read();
if (res < 0) {
while (!client->available() && client->connected()) {
delay(2);
// keep trying until you either read a valid byte or timeout
const unsigned long startMillis = millis();
const unsigned long timeoutIntervalMillis = client->getTimeout();
bool timedOut = false;
for (;;) {
if (!client->connected()) {
return -1;
}
// loosely modeled after blinkWithoutDelay pattern
while (!timedOut && !client->available() && client->connected()) {
delay(2);
timedOut = (millis() - startMillis) >= timeoutIntervalMillis;
}
res = client->read();
if (res >= 0) {
return res; // exit on a valid read
}
// NOTE: it is possible to get here and have all of the following
// assertions hold true
//
// -- client.available() > 0
// -- client.connected == true
// -- res == -1
//
// a simple retry strategy overcomes this which is to say the
// assertion is not permanent, but the reason that this works
// is elusive, and possibly indicative of a more subtle underlying
// issue
timedOut = (millis() - startMillis) >= timeoutIntervalMillis;
if (timedOut) {
return res; // exit on a timeout
}
}
res = client->read();
}
return res;
}
+1 -2
View File
@@ -111,10 +111,9 @@ void WebServerTemplate<ServerType, DefaultPort>::handleClient() {
case HC_WAIT_READ:
// Wait for data from client to become available
if (_currentClient->available()) {
_currentClient->setTimeout(HTTP_MAX_SEND_WAIT);
switch (_parseRequest(_currentClient)) {
case CLIENT_REQUEST_CAN_CONTINUE:
// Because HTTP_MAX_SEND_WAIT is expressed in milliseconds, it must be divided by 1000
_currentClient->setTimeout(HTTP_MAX_SEND_WAIT / 1000);
_contentLength = CONTENT_LENGTH_NOT_SET;
_handleRequest();
/* fallthrough */
+2 -2
View File
@@ -21,8 +21,8 @@
#include <memory>
#if defined(DEBUG_ESP_SSL) && defined(DEBUG_ESP_PORT)
#define DEBUG_BSSL(fmt, ...) DEBUG_ESP_PORT.printf_P((PGM_P)PSTR( "BSSL:" fmt), ## __VA_ARGS__)
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
#define DEBUG_BSSL(fmt, ...) DEBUG_RP2040_PORT.printf_P((PGM_P)PSTR( "BSSL:" fmt), ## __VA_ARGS__)
#else
#define DEBUG_BSSL(...)
#endif
+19 -20
View File
@@ -29,18 +29,14 @@
#include "WiFiClientSecureBearSSL.h"
#include "WiFiNTP.h"
#include "StackThunk.h"
#include "lwip/opt.h"
#include "lwip/ip.h"
#include "lwip/tcp.h"
#include "lwip/inet.h"
#include "lwip/netif.h"
#include <lwip/opt.h>
#include <lwip/ip.h>
#include <lwip/tcp.h>
#include <lwip/inet.h>
#include <lwip/netif.h>
#include <include/ClientContext.h>
//#include "c_types.h"
//#include <mmu_iram.h>
//#include <umm_malloc/umm_malloc.h>
//#include <umm_malloc/umm_heap_select.h>
#if 1
#if !CORE_MOCK
#if !defined(CORE_MOCK)
// The BearSSL thunks in use for now
#define br_ssl_engine_recvapp_ack thunk_br_ssl_engine_recvapp_ack
@@ -52,11 +48,10 @@
#define br_ssl_engine_sendrec_ack thunk_br_ssl_engine_sendrec_ack
#define br_ssl_engine_sendrec_buf thunk_br_ssl_engine_sendrec_buf
#endif
#endif
#if defined(DEBUG_ESP_SSL) && defined(DEBUG_ESP_PORT)
#define DEBUG_BSSL(fmt, ...) DEBUG_ESP_PORT.printf_P((PGM_P)PSTR( "BSSL:" fmt), ## __VA_ARGS__)
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
#define DEBUG_BSSL(fmt, ...) DEBUG_RP2040_PORT.printf_P((PGM_P)PSTR( "BSSL:" fmt), ## __VA_ARGS__)
#else
#define DEBUG_BSSL(...)
#endif
@@ -123,6 +118,10 @@ WiFiClientSecureCtx::~WiFiClientSecureCtx() {
_client->unref();
_client = nullptr;
}
if (_esp32_ta) {
delete _esp32_ta;
}
_cipher_list = nullptr; // std::shared will free if last reference
_freeSSL();
stack_thunk_del_ref();
@@ -717,12 +716,12 @@ extern "C" {
if (!xc->done_cert) {
br_sha1_update(&xc->sha1_cert, buf, len);
br_x509_decoder_push(&xc->ctx, (const void*)buf, len);
#if defined(DEBUG_ESP_SSL) && defined(DEBUG_ESP_PORT)
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
DEBUG_BSSL("CERT: ");
for (size_t i = 0; i < len; i++) {
DEBUG_ESP_PORT.printf_P(PSTR("%02x "), buf[i] & 0xff);
DEBUG_RP2040_PORT.printf_P(PSTR("%02x "), buf[i] & 0xff);
}
DEBUG_ESP_PORT.printf_P(PSTR("\n"));
DEBUG_RP2040_PORT.printf_P(PSTR("\n"));
#endif
}
}
@@ -746,7 +745,7 @@ extern "C" {
char res[20];
br_sha1_out(&xc->sha1_cert, res);
if (xc->match_fingerprint && memcmp(res, xc->match_fingerprint, sizeof(res))) {
#ifdef DEBUG_ESP_SSL
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
DEBUG_BSSL("insecure_end_chain: Received cert FP doesn't match\n");
char buff[3 * sizeof(res) + 1]; // 3 chars per byte XX_, and null
buff[0] = 0;
@@ -1139,7 +1138,7 @@ bool WiFiClientSecureCtx::_connectSSL(const char* hostName) {
}
}
#ifdef DEBUG_ESP_SSL
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
// BearSSL will reject all connections unless an authentication option is set, warn in DEBUG builds
if (!_use_insecure && !_use_fingerprint && !_use_self_signed && !_knownkey && !_certStore && !_ta) {
DEBUG_BSSL("Connection *will* fail, no authentication method is setup\n");
@@ -1209,7 +1208,7 @@ bool WiFiClientSecureCtx::_connectSSL(const char* hostName) {
}
auto ret = _wait_for_handshake();
#ifdef DEBUG_ESP_SSL
#if defined(DEBUG_RP2040_CORE) && defined(DEBUG_RP2040_PORT)
if (!ret) {
char err[256];
getLastSSLError(err, sizeof(err));
+1 -1
View File
@@ -171,7 +171,7 @@ public:
_on_rx = handler;
}
#ifdef DEBUG_ESP_CORE
#ifdef DEBUG_RP2040_CORE
// this helper is ready to be used when debugging UDP
void printChain(const pbuf* pb, const char* msg, size_t n) const {
// printf the pb pbuf chain, buffered and all at once
+1 -1
View File
@@ -39,7 +39,7 @@ extern "C" void netif_status_changed(struct netif* netif) {
bool LwipIntf::stateChangeSysCB(LwipIntf::CBType&& cb) {
if (netifStatusChangeListLength >= NETIF_STATUS_CB_SIZE) {
#if defined(DEBUG_ESP_CORE)
#if defined(DEBUG_RP2040_CORE)
DEBUGV("NETIF_STATUS_CB_SIZE is too low\n");
#endif
return false;
+13 -11
View File
@@ -427,18 +427,20 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
template<class RawDev>
void LwipIntfDev<RawDev>::end() {
if (_intrPin < 0) {
__removeEthernetPacketHandler(_phID);
} else {
detachInterrupt(_intrPin);
__removeEthernetGPIO(_intrPin);
if (_started) {
if (_intrPin < 0) {
__removeEthernetPacketHandler(_phID);
} else {
detachInterrupt(_intrPin);
__removeEthernetGPIO(_intrPin);
}
RawDev::end();
netif_remove(&_netif);
_started = false;
}
RawDev::end();
netif_remove(&_netif);
_started = false;
}
template<class RawDev>
@@ -0,0 +1,51 @@
// Simple speed and functionality test for DMA memcpy
// Released to the public domain by Earle F. Philhower, III, 2024
uint32_t src[1024];
uint32_t dest[1024];
void setup() {
// Set up a simple test pattern in src, verify after each pass
srand(0xc0de);
for (int i = 0; i < 1024; i++) {
src[i] = ((~i) & 1024) | ((i) << 22);
}
}
void verify(const char *name, uint32_t *src) {
for (int i = 0; i < 1024; i++) {
uint32_t expected = ((~i) & 1024) | ((i) << 22);
if (expected != src[i]) {
Serial.printf("ERROR, mismatch @ %d on %s memcpy\n", i, name);
while (true) {
// Idle forever, this is fatal!
}
}
}
}
void loop() {
uint64_t start, stop;
start = rp2040.getCycleCount();
for (int i = 0; i < 1000; i++) {
memcpy(dest, src, 4 * 1024);
memcpy(src, dest, 4 * 1024);
}
stop = rp2040.getCycleCount();
verify("CPU", src);
verify("CPU", dest);
Serial.printf("CPU: %lld clock cycles for 4K\n", (stop - start) / 1000);
start = rp2040.getCycleCount();
for (int i = 0; i < 1000; i++) {
rp2040.memcpyDMA(dest, src, 4 * 1024);
rp2040.memcpyDMA(src, dest, 4 * 1024);
}
stop = rp2040.getCycleCount();
verify("DMA", src);
verify("DMA", dest);
Serial.printf("DMA: %lld clock cycles for 4K\n\n\n", (stop - start) / 1000);
delay(1000);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "framework-arduinopico",
"version": "1.30903.0",
"version": "1.30905.0",
"description": "Arduino Wiring-based Framework (RPi Pico RP2040)",
"keywords": [
"framework",
+21
View File
@@ -74,6 +74,18 @@
{
"name": "Adafruit KB2040"
},
{
"name": "Amken BunnyBoard"
},
{
"name": "Amken Revelop"
},
{
"name": "Amken Revelop Plus"
},
{
"name": "Amken Revelop eS"
},
{
"name": "Arduino Nano RP2040 Connect"
},
@@ -86,6 +98,9 @@
{
"name": "BridgeTek IDM2040-7A"
},
{
"name": "BridgeTek IDM2040-43A"
},
{
"name": "Cytron Maker Nano RP2040"
},
@@ -113,6 +128,9 @@
{
"name": "ElectronicCats HunterCat NFC RP2040"
},
{
"name": "EVN Alpha"
},
{
"name": "ExtremeElectronics RC2040"
},
@@ -188,6 +206,9 @@
{
"name": "Pimoroni Tiny2040"
},
{
"name": "Pintronix PinMax"
},
{
"name": "RAKwireless RAK11300"
},
+1 -1
View File
@@ -20,7 +20,7 @@
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Raspberry Pi RP2040 Boards
version=3.9.3
version=3.9.5
# Required discoveries and monitors
# ---------------------------------
+1 -1
View File
@@ -2,7 +2,7 @@
cache_dir=$(mktemp -d)
source "$TRAVIS_BUILD_DIR"/tests/common.sh
source "$GITHUB_WORKSPACE"/tests/common.sh
install_arduino nodebug
+1 -1
View File
@@ -2,7 +2,7 @@
cache_dir=$(mktemp -d)
source "$TRAVIS_BUILD_DIR"/tests/common.sh
source "$GITHUB_WORKSPACE"/tests/common.sh
if [ -z "$BUILD_PARITY" ]; then
mod=1
+1 -1
View File
@@ -4,7 +4,7 @@
set -ev
cd $TRAVIS_BUILD_DIR
cd $GITHUB_WORKSPACE
tools/boards.txt.py --boardsgen --ldgen --packagegen --docgen
+1 -1
View File
@@ -4,6 +4,6 @@
set -ev
cd $TRAVIS_BUILD_DIR/doc
cd $GITHUB_WORKSPACE/doc
SPHINXOPTS="-W" make html
+3 -3
View File
@@ -4,13 +4,13 @@
set -ev
export PKG_URL=https://github.com/esp8266/Arduino/releases/download/$TRAVIS_TAG/esp8266-$TRAVIS_TAG.zip
export DOC_URL=https://arduino-esp8266.readthedocs.io/en/$TRAVIS_TAG/
export PKG_URL=https://github.com/esp8266/Arduino/releases/download/$GITHUB_REF/esp8266-$GITHUB_REF.zip
export DOC_URL=https://arduino-esp8266.readthedocs.io/en/$GITHUB_REF/
if [ -z "$CI_GITHUB_API_KEY" ]; then
echo "Github API key not set. Skip building the package."
exit 0
fi
cd $TRAVIS_BUILD_DIR/package
cd $GITHUB_WORKSPACE/package
./build_boards_manager_package.sh
+1 -1
View File
@@ -4,7 +4,7 @@
set -ev
cd $TRAVIS_BUILD_DIR/tests/host
cd $GITHUB_WORKSPACE/tests/host
make -j2 FORCE32=0 ssl
+1 -1
View File
@@ -12,4 +12,4 @@ ${org}/../restyle.sh
git --version || true
git submodule foreach --recursive 'git reset --hard'
git diff --exit-code -- $TRAVIS_BUILD_DIR
git diff --exit-code -- $GITHUB_WORKSPACE
+8 -8
View File
@@ -230,9 +230,9 @@ function install_arduino()
{
local debug=$1
# Install Arduino IDE and required libraries
cd $TRAVIS_BUILD_DIR
install_ide $HOME/arduino_ide $TRAVIS_BUILD_DIR $debug
cd $TRAVIS_BUILD_DIR
cd $GITHUB_WORKSPACE
install_ide $HOME/arduino_ide $GITHUB_WORKSPACE $debug
cd $GITHUB_WORKSPACE
install_libraries
}
@@ -244,7 +244,7 @@ function build_sketches_with_arduino()
# Compile sketches
build_sketches $HOME/arduino_ide $HOME/arduino_ide/examples "-l $HOME/Arduino/libraries ${build_extra}" $build_mod $build_rem
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries ${build_extra}" $build_mod $build_rem
build_sketches $HOME/arduino_ide $GITHUB_WORKSPACE/libraries "-l $HOME/Arduino/libraries ${build_extra}" $build_mod $build_rem
# Generate size report
cat size.log
@@ -253,11 +253,11 @@ function build_sketches_with_arduino()
set -e
if [ -z "$TRAVIS_BUILD_DIR" ]; then
echo "TRAVIS_BUILD_DIR is not set, trying to guess:"
if [ -z "$GITHUB_WORKSPACE" ]; then
echo "GITHUB_WORKSPACE is not set, trying to guess:"
pushd $(dirname $0)/../ > /dev/null
TRAVIS_BUILD_DIR=$PWD
GITHUB_WORKSPACE=$PWD
popd > /dev/null
echo "TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR"
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
fi
+1 -1
View File
@@ -2,7 +2,7 @@
cache_dir=$(mktemp -d)
source "$TRAVIS_BUILD_DIR"/tests/common.sh
source "$GITHUB_WORKSPACE"/tests/common.sh
if [ "$BUILD_PARITY" = "even" ]; then
mod=2
+2 -2
View File
@@ -2,7 +2,7 @@
for dir in ./cores/rp2040 ./libraries/EEPROM ./libraries/I2S ./libraries/SingleFileDrive \
./libraries/LittleFS/src ./libraries/LittleFS/examples ./libraries/PWMAudio \
./libraries/rp2040 ./libraries/SD ./libraries/ESP8266SdFat ./libraries/ADCInput \
./libraries/rp2040 ./libraries/SD ./libraries/ADCInput \
./libraries/Servo ./libraries/SPI ./libraries/Wire ./libraries/PDM \
./libraries/WiFi ./libraries/lwIP_Ethernet ./libraries/lwIP_CYW43 \
./libraries/FreeRTOS/src ./libraries/LEAmDNS ./libraries/MD5Builder \
@@ -16,7 +16,7 @@ for dir in ./cores/rp2040 ./libraries/EEPROM ./libraries/I2S ./libraries/SingleF
./libraries/lwIP_w5500 ./libraries/lwIP_w5100 ./libraries/lwIP_enc28j60 \
./libraries/SPISlave ./libraries/lwIP_ESPHost ./libraries/FatFS\
./libraries/FatFSUSB ./libraries/BluetoothAudio ./libraries/BluetoothHCI \
./libraries/BluetoothHIDMaster ./libraries/NetBIOS; do
./libraries/BluetoothHIDMaster ./libraries/NetBIOS ./libraries/Ticker; do
find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" \) -a \! -path '*api*' -exec astyle --suffix=none --options=./tests/astyle_core.conf \{\} \;
find $dir -type f -name "*.ino" -exec astyle --suffix=none --options=./tests/astyle_examples.conf \{\} \;
done
+1 -1
View File
@@ -84,7 +84,7 @@ git submodule update --init
(cd pico-extras && git submodule update --init)
export HOME="${TMPCI}"
export TRAVIS_BUILD_DIR="${TMPCI}"
export GITHUB_WORKSPACE="${TMPCI}"
export BUILD_TYPE="$BUILD_TYPE"
if [ "$BUILD_TYPE" = "build" ]; then
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q128jvxq_4_padded_checksum.S",
"usb_vid": "0x2770",
"usb_pid": "0x7303"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_AMKEN_BB -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2770",
"0x7303"
]
],
"mcu": "rp2040",
"variant": "amken_bunny"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "BunnyBoard",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 134217728,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.amken3d.com",
"vendor": "Amken"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_W25Q32JVxQ_4_padded_checksum.S",
"usb_vid": "0x2770",
"usb_pid": "0x7304"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_AMKEN_REVELOP -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2770",
"0x7304"
]
],
"mcu": "rp2040",
"variant": "amken_revelop"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Revelop",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 33554432,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.amken3d.com",
"vendor": "Amken"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q16jvxq_4_padded_checksum.S",
"usb_vid": "0x2770",
"usb_pid": "0x7306"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_AMKEN_ES -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2770",
"0x7306"
]
],
"mcu": "rp2040",
"variant": "amken_revelop_es"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Revelop eS",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 16777216,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.amken3d.com",
"vendor": "Amken"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_W25Q32JVxQ_4_padded_checksum.S",
"usb_vid": "0x2770",
"usb_pid": "0x7305"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_AMKEN_REVELOP_PLUS -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2770",
"0x7305"
]
],
"mcu": "rp2040",
"variant": "amken_revelop_plus"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Revelop Plus",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 33554432,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.amken3d.com",
"vendor": "Amken"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x2E8B",
"usb_pid": "0xF00A"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_BRIDGETEK_IDM2040_43A -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DFT8XX_TYPE=BT883 -DDISPLAY_RES=WQVGA -DPLATFORM_RP2040",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8B",
"0xF00A"
]
],
"mcu": "rp2040",
"variant": "bridgetek_idm2040_43a"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "IDM2040-43A",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 8388608,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "BridgeTek"
}
@@ -9,7 +9,7 @@
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_BRIDGETEK_IDM2040-7A -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DFT8XX_TYPE=BT817 -DDISPLAY_RES=WVGA -DPLATFORM_RP2040",
"extra_flags": "-D ARDUINO_BRIDGETEK_IDM2040_7A -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DFT8XX_TYPE=BT817 -DDISPLAY_RES=WVGA -DPLATFORM_RP2040",
"f_cpu": "133000000L",
"hwids": [
[
@@ -22,7 +22,7 @@
]
],
"mcu": "rp2040",
"variant": "bridgetek_idm2040-7a"
"variant": "bridgetek_idm2040_7a"
},
"debug": {
"jlink_device": "RP2040_M0_0",
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_generic_03h_2_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0xF00A"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_EVN_ALPHA -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0xF00A"
]
],
"mcu": "rp2040",
"variant": "evn_alpha"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "Alpha",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 16777216,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://coresg.tech/evn",
"vendor": "EVN"
}
+56
View File
@@ -0,0 +1,56 @@
{
"build": {
"arduino": {
"earlephilhower": {
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
"usb_vid": "0x2E8A",
"usb_pid": "0x9101"
}
},
"core": "earlephilhower",
"cpu": "cortex-m0plus",
"extra_flags": "-D ARDUINO_PINTRONIX_PINMAX -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
"f_cpu": "133000000L",
"hwids": [
[
"0x2E8A",
"0x00C0"
],
[
"0x2E8A",
"0x9101"
]
],
"mcu": "rp2040",
"variant": "pintronix_pinmax"
},
"debug": {
"jlink_device": "RP2040_M0_0",
"openocd_target": "rp2040.cfg",
"svd_path": "rp2040.svd"
},
"frameworks": [
"arduino"
],
"name": "PinMax",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 4194304,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,
"wait_for_upload_port": false,
"protocol": "picotool",
"protocols": [
"blackmagic",
"cmsis-dap",
"jlink",
"raspberrypi-swd",
"picotool",
"picoprobe",
"pico-debug"
]
},
"url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
"vendor": "Pintronix"
}
+20 -6
View File
@@ -134,7 +134,7 @@ def BuildIPBTStack(name):
def BuildUploadMethodMenu(name):
for a, b, c, d, e, f in [ ["default", "Default (UF2)", 256, "picoprobe_cmsis_dap.tcl", "uf2conv", "uf2conv-network"],
["picotool", "Picotool", 256, "picoprobe.tcl", "picotool", None],
["picoprobe_cmsis_dap", "Picoprobe (CMSIS-DAP)", 256, "picoprobe_cmsis_dap.tcl", "picoprobe_cmsis_dap", None],
["picoprobe_cmsis_dap", "Picoprobe/Debugprobe (CMSIS-DAP)", 256, "picoprobe_cmsis_dap.tcl", "picoprobe_cmsis_dap", None],
["picodebug", "Pico-Debug", 240, "picodebug.tcl", "picodebug", None] ]:
print("%s.menu.uploadmethod.%s=%s" % (name, a, b))
print("%s.menu.uploadmethod.%s.build.ram_length=%dk" % (name, a, c))
@@ -356,14 +356,14 @@ def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, f
.replace('USBPWR', str(pwr))\
.replace(' EXTRA_INFO', m_extra.rstrip())
jsondir = os.path.abspath(os.path.dirname(__file__)) + "/json"
f = open(jsondir + "/" + name + ".json", "w")
f = open(jsondir + "/" + name + ".json", "w", newline='\n')
f.write(json)
f.close()
pkgjson = json.load(open(os.path.abspath(os.path.dirname(__file__)) + '/../package/package_pico_index.template.json'))
pkgjson['packages'][0]['platforms'][0]['boards'] = []
sys.stdout = open(os.path.abspath(os.path.dirname(__file__)) + "/../boards.txt", "w")
sys.stdout = open(os.path.abspath(os.path.dirname(__file__)) + "/../boards.txt", "w", newline='\n')
WriteWarning()
BuildGlobalMenuList()
@@ -396,6 +396,13 @@ MakeBoard("adafruit_trinkeyrp2040qt", "Adafruit", "Trinkey RP2040 QT", "0x239a",
MakeBoard("adafruit_macropad2040", "Adafruit", "MacroPad RP2040", "0x239a", "0x8107", 250, "ADAFRUIT_MACROPAD_RP2040", 8, "boot2_w25q080_2_padded_checksum")
MakeBoard("adafruit_kb2040", "Adafruit", "KB2040", "0x239a", "0x8105", 250, "ADAFRUIT_KB2040_RP2040", 8, "boot2_w25q080_2_padded_checksum")
#Amken
MakeBoard("amken_bunny","Amken","BunnyBoard","0x2770",["0x7303"],250,"AMKEN_BB",128,"boot2_w25q128jvxq_4_padded_checksum","","https://www.amken3d.com")
MakeBoard("amken_revelop","Amken","Revelop","0x2770",["0x7304"],250,"AMKEN_REVELOP",32,"boot2_W25Q32JVxQ_4_padded_checksum","","https://www.amken3d.com")
MakeBoard("amken_revelop_plus","Amken","Revelop Plus","0x2770",["0x7305"],250,"AMKEN_REVELOP_PLUS",32,"boot2_W25Q32JVxQ_4_padded_checksum","","https://www.amken3d.com")
MakeBoard("amken_revelop_es","Amken","Revelop eS","0x2770",["0x7306"],250,"AMKEN_ES",16,"boot2_w25q16jvxq_4_padded_checksum","","https://www.amken3d.com")
# Arduino
MakeBoard("arduino_nano_connect", "Arduino", "Nano RP2040 Connect", "0x2341", ["0x005e", "0x805e", "0x015e", "0x025e"] , 250, "NANO_RP2040_CONNECT", 16, "boot2_w25q080_2_padded_checksum")
@@ -406,8 +413,9 @@ MakeBoard("artronshop_rp2_nano", "ArtronShop", "RP2 Nano", "0x2e8a", "0x000a", 2
MakeBoard("breadstick_raspberry", "Breadstick", "Raspberry", "0x2e8a", "0x105e" , 500, "Breadstick_Raspberry", 16, "boot2_w25q080_2_padded_checksum", board_url="https://shop.breadstick.ca/products/raspberry-breadstick-rp2040")
# BridgeTek
MakeBoard("bridgetek_idm2040-7a", "BridgeTek", "IDM2040-7A", "0x2e8a", "0x1041", 250, "BRIDGETEK_IDM2040-7A", 8, "boot2_w25q080_2_padded_checksum", ["FT8XX_TYPE=BT817", "DISPLAY_RES=WVGA", "PLATFORM_RP2040"])
MakeBoard("bridgetek_idm2040_7a", "BridgeTek", "IDM2040-7A", "0x2e8a", "0x1041", 250, "BRIDGETEK_IDM2040_7A", 8, "boot2_w25q080_2_padded_checksum", ["FT8XX_TYPE=BT817", "DISPLAY_RES=WVGA", "PLATFORM_RP2040"])
MakeBoard("bridgetek_idm2040_43a", "BridgeTek", "IDM2040-43A", "0x2e8b", "0xf00a", 250, "BRIDGETEK_IDM2040_43A", 8, "boot2_w25q080_2_padded_checksum", ["FT8XX_TYPE=BT883", "DISPLAY_RES=WQVGA", "PLATFORM_RP2040"])
# Cytron
MakeBoard("cytron_maker_nano_rp2040", "Cytron", "Maker Nano RP2040", "0x2e8a", "0x100f", 250, "CYTRON_MAKER_NANO_RP2040", 2, "boot2_w25q080_2_padded_checksum")
MakeBoard("cytron_maker_pi_rp2040", "Cytron", "Maker Pi RP2040", "0x2e8a", "0x1000", 250, "CYTRON_MAKER_PI_RP2040", 2, "boot2_w25q080_2_padded_checksum")
@@ -431,6 +439,9 @@ MakeBoard("DudesCab", "L'atelier d'Arnoz", "DudesCab", "0x2e8a", "0x106F", 250,
# ElectronicCat
MakeBoard("electroniccats_huntercat_nfc", "ElectronicCats", "HunterCat NFC RP2040", "0x2E8A", "0x1037", 500, "ELECTRONICCATS_HUNTERCAT_NFC", 2, "boot2_w25q080_2_padded_checksum")
# EVN
MakeBoard("evn_alpha", "EVN", "Alpha", "0x2e8a", "0xf00a", 500, "EVN_ALPHA", 16, "boot2_generic_03h_2_padded_checksum", board_url="https://coresg.tech/evn")
# ExtremeElectronics
MakeBoard("extelec_rc2040", "ExtremeElectronics", "RC2040", "0x2e8a", "0xee20", 250, "EXTREMEELEXTRONICS_RC2040", 2, "boot2_w25q080_2_padded_checksum")
@@ -476,6 +487,9 @@ MakeBoard("pimoroni_pga2040", "Pimoroni", "PGA2040", "0x2e8a", "0x1008", 250, "P
MakeBoard("pimoroni_plasma2040", "Pimoroni", "Plasma2040", "0x2e8a", "0x100a", 500, "PIMORONI_PLASMA2040", 2, "boot2_w25q080_2_padded_checksum")
MakeBoard("pimoroni_tiny2040", "Pimoroni", "Tiny2040", "0x2e8a", "0x100a", 500, "PIMORONI_TINY2040", 2, "boot2_w25q64jv_4_padded_checksum")
#Pintronix
MakeBoard("pintronix_pinmax", "Pintronix", "PinMax", "0x2e8a", "0x9101", 250, "PINTRONIX_PINMAX", 4, "boot2_w25q080_2_padded_checksum")
# RAKwireless
MakeBoard("rakwireless_rak11300", "RAKwireless", "RAK11300", "0x2e8a", "0x00c0", 500, "RAKWIRELESS_RAK11300", 2, "boot2_w25q16jvxq_4_padded_checksum", None, "https://store.rakwireless.com/products/wisduo-lpwan-module-rak11300")
@@ -529,5 +543,5 @@ MakeBoard("wiznet_5500_evb_pico", "WIZnet", "W5500-EVB-Pico", "0x2e8a", "0x1029"
MakeBoard("generic", "Generic", "RP2040", "0x2e8a", "0xf00a", 250, "GENERIC_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
sys.stdout.close()
with open(os.path.abspath(os.path.dirname(__file__)) + '/../package/package_pico_index.template.json', 'w') as f:
with open(os.path.abspath(os.path.dirname(__file__)) + '/../package/package_pico_index.template.json', 'w', newline='\n') as f:
f.write(json.dumps(pkgjson, indent=3))
+4 -1
View File
@@ -190,7 +190,10 @@ else:
"-iprefix" + os.path.join(FRAMEWORK_DIR),
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "platform_inc.txt")
])
env.Append(ASFLAGS=[
"-iprefix" + os.path.join(FRAMEWORK_DIR),
"@%s" % os.path.join(FRAMEWORK_DIR, "lib", "platform_inc.txt")
])
def configure_usb_flags(cpp_defines):
if "USE_TINYUSB" in cpp_defines:
+5
View File
@@ -41,4 +41,9 @@
#define SPI_HOWMANY (1u)
#define WIRE_HOWMANY (1u)
// D pins
#define __PIN_D4 (6u)
#define __PIN_D5 (7u)
#define __PIN_D6 (8u)
#include "../generic/common.h"
@@ -40,4 +40,16 @@
#define SPI_HOWMANY (1u)
#define WIRE_HOWMANY (2u)
// D pins
#define __PIN_D2 (12u)
#define __PIN_D3 (5u)
#define __PIN_D4 (4u)
#define __PIN_D5 (14u)
#define __PIN_D7 (6u)
#define __PIN_D9 (7u)
#define __PIN_D10 (8u)
#define __PIN_D11 (9u)
#define __PIN_D12 (10u)
#define __PIN_D13 (11u)
#include "../generic/common.h"
+40
View File
@@ -0,0 +1,40 @@
#pragma once
// LEDs
#define PIN_LED (24u)
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
// TMC UART
#define PIN_SERIAL2_TX (4u)
#define PIN_SERIAL2_RX (5u)
// SPI
#define PIN_SPI1_MISO (31u)
#define PIN_SPI1_MOSI (31u)
#define PIN_SPI1_SCK (31u)
#define PIN_SPI1_SS (31u) // not pinned out
// Not pinned out
#define PIN_SPI0_MISO (31u)
#define PIN_SPI0_MOSI (31u)
#define PIN_SPI0_SCK (31u)
#define PIN_SPI0_SS (31u)
// Wire
#define PIN_WIRE0_SDA (31u)
#define PIN_WIRE0_SCL (31u)
// Not pinned out
#define PIN_WIRE1_SDA (31u)
#define PIN_WIRE1_SCL (31u)
#define SERIAL_HOWMANY (2u)
#define SPI_HOWMANY (0u)
#define WIRE_HOWMANY (0u)
#include "../generic/common.h"
+40
View File
@@ -0,0 +1,40 @@
#pragma once
// LEDs
#define PIN_LED (24u)
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
// TMC UART
#define PIN_SERIAL2_TX (4u)
#define PIN_SERIAL2_RX (5u)
// SPI
#define PIN_SPI1_MISO (31u)
#define PIN_SPI1_MOSI (31u)
#define PIN_SPI1_SCK (31u)
#define PIN_SPI1_SS (31u) // not pinned out
// Not pinned out
#define PIN_SPI0_MISO (31u)
#define PIN_SPI0_MOSI (31u)
#define PIN_SPI0_SCK (31u)
#define PIN_SPI0_SS (31u)
// Wire
#define PIN_WIRE0_SDA (28u)
#define PIN_WIRE0_SCL (29u)
// Not pinned out
#define PIN_WIRE1_SDA (31u)
#define PIN_WIRE1_SCL (31u)
#define SERIAL_HOWMANY (2u)
#define SPI_HOWMANY (0u)
#define WIRE_HOWMANY (1u)
#include "../generic/common.h"
+59
View File
@@ -0,0 +1,59 @@
#pragma once
// LEDs
#define PIN_LED (5u)
// NeoPixel
#define PIN_NEOPIXEL (5u)
#define NEOPIXEL_POWER (20u)
// CAN bus
#define PIN_CAN_CS (9u)
#define PIN_CAN_INTERRUPT (29u)
//Accelerometer
#define PIN_LIS_CS (1u)
#define PIN_LIS_INTERRUPT1 (23u)
#define PIN_LIS_INTERRUPT1 (25u)
//MAX31865
#define PIN_MAX31865_CS (24u)
// Serial
#define PIN_SERIAL1_TX (20u)
#define PIN_SERIAL1_RX (31u)
// Not pinned out
#define PIN_SERIAL2_TX (31u)
#define PIN_SERIAL2_RX (31u)
// Shared between LIS2D and MAX31865
#define PIN_SPI0_MISO (0u)
#define PIN_SPI0_MOSI (3u)
#define PIN_SPI0_SCK (2u)
#define PIN_SPI0_SS (1u)
#define __SPI0_DEVICE spi1
// CAN
#define PIN_SPI1_MISO (11u)
#define PIN_SPI1_MOSI (8u)
#define PIN_SPI1_SCK (10u)
#define PIN_SPI1_SS (31u)
#define __SPI1_DEVICE spi0
// Wire
#define PIN_WIRE0_SDA (31u)
#define PIN_WIRE0_SCL (31u)
#define __WIRE0_DEVICE i2c1
#define PIN_WIRE1_SDA (31u)
#define PIN_WIRE1_SCL (31u)
#define __WIRE1_DEVICE i2c0
#define SERIAL_HOWMANY (1u)
#define SPI_HOWMANY (2u)
#define WIRE_HOWMANY (0u)
#include "../generic/common.h"
@@ -0,0 +1,40 @@
#pragma once
// LEDs
#define PIN_LED (24u)
#define PIN_SERIAL1_TX (0u)
#define PIN_SERIAL1_RX (1u)
// TMC UART
#define PIN_SERIAL2_TX (4u)
#define PIN_SERIAL2_RX (5u)
// SPI
#define PIN_SPI1_MISO (31u)
#define PIN_SPI1_MOSI (31u)
#define PIN_SPI1_SCK (31u)
#define PIN_SPI1_SS (31u) // not pinned out
// Not pinned out
#define PIN_SPI0_MISO (31u)
#define PIN_SPI0_MOSI (31u)
#define PIN_SPI0_SCK (31u)
#define PIN_SPI0_SS (31u)
// Wire
#define PIN_WIRE0_SDA (28u)
#define PIN_WIRE0_SCL (29u)
// Not pinned out
#define PIN_WIRE1_SDA (31u)
#define PIN_WIRE1_SCL (31u)
#define SERIAL_HOWMANY (2u)
#define SPI_HOWMANY (0u)
#define WIRE_HOWMANY (1u)
#include "../generic/common.h"

Some files were not shown because too many files have changed in this diff Show More