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
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
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
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
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
Lucian Copeland
63c1791d87
Merge remote-tracking branch 'upstream/main' into rp2040-alarms
2021-06-07 14:11: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
root
8761e4bfd7
Initialize pacing timer
2021-05-30 12:12:38 -05: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
Lucian Copeland
feff243e8f
Add RTC deep sleep alarm support
2021-05-28 13:52:05 -04: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
root
24e641a834
Fix for Issue #4266
2021-05-25 16:06:00 -05:00
Scott Shawcroft
5643355e90
Merge remote-tracking branch 'adafruit/main' into simplify_status_led
2021-05-20 08:35:15 -07: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
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
Jeff Epler
da19e8e2d7
Merge remote-tracking branch 'origin/main' into fix-codeformat-subdirs
2021-04-30 15:31:08 -05:00
Jeff Epler
e95e921ca1
codeformat: Fix filename matching
...
In #4683 , tannewt noticed that uncrustify was not running on some
file in common-hal.
I investigated and found that it was not being run on a bunch of paths.
Rather than make incremental changes, I rewrote list_files to work
bsaed on regular expressions; these regular expressions are created from
the same git-style glob patterns.
I spot-checked some specific filenames after this change, and all looks good:
```
$ python3 tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup extmod/virtpin.c ports/raspberrypi/background.h ports/raspberrypi/common-hal/pulseio/PulseIn.c
black --fast --line-length=99 -v tests/thread/thread_exit1.py
```
recursiveloop and int_small are excluded, while PulseIn, virtpin,
and background are included.
Testing running from a subdirectory (not _specifically_ supported though):
```
(cd ports && python3 ../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c)
../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup ../extmod/virtpin.c raspberrypi/common-hal/pulseio/PulseIn.
```
As a side-effect, a bunch more files are re-formatted now. :-P
2021-04-30 10:48:08 -05:00
DavePutz
1ec59cd534
Fix up indentation
2021-04-29 12:38:13 -05:00
root
cfac07c1cc
Wrap pulsein when maxlen is exceeded
2021-04-28 11:20:13 -05:00
Scott Shawcroft
f99deeda68
Merge pull request #4668 from DavePutz/issue_4659
...
Increased possible pulsein length to ~65 ms.
2021-04-27 11:01:51 -07:00
root
91739de71a
Increased max pulse to 65535 us
2021-04-26 18:52:15 -05:00
root
5bd1da21a2
Increased possible pulsein length to 32 ms.
2021-04-25 21:38:57 -05:00
Jeff Epler
92919c25c2
Merge pull request #4666 from DavePutz/issue_4660
...
Reset buffer index in PulseIn clear
2021-04-25 20:33:58 -05:00
root
d1861a6b9c
Reset buffer index in PulseIn clear
2021-04-25 14:24:21 -05:00
gamblor21
30f31639d3
Added statemachine deinit
2021-04-25 11:58:22 -05:00
Dan Halbert
80f05c76a8
Merge pull request #4654 from dhalbert/6.2.x-merge-1
...
Port #4645 to main
2021-04-24 10:29:52 -04:00
Dan Halbert
454e78f41f
merge #4645 from 6.2.x to main
2021-04-23 13:33:58 -04:00
Jeff Epler
f838ff9528
raspberrypi: Remove debug prints
2021-04-23 09:44:01 -05:00
Jeff Epler
10fee3e673
raspberrypi: Increase PIO clock speed in ParallelImageCapture
...
.. this allows DIV_4 and DIV_2 resolutions to work without being
jumbled.
2021-04-22 12:14:44 -05:00
Jeff Epler
2def016fd0
raspberrypi: Use 32-bit elements in FIFO
...
.. these do come in the right
2021-04-22 12:14:03 -05:00
Jeff Epler
7fb751808f
raspberrypi: Implement ParallelImageCapture using PIO
...
.. based on code from Phil B.
2021-04-22 12:02:51 -05:00
Dan Halbert
b3ffb3ab1f
Return bytes written from RP2040 UART.write()
2021-04-21 18:38:35 -04:00
Dan Halbert
61e33a5619
fix nrf ISR; make direction consistent across ports; save code size
2021-04-09 11:07:47 -04:00
Jeff Epler
3ce0b512f8
rasberrypi: IncrementalEncoder: factor out state machine
2021-04-08 16:25:47 -05:00
Jeff Epler
1a2ce27b73
raspberrypi: Drop support for auto-reversing swapped encoder
2021-04-06 09:22:59 -05:00
Jeff Epler
fc86475de5
IncrementalEncoder: support swapped pins
...
Closes : #4422
2021-04-04 13:49:50 -05:00
Jeff Epler
93d6ceedd9
IncrementalEncoder: Disconnect interrupt handler during deinit.
...
Closes : #4557
2021-04-04 13:49:41 -05:00
Jeff Epler
bcd90dd927
IncrementalEncoder: There are no out pins.
...
Closes #4556
2021-04-04 13:49:21 -05:00
Phil Howard
b8d4f9655f
RP2040: Only bitbang 0-byte writes
...
The I2C.c for RP2040 included a special case for writes <=2 bytes to match the MicroPython implementation,
however RP2040 does support 1 and 2 byte reads, with only 0 bytes being the exception.
Signed-off-by: Philip Howard <phil@pimoroni.com>
2021-03-17 16:25:54 +00:00
gamblor21
3b01a65743
Fixed formatting
2021-03-16 08:14:49 -05:00
Mark
e326d7ca80
Merge branch 'main' into rp_dp_parallel
2021-03-15 20:00:13 -05:00
Scott Shawcroft
f7a988b9b3
Merge pull request #4405 from DavePutz/issue_4237
...
Issue 4237 - Changed initial setting in program_struct
2021-03-15 17:51:36 -07:00
microDev
a52eb88031
run code formatting script
2021-03-15 19:27:36 +05:30
root
9a83501982
Fixed initial settings for program_struct to allow more than 1 program per pio
2021-03-14 15:05:56 -05:00
Scott Shawcroft
1b106de4e0
Merge pull request #4262 from DavePutz/issue_4111
...
Issue 4111 - Implement pulseio(pulsein) for RP2040
2021-03-12 16:48:57 -08:00
DavePutz
96ce43e6d6
Added the correct files
2021-03-12 16:18:33 -06:00
DavePutz
6628f49852
Use StateMachine.c interrupt setup and simplify SM program
2021-03-12 16:06:57 -06:00
gamblor21
307d2a99fe
Fix after rebase
2021-03-11 20:06:50 -06:00
gamblor21
5689307798
Changed frequency to match PIO having 2 instructions
2021-03-11 19:32:44 -06:00
gamblor21
b02b1e9979
Set frequency default 60Mhz
2021-03-11 19:32:44 -06:00
gamblor21
1658fe04f9
Set the statemachine to never reset so REPL works
2021-03-11 19:32:44 -06:00
gamblor21
c384ebe5c0
Updated to initalize pindirs
2021-03-11 19:32:44 -06:00
gamblor21
56a219911f
Add frequency support to parallel bus
2021-03-11 19:32:43 -06:00
gamblor21
b080d6207b
Removing debug info and clean up
2021-03-11 19:32:43 -06:00
gamblor21
c6aaab6f64
Initial commit
2021-03-11 19:32:43 -06:00
Jeff Epler
16bfe3b41c
raspberrypi: RTC: Ensure a time is set
...
Until a time is set, the RTC is not running, and rtc_get_datetime()
returns false without assigning to the out-parameter.
In CircuitPython, this would manifest as arbitrary values being returned,
since uninitialized storage on the stack was being converted into a timestamp.
2021-03-10 20:20:40 -06:00
DavePutz
a3c3e8a0fa
fix trailing whitespace
2021-03-09 22:41:08 -06:00
DavePutz
0c58cc4772
Moved pin wait to an initial exec
2021-03-09 16:37:29 -06:00
DavePutz
f0e3274a33
Update to agree with modified StateMachine.h
2021-03-09 11:13:09 -06:00
DavePutz
6f4510d7aa
Merge branch 'main' into issue_4111
2021-03-08 23:28:21 -06:00
root
576da73a17
Added check for maxlen
2021-03-08 23:23:51 -06:00
root
95b7a59156
Merge branch 'issue_4111' of https://github.com/DavePutz/circuitpython into issue_4111
2021-03-08 23:22:05 -06:00
root
3db0fec267
Added check for maxlen
2021-03-08 23:20:57 -06:00
DavePutz
88650bc4d0
Removed leftover debug code
2021-03-08 22:48:57 -06:00
Jeff Epler
2ae1e7de61
WIPrp2040: Implement IncrementalEncoder
...
Any two consecutive pins can be used for an IncrementalEncoder
Testing performed: Put a synthesized (few hundred counts per second) quadrature signal into GP2/3 and read the encoder out. Performed filesystem operations at the same time to stress test it.
The reasons for not using common_hal_rp2pio_statemachine_readinto are commented on.
2021-03-05 10:31:29 -06:00
DavePutz
a4dda3a5ba
Merge branch 'main' into issue_4111
2021-03-04 14:38:00 -06:00
DavePutz
c5c297d2c0
Update PulseOut.c
2021-03-04 13:53:19 -06:00
DavePutz
b7f03f9487
Update PulseOut.h
2021-03-04 13:52:40 -06:00
DavePutz
2d941b070f
Changed interrupt to per-word basis; cleaned up other small items
2021-03-04 13:51:46 -06:00
Jeff Epler
bc14ed31f6
StateMachine.h: Add header for declaration of mcu_pin_obj_t typedef
2021-03-04 12:28:46 -06:00
Jeff Epler
c023ec03ff
PDMIn: Add missing deinit call
2021-03-04 12:28:06 -06:00
Jeff Epler
bd01d31542
rp2pio: Add pins_are_sequential
...
This can be used where the standard API calls for a list of pins, to check that they satisfy the requirements of the rp2pio state machine, e.g.,
```python
def __init__(self, pin_a, pin_b):
if not rp2pio.pins_are_sequential([pin_a, pin_b]):
raise ValueError("Pins must be sequential")
```
2021-03-04 11:26:33 -06:00
Jeff Epler
ff62b0d2c0
StateMachine: Add pull up/down for inputs
2021-03-04 11:26:29 -06:00
Jeff Epler
68ac14b309
StateMachine: Add in_available property
...
I named the property `in_available` because it is similar to pyserial.
However, it indicates the number of words in the fifo, not the number
of bytes.
2021-03-04 11:14:09 -06:00
Dan Halbert
cd48c5ee83
Merge pull request #4315 from dhalbert/rp2040-i2c-short-writes
...
RP2040: Implement short I2C writes (2 bytes or less) using bitbangio
2021-03-03 12:42:47 -05:00
DavePutz
ced707ed32
Update call to rp2pio_statemachine_construct
2021-03-03 10:55:08 -06:00
Scott Shawcroft
514b73bcf8
Merge pull request #4254 from gamblor21/rp2040_countio
...
Rp2040 countio
2021-03-03 08:47:24 -08:00
Scott Shawcroft
1d8933dd05
Merge pull request #4265 from DavePutz/pio_soft_reset
...
Clear out PIOs and State Machines on RP2040 soft reset
2021-03-03 08:43:57 -08:00
Dan Halbert
fb7a0f7efc
add 1sec timeouts for I2C read and write
2021-03-03 09:43:57 -05:00
gamblor21
98075c5255
Fixed merge
2021-03-02 22:32:59 -06:00
Dan Halbert
e3ab394cd6
works on nearly all sensors
2021-03-02 23:27:37 -05:00
DavePutz
6046d37f31
Update PulseIn.c
2021-03-02 21:23:45 -06:00
Mark
37ee18349f
Merge branch 'main' into rp2040_countio
2021-03-02 19:47:53 -06:00
gamblor21
4246cc3f6d
Counter and PWMOut slice conflict check
2021-03-02 19:32:06 -06:00
Jeff Epler
efc2667b5f
Merge pull request #4186 from jepler/update-protomatter-rp2
...
Enable protomatter on RP2040 builds
2021-03-02 19:01:37 -06:00
Dan Halbert
f31b472309
Merge remote-tracking branch 'adafruit/main' into rp2040-i2c-short-writes
2021-03-02 15:17:12 -05:00
Dan Halbert
9939c59caa
wip
2021-03-02 15:16:55 -05:00
Scott Shawcroft
ce70b95990
Merge pull request #4177 from microDev1/nvm-rp
...
RP2040: Support for NVM
2021-03-02 09:57:36 -08:00
microDev
b029031286
minor structural modification
2021-03-02 14:36:28 +05:30
Jeff Epler
4b63a8c9b4
rp2pio: allow keyboard interrupt while waiting for tx fifo to empty (& stall)
2021-03-01 21:07:04 -06:00
Jeff Epler
238484ec26
Merge remote-tracking branch 'origin/main' into update-protomatter-rp2
2021-03-01 15:18:32 -06:00
Scott Shawcroft
532e7db293
Merge pull request #4267 from dhalbert/rp2040-digitalinout-fixes
...
RP2040: change DigitalInOut direction only when necessary; strong drive strength
2021-03-01 13:14:13 -08:00
gamblor21
d7bc8a46a5
Added counters per slice
2021-02-27 15:17:27 -06:00
root
29c89a2487
Removed more includes
2021-02-26 22:35:38 -06:00
root
f3515502b7
Removed unecessary includes
2021-02-26 22:33:50 -06:00
root
6374408c06
Changed reset_rp2pio_statemachine to clean up any PIO interrupts.
2021-02-26 22:28:50 -06:00
Scott Shawcroft
776301c932
Typo fix: direcion -> direction
2021-02-26 15:03:56 -08:00
Scott Shawcroft
888a0c5f08
Merge pull request #4224 from microDev1/busio-uart-rp
...
RP2040: Support for UART
2021-02-26 14:57:23 -08:00
Dan Halbert
d9234ffa82
need to gpio_set_dir() at some point
2021-02-26 15:27:35 -05:00
root
7942932176
Requested changes
2021-02-26 14:14:55 -06:00
Scott Shawcroft
2e6e91dc5c
Merge pull request #4253 from tannewt/rp2040_fix_pwm_reuse
...
Fix second shared PWM
2021-02-26 11:53:54 -08:00
Scott Shawcroft
7c8d7d77dd
Merge remote-tracking branch 'adafruit/main' into busio-uart-rp
2021-02-26 09:04:42 -08:00
Jeff Epler
1d1ff5f308
Merge remote-tracking branch 'origin/main' into update-protomatter-rp2
2021-02-26 09:56:35 -06:00
Scott Shawcroft
3f08cb47b8
Merge remote-tracking branch 'adafruit/main' into busio-uart-rp
2021-02-25 16:59:15 -08:00
Scott Shawcroft
52bc935fa7
A few minor fixes for corner cases
...
* Always clear the peripheral interrupt so we don't hang when full
* Store the ringbuf in the object so it gets collected when we're alive
* Make UART objects have a finaliser so they are deinit when their
memory is freed
* Copy bytes into the ringbuf from the FIFO after we read to ensure
the interrupt is enabled ASAP
* Copy bytes into the ringbuf from the FIFO before measuring our
rx available because the interrupt is based on a threshold (not
> 0). For example, a single byte won't trigger an interrupt.
2021-02-25 16:50:57 -08:00
Dan Halbert
d0f1cfb039
address review; use gpio_set() carefully
2021-02-25 18:41:22 -05:00
Scott Shawcroft
2b163ccd6a
Fix incorrect deinit mask
2021-02-25 14:57:46 -08:00
Scott Shawcroft
1b00d94b23
Fix second shared PWM
...
Fixes #4210
2021-02-25 14:49:09 -08:00
Jeff Epler
22276710e6
rp2pio: Fix writing where the stride was 2 or 4
...
The wrong stride value was being checked.
2021-02-25 15:50:49 -06:00
Dan Halbert
199a8ce8b0
change DigitalInOut direction only when necessary; strong drive strength
2021-02-25 14:10:19 -05:00
root
f8eb5bc275
Cleanup PIOs and State Machines on soft reset
2021-02-25 12:38:43 -06:00
microDev
8170e26a86
more uart improvements
...
- address suggested changes
- refine uart instance availibility checks
- improve pin validation and rx buffer handling
2021-02-25 23:46:00 +05:30
root
86e60f5f35
Clean up formatting
2021-02-24 17:26:35 -06:00
root
17ff5dcc99
Return NotImplementedError for PulseOut
2021-02-24 17:04:05 -06:00
root
8e15f36baa
pulseio (pulsein) for RP2040
2021-02-24 16:58:29 -06:00
microDev
5d7fdafcde
implement suggested changes
...
- add internal buffering
- rtc initialization fix
2021-02-25 00:48:36 +05:30
Mark
b935dcafdc
Merge branch 'main' into rp2040_countio
2021-02-23 19:46:41 -06:00
gamblor21
379f454ce6
Adding countio to rp2040
2021-02-23 19:38:05 -06:00
Scott Shawcroft
abbbb91fa8
Add state machine divisor check
...
This causes an exception when setting a state machine too slow or
too fast.
Fixes #4222
2021-02-23 16:30:46 -08:00
Scott Shawcroft
360475e266
Implement audiobusio and enhance PIO for it
...
This adds I2SOut and PDMIn support via PIO.
StateMachines can now:
* read and read while writing
* transfer in 1, 2 or 4 byte increments
* init pins based on expected defaults automatically
* be stopped and restarted
* rxfifo can be cleared and rxstalls detected (good for tracking when
the reading code isn't keeping up)
Fixes #4162
2021-02-23 15:50:00 -08:00
Dan Halbert
67406488d1
merge from upstream; re-alphabetize
2021-02-19 14:22:50 -05:00
microDev
b12ccefbe6
uart implementation for rp2040
2021-02-19 18:36:00 +05:30
Dan Halbert
53a002a096
Initial fix, but bitbangio timing may be off
2021-02-18 13:14:51 -05:00
microDev
696d212dc7
fix nvm rewrite
2021-02-18 18:42:00 +05:30
Jeff Epler
ab5eb86118
raspberrypi: implement os.urandom
...
Since the datasheet cast some doubt on the strength of the "rosc_hw->randombit",
I use the SHA256 hash function to create a high quality random seed
from random values of uncertain entropy, as well as to generate a sequence
of random values from that seed using SHA256 as a cryptographically-secure
random number generator.
In practice, it produces over 100kB/s of random data which does not
have any gross problems according to _PractRand_.
2021-02-17 17:49:25 -06:00
Dan Halbert
0b8f1b9a90
wip: usb_cdc.serials
2021-02-15 20:06:18 -05:00
Dan Halbert
93d788543c
Merge remote-tracking branch 'adafruit/main' into secondary-cdc
2021-02-15 20:03:53 -05:00