Commit graph

43 commits

Author SHA1 Message Date
Earle F. Philhower, III
e93bd14ef5
Generate warnings if Pico STDIO init called (#1467)
Warn the user that the Pico SDK STDIO calls (stdio_init_all, stdio_usb_init,
stdio_uart_init) are not supported or needed at compile time.  See multiple
issues #1433 #1347 #1273 #1251 and others.
2023-05-23 17:28:57 -07:00
Earle F. Philhower, III
b57ac66815
Cleanup legacy includes (#1452) 2023-05-16 23:47:17 -07:00
Earle F. Philhower, III
71238ccd74
Clean up CoreMutex and __isFreeRTOS definition (#1312)
See #1311 for more info.  __isFreeRTOS is C++ linkage and only used
in the core proper (all C++).
2023-03-16 14:42:28 -07:00
Earle F. Philhower, III
d619bf0bc1
More minor ESP8266 compatibility tweaks (#1131) 2023-01-20 17:06:40 -08:00
Earle F. Philhower, III
94abf9d19f
Move analogReadTemp() to C++-only (#1097)
Now that we have a default parameter, need to only allow it in C++ since
default values are not part of C spec.  Should not affect any users since
only legacy code is in C.
2023-01-03 13:30:11 -08:00
Axotron
1e2f1a19ff
Adding sei() and cli() as aliases for interrupts() and noInterrupts(). (#1089) 2023-01-01 14:18:06 -08:00
neilger
b8906e0a83
digitalRead/WriteFast to sio_hw->gpio (#1077) 2022-12-30 09:09:04 -08:00
NuclearPhoenix
729360379f
Universal analogReadTemp() (#1075) 2022-12-29 10:33:49 -08:00
Earle F. Philhower, III
47b18ea84a
Add digitalWrite/ReadFast macros (#1069)
* Add digitalWrite/ReadFast macros

Fix #1067

* Update using @neilger's macros
2022-12-28 11:08:18 -08:00
Earle F. Philhower, III
0edba2ee2a
Add WebServer, WebServerSecure, HTTPUpdateServer, HTTPUpdateServerSecure (#791)
* Add HTTP-parser lib to support ESP32 WebServer
* Add WebServer from ESP32.  Only supports HTTP
* Separate HTTP server from the network server
Instead of managing the WiFiServer/WiFiServerSecure in the same object
as the HTTP handling, split them into separate objects.  This lets
HTTP and HTTPS servers work without templates or duplicating code.
The HTTP block just gets a `WiFiClient*` and works with that to only
do HTTP processing, while the upper object handles the appropriate
server and client types.
* Add HTTPS server
* Clean up some THandlerFunction refs
* Refactor into a template-ized WebServer/WebServerSecure
* Add DNSServer examples which need WebServer
* Fix CoreMutex infinite recursion crash
Core could crash while Serial debugging was going on and prints were
happening from LWIP/IRQ land and the main app.
* Add HTTPUpdateServer(Secure)
* Add MIME include, optimize WebServer::send(size,len)
When send()ing a large buffer, the WebServer::send() call would
actually convert that buffer into a String (i.e. duplicate it, and
potential issues with embedded \0s in binary data).
Make a simple override to send(size, len) to allow writing from the
source buffer instead.
* Fix WiFiClient::send(Stream), add FSBrowser example
2022-08-23 15:51:32 -07:00
Earle F. Philhower, III
abf2c586c7
Add Pico W WiFi support (#670)
* Add support for the WiFi chip on the Pico W board.
* USB interrupt now no longer hard coded (conflicted with the WiFi IRQ).
* Add in Pico W board to makeboards.py
* Add in GPIO and variant support
* Initialize WiFi in the Variant
* Use manual LWIP, fix size accounting
* Remove the SDK WiFi overrides
* Pulling in work done in the ESP8266 core.
* Make IPAddress support IPv6
* Build LWIP with IPv4 and IPv6 support
* Use proper MAC
* Avoid cyw_warn crash.  Make macro to a comment while building
* Add WiFiServer
* Add WiFiUdp
* Move LWIP-specific support files to LWIP_Ethernet
* Add WiFi::ping (ICMP ping)
* Move ICMP echo (ping) to LWIPIntfDev
* Move hostByName to LwipIntfDev
* Add AP mode with simple DHCP server
* Add some examples and basic ESP8266 compat hacks
* Update Adafruit TinyUSB to fix crash
* Set DHCP hostname
* Make Wifi.begin() return CONNECTED with link + IP
* Return connected() on WiFi::begin
* Fix spurious TCP retransmission
* Protect LWIP from reentrancy

The Pico SDK calls "sys_check_timeouts() from inside a periodic interrupt.
This appears unsafe, as the interrupt could happen while already in the
(non-reentrant) LWIP code.

Block the interrupt from calling sys_check_timeouts by using a global flag
manually set via an RAII recursive lock.

Add interrupt protection macros around critical sections inside LWIP via
the standard defines.

These two changes should make LWIP significantly more stable and long
running.

* Support disconnecting and reconnecting WiFi
* Add WiFiServer simple example
* Update documentation

Fixes #666
Fixed #665
2022-07-15 16:47:53 -07:00
Earle F. Philhower, III
bda630e419
Add FreeRTOS support thanks to @hfellner (#533)
Using all the work from @hfellner and others, add FreeRTOS
SMP support.

Allow idling cores through the FreeRTOS FIFO queue to
allow for file system and EEPROM support.

Make delay a weak function so FreeRTOS can override.

Add cycle count support under FreeRTOS using a PIO SM.

Use a task-based approach for handling the USB periodic work
instead of the IRQ-based one in the main core.

Set 8 prio levels so it fits in 3 bits nicely (0..7).
2022-04-24 20:59:57 -07:00
Earle F. Philhower, III
01093482e7
Add script to update version number, new header (#506)
Define ARDUINO_PICO_MAJOR/_MINOR/_REVISION for app use and update the
Platform.IO and Arduino files for a new release version.

Fixes #309
Fixes #487
2022-03-06 11:04:19 -08:00
Earle F. Philhower, III
bbae702e9f
Add support for analogReadResolution, default 10b (#461)
Most other boards and the MBED RP2040 support analogReadResolution which
just shifts read data around as needed, with a default of only 10b of
resolution.  The Pico ADC technically supports 12b, but only has about
8b of real data after noise, so you're not really losing anything in the
general case.

Fixes #460
2022-02-05 10:10:45 -08:00
Earle F. Philhower, III
ce7d337c5c
Add SoftwareSerial-like PIO based UARTs (#391)
Adds support to the core for PIO-based, software-created UARTs, up to 8 (the number of PIO state machines) possible.

By using a custom program on the PIO state machines, it allows for very high bit rates and does not require CPU or interrupts.

Bit widths from 5- to 8-bits, 1 or 2 stop bits, and even/odd/none parity are supported.
2021-12-28 08:27:08 -08:00
Earle F. Philhower, III
85990ff51d
Support CMSIS and rename conflicting header file (#362) 2021-12-03 12:49:34 -08:00
Earle F. Philhower, III
9fbf6ab35d
Clean up Arduino.h header, remove duplicates (#205)
Many functions are defined inside the api/Common.h, so remove them from
the Arduino.h header to have them appear only once.

Fix up the abs() macro to avoid macro problems, add round()
2021-06-11 12:23:23 -07:00
Earle F. Philhower, III
8016a932f3
Add astyle format, boards.txt, and package check (#166)
Miscellaneous CI checks for code style, boards.txt update, and that all
referenced packages are available.
2021-05-24 15:01:03 -07:00
Earle F. Philhower, III
10a44c83f1
Add quasi-sane abs() implementation to Arduino.h (#157)
As mentioned in https://github.com/earlephilhower/arduino-pico/discussions/156#discussion-3376456
2021-05-21 15:32:31 -07:00
Earle F. Philhower, III
052331168e
Fix repo spelling issues (#152) 2021-05-19 18:03:12 -07:00
Ha Thach
f8a2f38fe7
Port Adafruit_TinyUSB_Arduino lib (#127)
* initial tinyusb lib port

* add Adafruit_TinyUSB_Arduino as submodules

* add yield() to main loop

* sync with tinyusb lib latest

* add USB manufacturer and product

* fix typo in tinyusb lib

* sync with master

updating implementation

* Rationalize link stage command line

Make the build process less insane.

* clean up delay

* clean up platform and board

* update makeboards.py for generating usbstack menu

* update tinyusb lib to 1.0.0
2021-05-18 18:10:47 -07:00
Khoi Hoang
7dc0aa16ec
Add defs for compatibility (#142)
Add definitions for compatibility to many platforms and libraries
- clockCyclesPerMicrosecond()
- clockCyclesToMicroseconds(a)
- microsecondsToClockCycles(a)
2021-05-16 20:48:44 -07:00
Earle F. Philhower, III
f327e09e3e
Add stdlib_noniso.h to Arduino.h (#131)
Per #130 request, the dtostrf() definition and others were not visible.
2021-05-13 00:15:22 -07:00
Oğuzhan Başer
47915df2da
PWM functions definitions missing (#114)
* add keywords file

* Add PWM function definitions
2021-04-27 07:11:02 -07:00
Earle F. Philhower, III
b5aeb84cb3
Add NOT_AN_INTERRUPT define (#105)
Fix #104
2021-04-15 12:50:35 -07:00
Earle F. Philhower, III
8fed1ccf97
Add HAVE_HWSERIALX and api/dir to include path (#94)
Fixes #93
2021-04-08 05:43:51 -07:00
Earle F. Philhower, III
85a79104b6
Allow misaligned pgm_read_XXX macro reads (#81)
Update the ArduinoAPI with new macros/inlines that allow accessing
values that are not naturally aligned (i.e. an int at address 0x0001).

Fixes #79
2021-04-06 12:08:26 -07:00
Earle F. Philhower, III
96e31c640e
Add analogReadTemp() to get RP2040 core temp (#63) 2021-03-30 16:10:06 -07:00
Earle F. Philhower, III
d9a4bbd95c
Add ancient AVR compatibility macros (#59) 2021-03-30 11:57:01 -07:00
Earle F. Philhower, III
1124455627 Add BOOTSEL, allowing BOOTSEL use as a button
Since every board has a bootsel button, allow end users to read its
state with a simple `if (BOOTSEL)`.  Uses code from the pico-examples.
2021-03-29 16:14:45 -07:00
Earle F. Philhower, III
09b5693f32 Add attach/detachInterrupt support
Fixes #21
2021-03-25 20:01:48 -07:00
Earle F. Philhower, III
b463825374 Rationalize pin selection using readable template
Use a constexpr template to calculate the valid pins for different IO
hardware.  This lets us have an easily readable list of pin numbers that
we can adjust/check.
2021-03-25 17:54:46 -07:00
Earle F. Philhower, III
6adb1a641c Initial debugging framework 2021-03-17 10:54:13 -07:00
Earle F. Philhower, III
62508fa98c Use one program per PIO, not per SM. Add RP2040 utils 2021-03-16 16:57:22 -07:00
Earle F. Philhower, III
660fe19fec Fix Windows compile/elf2uf2 errors
Windows is case-insensitive, causing "String.h" to override "string.h" in
includes.  Adjust the platform.txt appropriately.

Rebuild elf2uf2 as static to avoid startup errors on Windows boxes w/o MinGW.
2021-03-16 08:53:50 -07:00
Earle F. Philhower, III
68b656a55e Update USB serial to be a HW Serial 2021-03-13 12:22:41 -08:00
Earle F. Philhower, III
b3dad2ba62 Cleanup, add licenses to all files 2021-03-05 22:09:05 -08:00
Earle F. Philhower, III
93d194b0ac Add hardware SPI support
SPI = spi0, SPI1 = spi1
2021-03-05 21:44:40 -08:00
Earle F. Philhower, III
ded383ed42 Use variants/generic to define pins 2021-02-26 13:05:29 -08:00
Earle F. Philhower, III
2c927d2bcb Add analogRead and A0...A3 pins 2021-02-26 12:42:59 -08:00
Earle F. Philhower, III
899f679986 Add millis() support 2021-02-25 19:04:15 -08:00
Earle F. Philhower, III
369dea88ba Add Serial(USB) support
Serial via USB /dev/ttyACM0 now works using standalone minicom terminal
app but not via the IDE's serial monitor.
2021-02-25 17:07:42 -08:00
Earle F. Philhower, III
44c586795b Initial commit, basic sanity
Some paths hardcoded to my custom toolchain build dir, will be updated
to a package.json tools setup soon.
https://github.com/earlephilhower/pico-quick-toolchain

Blink and Fade examples work (i.e. digitalWrite/analogWrite/delay).

Includes a discovery script which will detect RPI Picos in UF2 bootmode.
2021-02-24 20:31:13 -08:00