Commit Graph

537 Commits

Author SHA1 Message Date
Scott Shawcroft 6e7e703f89
Fix RP2 countio reset
Fixes #5251
2021-08-27 17:39:19 -07:00
Scott Shawcroft 3e9daeca8f
Merge pull request #5244 from dhalbert/stop-pio-on-deinit
Stop StateMachine explicitly on deinit
2021-08-27 08:59:04 -07:00
Scott Shawcroft 8edf0c5d3c
Merge pull request #5243 from dhalbert/user-interruptible-pio
Allow PIO to be user-interruptible
2021-08-27 08:57:08 -07:00
Pierre Constantineau ada178893d updated PID as per OpenMoko PR 2021-08-27 09:02:49 -06:00
Dan Halbert 09897dbc82
Merge pull request #5238 from tannewt/fix_rp2_usb
Fix usb irq race
2021-08-27 10:40:06 -04:00
Dan Halbert 0261cacb06 Stop StateMachine explicitly on deinit 2021-08-27 10:07:14 -04:00
Dan Halbert f1d25af7ba Allow PIO to be user-interruptible 2021-08-27 08:38:51 -04:00
Pierre Constantineau e07bce2bf1 fixing trailing space 2021-08-27 00:25:22 -06:00
Pierre Constantineau 873729149d adding EncodderPad RP2040 2021-08-26 23:08:10 -06:00
Neradoc 4d05bb26bf change board.ID to board.board_id 2021-08-26 23:11:55 +02:00
Neradoc b14b294516 add board.ID 2021-08-26 23:11:55 +02:00
Scott Shawcroft 9663a227a3
Fix usb irq race
Run the USB background once after we hook our IRQ up in case we
missed one.

Related to #5212
2021-08-26 10:20:26 -07:00
Jeff Epler bef07961ab raspberrypi: audiopwmout: subtle for #5092
I noticed that the loop over 65535 possible denominators took a long time,
causing up to 100ms wait for a sound sample to start playing!

