Commit Graph

936 Commits

Author SHA1 Message Date
George Waters 02d0881fca
Fix error when getting a pixelbuf slice 2020-05-20 17:56:08 -04:00
Sean Cross 34f91f01c6 bleio: adapter: add advertising timeout and status
Add a field to allow specifying a timeout when initiating advertising.
As part of this, add a new property to determine if the device is still
advertising.

Additionally, have the `anonymous` property require a timeout, and set
the timeout to the maximum possible value if no timeout is specified.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:19 +08:00
Sean Cross cfe65742a3 _bleio: support anonymous advertising
Add a new parameter to the `start_advertising()` function to enable
anonymous advertising.  This forces a call to `sd_ble_gap_privacy_set()`
with `privacy_mode` set to `BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY` and
`private_addr_type` set to
`BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE`.

With this, addresses will cycle at a predefined rate (currently once
every 15 minutes).

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:18 +08:00
Scott Shawcroft 2c2b53303d
Merge pull request #2837 from k0d/serial-debug
Add support for a debug console, such as ST-Link VCP.
2020-05-18 18:13:31 -07:00
Mark Olsson 007c92ee6a Enable showing the console on a debug uart 2020-05-19 02:02:52 +02:00
warriorofwire dde66cadde remove a duplication in polygon.c 2020-05-18 13:32:06 -07:00
warriorofwire 4bbb80e31a vectorio: speed up polygon
This change takes polygon from 126k pixels per second fill to 240k pps fill
  on a reference 5 point star 50x66px polygon, updating both location and shape
  at 10hz.  Tested on an m4 express feather.

As a curiosity, the flat-out fill rate of a shape whose get_pixel is `return 0;`
  fills just shy of 375k pixels per second.
2020-05-18 13:32:06 -07:00
ppolk-nocimed c6406c74ec Added DigitalInOut suggestion 2020-05-16 13:21:34 -07:00
ppolk-nocimed f76ff1eb69 Fixed Optional[Pull] 2020-05-16 13:14:50 -07:00
ppolk-nocimed db924fb01e Digital In Out Type Hints 2020-05-16 12:47:49 -07:00
Thea Flowers 7d167560af Note that nvm.ByteArray is available at microcontroller.nvm
Fixes #2766
2020-05-15 14:53:14 -07:00
Scott Shawcroft 0d8bca92e2
Merge pull request #2810 from dherrada/master
Pyi integration
2020-05-15 10:31:05 -07:00
Sean Cross f9ed3acf6d aesio: specify writable buffers for destination buffers
When calling `AES.decrypt_into()` or `AES.encrypt_into()`, the
destination buffers may be any buffer kind.  However, we currently
aren't checking to make sure the destination buffer is actually
writable.

Specify `MP_BUFFER_WRITE` for the destination buffers of both of these
objects so we don't inadvertently write to immutable data.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-15 10:22:42 +08:00
Sean Cross aba36e4abf aesio: use bufinfo rather than mp_str_bytes
In order to accept both `bytes` objects and `bytearray` objects, use a
`bufinfo` construct to retrieve the data rather than
`mp_obj_str_get_data()`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-15 10:16:00 +08:00
Scott Shawcroft 15c2d16bf9
Fix help doc 2020-05-14 16:06:13 -07:00
Scott Shawcroft afc84c2fd1
Fix ulab, math and template. 2020-05-14 15:58:36 -07:00
dherrada b477c4812d
Fixed minor indentation issue 2020-05-14 16:58:25 -04:00
Scott Shawcroft db4dbe0752
Merge pull request #2889 from jepler/gamepad-tick
Gamepad, GamepadShift: Fix after lower-power by enabling supervisor tick
2020-05-13 11:53:23 -07:00
Scott Shawcroft 3ffa5604fc
Update countio to python stub docs 2020-05-13 08:36:16 -07:00
Scott Shawcroft 7546d47f77
Merge remote-tracking branch 'adafruit/master' into improve_verification 2020-05-13 08:23:55 -07:00
Jeff Epler 23ba58bbf5 Gamepad & GamepadShift: Initially allocate as long-lived
This makes less heap churn and decreases code size a tiny bit
2020-05-13 10:14:37 -05:00
Jeff Epler fbf052bb27 Gamepad & GamepadShift: Enable ticks while object exists
Otherwise, button presses might not be noticed.
2020-05-13 10:14:37 -05:00
Scott Shawcroft 4e646ee6e4
Move vectorio to stubs 2020-05-12 18:40:02 -07:00
Scott Shawcroft cde6651721
Merge remote-tracking branch 'adafruit/master' into improve_verification 2020-05-12 18:23:59 -07:00
Scott Shawcroft 277e8d528b
Merge branch 'master' into Optical-Encoder-Module 2020-05-12 18:22:57 -07:00
Scott Shawcroft 4e8de3c554
Swap sphinx to autoapi and the inline stubs 2020-05-12 17:28:24 -07:00
Scott Shawcroft d274074f01
Merge remote-tracking branch 'adafruit/master' into vectorio 2020-05-12 12:29:05 -07:00
Scott Shawcroft bc40034a08
Merge branch 'master' into Optical-Encoder-Module 2020-05-12 12:12:51 -07:00
Scott Shawcroft a1091bbfbb
Merge pull request #2871 from DavePutz/Issue2812
Throw a NotImplementedError for time functions on boards without long ints
2020-05-12 11:40:49 -07:00
dherrada c534a872a2
Merge branch 'master' into master 2020-05-12 12:26:02 -04:00
dherrada 6490137812
Did usb_hid, usb_midi, ustack, wiznet 2020-05-12 12:08:46 -04:00
dherrada e4589543fb
Did time, touchio, uheap 2020-05-12 11:43:24 -04:00
dherrada 991045b9ce
Did struct, supervisor, terminalio 2020-05-12 11:28:33 -04:00
Daniel Pollard 22bf99ccc4 Fixed underline in documentation 2020-05-12 14:52:48 +10:00
Daniel Pollard ee2cb703c8 merged master 2020-05-12 14:41:28 +10:00
warriorofwire 78444a1018 fix VectorShape on_dirty callback registration being set for the wrong type 2020-05-11 21:21:05 -07:00
warriorofwire 040beb0577 Clean up circle documentation 2020-05-11 21:15:40 -07:00
DavePutz 4712f9f104
Merge branch 'master' into Issue2812 2020-05-11 21:48:54 -05:00
Scott Shawcroft 1b0c52c8ca
Merge pull request #2877 from rhooper/pixelbuf-doc-fix
Pixelbuf doc fix
2020-05-11 15:42:33 -07:00
dherrada 603df58f97
Did stage, socket, storage 2020-05-11 13:40:02 -04:00
dherrada c7a9d49cba
Did rgbmatrix, rotaryio, and RTC 2020-05-11 13:00:19 -04:00
dherrada 838b6c5685
Did ps2io, pulseio, random 2020-05-11 10:48:11 -04:00
warriorofwire eb3d5fa453 ujson: do not eat trailing whitespace
Ujson should only worry about whitespace before JSON.  This becomes apparent when you are using MP stream protocol to read directly from input buffers.