This algorithm, adapted from an algorithm shown in Python's fractions.py,
is guaranteed to find the best denominator in a small number of steps
(I think log2-many steps but I'm not sure). In practice, it means the time
between samples playing is just 10ms, and some of that is recreating the
sine wave sample in Python each time.

It often finds the same solution as the old code, but sometimes it finds
one a bit better since it compares the ratios using float point instead
of integer arithmetic.
2021-08-24 16:33:20 -05:00
Jeff Epler 77b0c76a37 raspberrypi: audiopwmout: simple fix for #5092 2021-08-24 15:54:06 -05:00
microDev 2e41550770
Merge pull request #5210 from DavePutz/issue_5091
Change optimizer option so RP2040 DEBUG builds work
2021-08-24 12:24:01 +05:30
root 0e3aa27794 Change optimizer option so RP2040 DEBUG builds work 2021-08-23 21:37:34 -05:00
Scott Shawcroft 6d49a9f0c5
Merge pull request #5205 from jepler/deprecate-vertical-scroll
Deprecate Display's constructor arg set_vertical_scroll
2021-08-23 12:52:12 -07:00
Scott Shawcroft 935888927e
Merge pull request #5196 from dhalbert/samd-audio-fixes
improve SAMD audio DMA
2021-08-23 10:27:59 -07:00
Jeff Epler 379461df7d Deprecate Display's constructor arg set_vertical_scroll 2021-08-23 09:17:59 -05:00
Dan Halbert b8b23c97d9 improve SAMD audio DMA 2021-08-21 14:34:37 -04:00
microDev f6d1caabc9
Merge pull request #5182 from tannewt/fix_imx
Check background pending before sleep
2021-08-21 08:00:10 +05:30
Dan Halbert 419d374d3c
Merge pull request #5181 from kattni/macropad-speaker-enable
Add SPEAKER_ENABLE to MacroPad
2021-08-19 19:32:28 -04:00
Kattni Rembor 1185228b90 Remove SPEAKER_SHUTDOWN pin. 2021-08-19 15:18:19 -04:00
Scott Shawcroft d2860b58b0
Check background pending before sleep
There is a race between when we run background tasks and when we
sleep. If an interrupt happens between the two, then we may delay
executing the background task. On some ports we checked this for
TinyUSB already. On iMX RT, we didn't which caused USB issues.
This PR makes it more generic for all background tasks including
USB.

Fixes #5086 and maybe others.
2021-08-19 12:18:13 -07:00
Kattni Rembor ae923db06d Add SPEAKER_ENABLE pin to MacroPad. 2021-08-18 17:30:42 -04:00
Scott Shawcroft 0390f812be
Fix RP2040 I2C instance check 2021-08-18 08:55:52 -07:00
Scott Shawcroft a5143d284b
Merge pull request #5161 from ZodiusInfuser/patch_micropy
Removed unnecessary defines from Pimoroni board files
2021-08-17 12:40:12 -07:00
Scott Shawcroft abe8638f41
Merge pull request #5160 from ZodiusInfuser/patch_tiny2040
Removed default UART, SPI and I2C from Tiny2040 config
2021-08-16 14:54:52 -07:00
ZodiusInfuser 2255ab1486 Removed unnecessary Micropy and Ignore defines 2021-08-16 16:40:12 +01:00
ZodiusInfuser 5fb507c3ff Removed default UART SPI and I2C from Tiny2040 config 2021-08-16 16:31:31 +01:00
Scott Shawcroft de796e2304
Move OneWire to `onewireio` from `busio`
This will allow finer grained inclusion in 8.0.0

Fixes #5135
2021-08-12 10:47:14 -07:00
Scott Shawcroft 9c77d2653f
Merge pull request #5099 from ZodiusInfuser/main
Added definitions for some upcoming Pimoroni LED driver boards
2021-08-12 09:27:21 -07:00
ZodiusInfuser 47c8ff0570 Removed unnecessary defines 2021-08-11 23:34:20 +01:00
Scott Shawcroft 0632a1e681
Merge pull request #5060 from cdwilson/cdwilson/circuitpython/sparkfun-stm32f405-micromod
stm/boards: Add support for SparkFun STM32 MicroMod Processor board.
2021-08-11 12:19:16 -07:00
Dan Halbert 4608877c12 address review comments 2021-08-11 12:10:49 -04:00
Dan Halbert 35aac3d26b display SPI now 10MHz; set PWM duty cycle to zero at stop to quiet output 2021-08-11 10:48:53 -04:00
Dan Halbert 24e61a7da8 Track more carefully which audio buffers to fill, based on interrupt channels 2021-08-10 22:00:09 -04:00
ZodiusInfuser e587bd7dc0 Added final USB PIDs 2021-08-10 11:17:06 +01:00
Chris Wilson e741330ca8 Consistent pin naming for SparkFun MicroMod processor boards. 2021-08-09 23:10:52 -07:00
Dan Halbert 2451c788f4 valid channels in audio_dma_stop; cleaner supervisor_ticks mgmt in keypad 2021-08-09 09:47:13 -04:00
Dan Halbert 59b89fdc5c Fix various audio DMA issues:
RP2040 and SAMD51:
- Detect when DMA has finished, and stop DMA audio explicitly.
- Do not accidentally reuse `first_buffer` supplied by WaveFile or RawSample. Always realloc `first_buffer` and `second_buffer`

RP2040:
- When audio playing is stopped, write a final zero to the output register. This prevents residual PWM tones.
- Handle buffer size for 8-bit samples properly for 16-bit output.
- Fail on some edge cases (which may not be possible at the moment).
2021-08-09 09:47:13 -04:00
Dan Halbert 2cd80d1074 wip, with debugging printf's 2021-08-09 09:47:13 -04:00
Dan Halbert fd71d924d2 partial buffer mgmt fix 2021-08-09 09:47:13 -04:00
ZodiusInfuser f707fa107a Tweaks to Interstate75 pinout 2021-08-05 15:00:47 +01:00
ZodiusInfuser 11ed759cf9 Tweaks to Plasma2040 pinout 2021-08-05 13:01:50 +01:00
Jeff Epler ac4b10bcd9 It's "shared-module", not "shared-modules" 2021-08-03 10:37:47 -05:00
ZodiusInfuser 6663dacedb Added board configurations for Plasma and Interstate 2021-08-03 14:01:56 +01:00
Dan Halbert a358e5f58a Add board-specific pico-sdk settings; set xosc multipler for Adafruit boards 2021-07-30 18:50:21 -04:00
Scott Shawcroft 9e54606ba1
Set output low in SIO 2021-07-28 09:00:36 -07:00
Scott Shawcroft 4be904fd4a
Switch to gpio mux to disable/enable pwm signal 2021-07-27 12:38:18 -07:00
Scott Shawcroft e87e1d8175
Block when setting duty_cycle until the new value is taken 2021-07-27 12:37:35 -07:00
Scott Shawcroft daf90aae83
Merge remote-tracking branch 'adafruit/main' into pulseout_switch 2021-07-26 18:48:59 -07:00
Scott Shawcroft 412eb87080
Switch to pin, frequency and duty_cycle PulseOut
Passing in a PWMOut still works but is deprecated. It will be
removed in CircuitPython 8.0.0

This also switches STM32 timer indices and channel indices to
0-based in our pin data rather than `- 1` everywhere. The latter is
more bug prone.

Most of the way for #3264

Tested on Metro M0, Metro M4, Feather S2, Feather nRF52840, Feather
STM32F4 and Arduino RP2040.
2021-07-26 18:35:49 -07:00
Tod Kurt 0d401e7bc8 fix whitespace on new flash chip for Arduino Nano RP2040 2021-07-24 13:22:02 -07:00
Tod Kurt dcd5b5ab50 added Arduino Nano RP2040 Connect alternate flash chip 2021-07-24 13:12:44 -07:00
Nathan Young 04ce6a6e8c Check jmp_pin specified when JMP PIN opcodes used 2021-07-23 13:35:20 +02:00
Nathan Young 8221a12cf6 Added support for specifying the JMP pin (RP2 PIO) 2021-07-22 18:39:04 +02:00
Scott Shawcroft 109bd2886b
Fix Arduino RP2040 flash size
For RP2040 boards, we now change the default flash size based on
the configured flash. We will still try to read the size from the
flash first.

Fixes #4874
2021-07-21 11:02:55 -07:00
Scott Shawcroft 8723a0335f
Merge pull request #5032 from DavePutz/multi_pulseout
Moved global variables to support multiple RP2040 PulseOuts
2021-07-21 10:26:17 -07:00
Scott Shawcroft e14923028f
Merge pull request #5030 from dhalbert/update-to-raspberrypi-pico-sdk-1.2.0
Update pico-sdk to 1.2.0, using raspberrypi repo
2021-07-21 08:14:13 -07:00
root b2d6203c63 fix formatting 2021-07-21 10:05:09 -05:00
root 0559fcd1c0 Moved global variables to support multiple PulseOuts 2021-07-21 09:52:17 -05:00
Scott Shawcroft db0adf1253
Merge pull request #5025 from DavePutz/issue_5016
Turn off PWM pin during PulseOut construct
2021-07-20 17:25:10 -07:00
root 8fe4fa0114 Turn off PWN pin during PulseOut construct 2021-07-20 17:17:41 -05:00
Dan Halbert 0293ec261a Update pico-sdk to 1.2.0, using raspberrypi repo 2021-07-20 17:31:29 -04:00
Dan Halbert 128bedae7e
Merge pull request #5019 from DavePutz/issue_5016
Ensure RP2040 pin is left low after PulseOut
2021-07-19 17:57:42 -04:00
Dan Halbert d2f2afe57b
Merge pull request #4925 from microDev1/update-run-mode
Add RunMode.UF2 and update esp32s2 run-modes
2021-07-19 16:37:46 -04:00
root 8d79d4e5ee Ensure pin is left low after PulseOut 2021-07-19 11:46:09 -05:00
microDev 3c25d8e2a0
Merge pull request #5013 from DavePutz/issue_5012
Issue #5012 - RP2040 moved globals to PulseIn object to fix multiple instances
2021-07-19 00:21:55 +05:30
root 43275e0b0d Made suggested changes (mostly) 2021-07-18 12:00:37 -05:00
microDev 9ac607dffa
update run-mode
- add microcontroller.RunMode.UF2
- add UF2, NORMAL and BOOTLOADER run-modes to esp32s2
2021-07-18 00:00:58 +05:30
root 1c80696746 iFix formatting 2021-07-16 17:18:06 -05:00
root 588a19a1ab Issue #5012 - Moved globals to PulseIn object to fix multiple instances 2021-07-16 15:59:08 -05:00
Scott Shawcroft bba611336c
Merge pull request #4964 from DavePutz/issue_4937
Fix for issue #4937 - Implement minimum PulseOut time
2021-07-16 11:29:32 -07:00
root eebddbb16d Change min pulse calculation 2021-07-15 21:27:23 -05:00
Scott Shawcroft c2685970af
Merge pull request #4987 from DavePutz/issue_4983
Fix for Issue #4983 - stop state machine before restarting
2021-07-13 12:16:33 -07:00
root 5c9823d8cb Change order of operations in restart 2021-07-13 11:17:03 -05:00
root 490f263a41 Added code to reset SM program counter during a restart 2021-07-12 14:09:11 -05:00
root 9d5fbea7a3 Fix for Issue #4983 - stop state machine before restarting 2021-07-11 21:02:28 -05:00
root 0ea750b2d0 Fix handling of short pulses 2021-07-11 16:38:24 -05:00
DavePutz 25e799e51a
Add LED and GP25 for Cytron Maker Pi Pico 2021-07-09 20:49:59 -05:00
Scott Shawcroft 58fdf9e940
Merge pull request #4975 from DavePutz/issue_4945
Issue #4945 - handle multiple PulseIns
2021-07-09 11:03:16 -07:00
root 4046b0fb0a Issue #4945 - handle multiple PulseIns 2021-07-08 14:09:21 -05:00
Dan Halbert ab52a92704 Disallow ctrl-C interrupts of RP2040 SPI and PIO 2021-07-08 13:42:24 -04:00
Dan Halbert a843b8a0d4 Merge remote-tracking branch 'adafruit/main' into rp2040-audio-and-spi-fixes 2021-07-08 08:22:21 -04:00
Dan Halbert bd6826496c Fix various RP2040 audio dma things: (see detailed commit message)
1. Check for correct error values from dma_claim_unused_channel.
2. Introduce a .stereo flag for simplicity.
3. Clarify PWM carrier frequency choice.
4. Start introducing quiescent audio value. Still need to ramp up/down.
5. Redo audio stop logic a bit.
6. Fix (unrelated) displayio dependency things.

There is still an interference problem between other DMA users and audio. Still debugging this.
2021-07-08 08:14:49 -04:00
root f98ec0cfd6 Fix formatting 2021-07-06 14:43:46 -05:00
root bfa777c55a Add check for timer success 2021-07-06 14:34:15 -05:00
Daniel Griswold 2519b06478 fix spi definition 2021-07-06 01:15:32 -04:00
root b2e72b2912 fix formatting 2021-07-05 23:13:18 -05:00
root 6e4613f1a1 Fix formatting 2021-07-05 12:30:26 -05:00
root 9814386d2e Fix for issue #4937 - Implement minimum pulseout time 2021-07-05 11:38:05 -05:00
Dan Halbert 33bbb8b1f4 RP2040 PWMAudioOut: Release DMA channels after play has finished. 2021-07-01 17:36:29 -04:00
Radomir Dopieralski b8c4f7d685 MacroPad RP2040: Add initialization for the OLED display 2021-06-29 17:38:14 +02:00
Kattni Rembor 2c2d541e7c Adding pins to match silk and other RP2040 boards. 2021-06-28 17:10:15 -04:00
Scott Shawcroft 061d3a16ff
Merge pull request #4911 from DavePutz/issue_4908
Fix for issue #4908 - pulseout leaving line high
2021-06-24 15:32:48 -07:00
Dan Halbert 836db4e4a1
Merge pull request #4816 from hierophect/rp2040-alarms
RP2040: add Alarm module
2021-06-24 08:15:57 -04:00
root ab1d7429f1 Fix for issue #4908 - pulseout leaving line high 2021-06-23 21:09:27 -05:00
Lucian Copeland 1f3d69d87c Clean up sleep memory, mark as not-implemented 2021-06-20 17:57:51 -04:00
Jeff Epler 268717e427 ParallelImageCapture: Switch to taking a list of pins
.. adopting validate_pins from RGBMatrix into shared-bindings

.. updating other platforms for API change
2021-06-10 11:15:18 -05:00
Ben Clifford 5c835adb10 Correct pull-down direction in parameter documentation for rp2pio 2021-06-09 20:39:56 +00:00
Limor "Ladyada" Fried c1c101ca2d
Merge pull request #4864 from ladyada/main
macropad rev B definion and fix for SH110x addressing
2021-06-07 21:59:56 -04:00
Lucian Copeland b6a268fca4 Further deinit additions 2021-06-07 14:13:59 -04:00
Lucian Copeland 63c1791d87 Merge remote-tracking branch 'upstream/main' into rp2040-alarms 2021-06-07 14:11:41 -04:00
Lucian Copeland f2149edbd2 Add deinit to new boards 2021-06-07 12:48:12 -04:00
lady ada 2ff9e9766f handclang 2021-06-07 12:39:59 -04:00
Limor "Ladyada" Fried c4f685aab1
Merge pull request #4865 from ZodiusInfuser/pimoroni_boards
Added definition for upcoming Pimoroni RP2040 board
2021-06-07 11:13:01 -04:00
lady ada 3890271f19 turn off all neopix when booting 2021-06-06 18:30:17 -04:00
lady ada 01195c2089 update to rev B 2021-06-06 15:57:41 -04:00
Scott Shawcroft bc014cecb5
Merge pull request #4859 from DavePutz/hcsr04_fix
Fix pulsein pause and resume functions to handle HCSR04
2021-06-04 13:26:05 -07:00
root 57334c812e Fix pulsein pause and resume functions to handle HCSR04 2021-06-04 12:10:41 -05:00
ZodiusInfuser af7557b53b
Updated with final USB PID 2021-06-04 16:02:32 +01:00
Jeff Epler a99eba35b8
Merge pull request #4809 from DavePutz/issue_4266
Fix for Issue #4266 - second PWMAudioOut interferes with the first one
2021-06-03 19:08:28 -05:00
ZodiusInfuser 6011db3aec Added board definition 2021-06-03 15:49:23 +01:00
Dan Halbert 6af36757a7 lengthen RP2040 xosc startup time 2021-06-02 08:50:20 -04:00
root 8761e4bfd7 Initialize pacing timer 2021-05-30 12:12:38 -05:00
Kong Wai Weng b06ec0a776 Added libraries dependency. 2021-05-30 09:57:00 +08:00
root a2b220370e Fix formatting issue 2021-05-29 12:26:41 -05:00
root 760e8c77bd Changes to correct repeat playing on a channel 2021-05-29 11:55:10 -05:00
Kong Wai Weng ebe4d90ac3 Updated the copyright information. 2021-05-29 10:12:22 +08:00
Lucian Copeland feff243e8f Add RTC deep sleep alarm support 2021-05-28 13:52:05 -04:00
Kong Wai Weng ebda9e07f4 Use 4 spaces instead of tab. 2021-05-29 01:04:13 +08:00
Kong Wai Weng bfcb8c5896 Do not use neopixel as status LED. Also removed the unused definition. 2021-05-29 00:47:14 +08:00
Kong Wai Weng 5920ac647a Modified the essential files for Maker Pi RP2040. 2021-05-28 22:42:54 +08:00
Kong Wai Weng 321e5dd16f Use underscore instead of dash for board name. 2021-05-28 18:01:02 +08:00
Lucian Copeland 24041f34b0 Merge remote-tracking branch 'upstream/main' into rp2040-alarms 2021-05-27 18:40:40 -04:00
Lucian Copeland 8e1892ac6f Implement RP2040 Alarm module
Adds light and deep sleep functionality for the TimeAlarm and PinAlarm
alarm categories. Adds board deinit for all platforms.
2021-05-27 18:33:29 -04:00
Kong Wai Weng da7c74f614 Initial commit. 2021-05-27 18:02:52 +08:00
root 24e641a834 Fix for Issue #4266 2021-05-25 16:06:00 -05:00
Scott Shawcroft 038c9d6194
Merge pull request #4796 from Neradoc/nera-pwmrgb-status-pimoroni
Enable the PWM status LED on Pimoroni Tiny 2040 and PicoSystem
2021-05-24 13:30:55 -07:00
lady ada 2e90d5ed07 clang a bit 2021-05-22 12:39:42 -04:00
lady ada d52f149e84 add ESP CS pin to make wifi demos easier 2021-05-22 12:22:28 -04:00
lady ada ac855afb48 Some pin neatening and updated PID to unused Adafruit one! 2021-05-22 11:57:46 -04:00
BlitzCityDIY 14dbec7c04 Merge branch 'main' of https://github.com/blitzcitydiy/circuitpython into main 2021-05-22 01:02:21 -04:00
BlitzCityDIY 9f4eb48e70 Updating MISO
While testing WIFI realized MISO was defined incorrectly
2021-05-22 01:02:06 -04:00
BlitzCityDIY 352281e23e Adding Arduino Nano RP2040 Connect
Re-commiting to fix local GitHub config issues. Adding CircuitPython support for the Arduino Nano RP2040 Connect. Have tested all digital and analog I/O, I2C, onboard LSM6DSOX. Uses the AT25SF128A external flash.
2021-05-21 20:44:11 -04:00
Neradoc 6808d04d53 enable the PWM status LED on Pimonoroni Tiny 2040 and PicoSystem 2021-05-21 20:13:30 +02:00
Scott Shawcroft 5643355e90
Merge remote-tracking branch 'adafruit/main' into simplify_status_led 2021-05-20 08:35:15 -07:00
Scott Shawcroft 642fbcf87a
Handle status led power
This no longer turns on status LED power before running user code.
Therefore, use of the status LED on some boards will also have to
enable the power.
2021-05-19 10:57:14 -07:00
Scott Shawcroft 9dabe882f1
Fix safe mode on rp2040 2021-05-19 10:18:43 -07:00
Limor "Ladyada" Fried b667736110 Merge branch 'adafruit:main' into main 2021-05-18 20:55:55 -04:00
lady ada d8b895f1d7 add LED and speaker - natch! 2021-05-18 20:53:13 -04:00
ladyada cec9015e19 iz makropad with oled 2021-05-18 11:09:03 -04:00
root 9393467819 Update comment for spelling 2021-05-17 22:13:00 -05:00
root ff4b1b28d2 iFormatting fixes 2021-05-17 16:43:55 -05:00
root 11ef36d09d Implement pulseout for RP2040 2021-05-17 16:24:45 -05:00
Scott Shawcroft 689ec86225
Merge pull request #4754 from dhalbert/fix-endpoint-checking
Fix endpoint checking; Clean up safe mode printing
2021-05-14 11:25:01 -07:00
Dan Halbert fa6c06fb38 count in/out endpoints; allow more usb modules on low-endpoint boards 2021-05-13 21:59:02 -04:00
Scott Shawcroft 1a0b4193b7
Simplify the status LED to save power
This also removes the need to pin share because we don't use the
status LED while user code is running.

The status flashes fallback to the HW_STATUS LED if no RGB LED is
present. Each status has a unique blink pattern as well.

One caveat is the REPL state. In order to not pin share, we set the
RGB color once. PWM and single color will be shutoff immediately but
DotStars and NeoPixels will hold the color until the user overrides
it.

Fixes #4133
2021-05-13 14:41:20 -07:00
lady ada 502b66eac0 moar trinkz 2021-05-11 22:03:05 -04:00