When you attempt to read(1) on a UART (and possibly other protocols) you have to wait for either the byte or the timeout.

Fixes:
- Waiting for a timeout after you have completed reading a correct and complete JSON off the input.
- Raising an OSError after reading a correct and complete JSON off the input.
- Eating more data than semantically owned off the input buffer.
- Blocking to start parsing JSON until the entire JSON body has been loaded into a potentially large, contiguous Python object.

Code you would write before:
```
line = board_busio_uart_port.read_line()
json_dict = json.loads(line)
```
or reaching for fixed buffers and swapping them around in Python.

Code that did not work before that does now:
```
json_dict = json.load(board_busio_uart_port)
```

- This removes the need for intermediate copies of data when reading JSON from micropython stream protocol inputs.
- It also increases total application speed by parsing JSON concurrently with receiving on boards that read from UART via DMA.
- It simplifies code that users write while improving their apps.
2020-05-10 20:45:42 -07:00
Roy Hooper 09fedb3fd5 fix another doc error (pixelsx - thanks @theacodes) 2020-05-10 21:35:37 -04:00
Roy Hooper 70f2ef3f8e Fix docs some more 2020-05-10 19:50:10 -04:00
Roy Hooper 2f7c0ec8e4 Minor fixes to _pixelbuf.PixelBuf docs 2020-05-10 16:22:01 -04:00
warriorofwire 4086600b61 vectorio: switch per-shape transform to Display
Rather than maintain a transform per-shape, we'll just use whatever
  settings are on the Display.  Currently only transpose is done.
2020-05-09 22:15:51 -07:00
warriorofwire 206d0e598a Add vectorio: for drawing shapes
vectorio builds on m4 express feather

Concrete shapes are composed into a VectorShape which is put into a displayio Group for display.

VectorShape provides transpose and x/y positioning for shape implementations.

Included Shapes:

* Circle
  - A radius; Circle is positioned at its axis in the VectorShape.
  - You can freely modify the radius to grow and shrink the circle in-place.

* Polygon
  - An ordered list of points.
  - Beteween each successive point an edge is inferred.  A final edge closing the shape is inferred between the last
    point and the first point.
  - You can modify the points in a Polygon.  The points' coordinate system is relative to (0, 0) so if you'd like a
      top-center justified 10x20 rectangle you can do points [(-5, 0), (5, 0), (5, 20), (0, 20)] and your VectorShape
      x and y properties will position the rectangle relative to its top center point

* Rectangle
  A width and a height.
2020-05-09 15:38:22 -07:00
DavePutz e7fc806034
Throw a NotImplementedError for time functions on boards without long ints
Fix for Issue #2812. Instead of reporting a missing attribute for functions such as time.time() and time.mktime(); platforms that do not have long integer support will raise a NotImplementedError
2020-05-08 16:33:26 -05:00
dherrada 09530e5dc3
Did os, _pixelbuf, _pew 2020-05-08 16:03:39 -04:00