Commit Graph

945 Commits

Author SHA1 Message Date
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
Kattni Rembor
a83d1d7b4b Update wheel to colorwheel and fix RGB order. 2020-05-08 14:44:41 -04:00
Kattni Rembor
37e5ff7757 Update colorwheel from GRB to RGB. 2020-05-08 13:25:52 -04:00
dherrada
d750096bef
Did neopixel, network, nvm 2020-05-07 18:40:46 -04:00
dherrada
e31e9eeaa1
Did math, microcontroller, and multiterminal 2020-05-07 15:59:52 -04:00
dherrada
4f33a20d17
Added gamepad, gamepadshift, and i2cslave 2020-05-07 15:10:44 -04:00
dherrada
a3d5adb43c
Did _eve, fontio, framebufferio, and frequencyio 2020-05-07 11:56:46 -04:00
dherrada
2ebe3035df
Did board, digitalio, displayio 2020-05-07 10:54:09 -04:00
Daniel Pollard
84c806a4be updated descriptions and build variable 2020-05-07 12:42:46 +10:00
spkuehl
af55af216a Fix type in RTC documentation. 2020-05-06 14:11:11 -05:00
Sean Cross
b168784fa0 aesio: add basic AES encryption and decryption
This adds initial support for an AES module named aesio.  This
implementation supports only a subset of AES modes, namely
ECB, CBC, and CTR modes.

Example usage:

```
>>> import aesio
>>>
>>> key = b'Sixteen byte key'
>>> cipher = aesio.AES(key, aesio.MODE_ECB)
>>> output = bytearray(16)
>>> cipher.encrypt_into(b'Circuit Python!!', output)
>>> output
bytearray(b'E\x14\x85\x18\x9a\x9c\r\x95>\xa7kV\xa2`\x8b\n')
>>>
```

This key is 16-bytes, so it uses AES128.  If your key is 24- or 32-
bytes long, it will switch to AES192 or AES256 respectively.

This has been tested with many of the official NIST test vectors,
such as those used in `pycryptodome` at
39626a5b01/lib/Crypto/SelfTest/Cipher/test_vectors/AES

CTR has not been tested as NIST does not provide test vectors for it.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-06 17:40:06 +08:00
Daniel Pollard
8961dd9fe7 changed build variables as per advice 2020-05-06 09:05:14 +10:00
Daniel Pollard
bfa5cd9c13 refactor countio based on feedback 2020-05-05 15:23:38 +10:00
Dan Halbert
e1366d78b1 trivial change to force rebuild 2020-05-04 23:05:47 -04:00
Dan Halbert
b7836aeac6 address review comments 2020-05-04 19:51:08 -04:00
Dan Halbert
bae7a5e433 make translate again 2020-05-04 17:26:59 -04:00
Dan Halbert
d6c6f9f4f0 add PacketBuffer .incoming_ and .outgoing_packet_length 2020-05-04 15:59:45 -04:00
dherrada
0e465e63b9
Did audiopwmio, bitbangio, and _bleio 2020-05-01 18:23:27 -04:00
Scott Shawcroft
242063e1d0
Merge pull request #2838 from spkuehl/UART_sharedbinding_fix
Fix #2814 Corrected UART output.
2020-05-01 11:05:24 -07:00
spkuehl
a3a2dd0f70 Corrected UART output. 2020-04-30 19:14:51 -05:00
dherrada
d65e851044
Did audioio, audiomixer, audiomp3 2020-04-30 13:06:09 -04:00
Dan Halbert
46298ddcb4 PacketBuffer doc fixes 2020-04-30 00:36:01 -04:00
Dan Halbert
f3078511a6 further cleanup and bug fixing 2020-04-29 23:18:08 -04:00
Dan Halbert
180f5c6a94 Merge remote-tracking branch 'adafruit/master' into ringbuf-fixes 2020-04-29 22:11:22 -04:00
Dan Halbert
3d62f87e29 back to '.packet_size' for compatiblity 2020-04-29 22:10:56 -04:00
Dan Halbert
84cee1ab8d rename and improve PacketBuffer packet length property 2020-04-29 17:49:31 -04:00
dherrada
7ff9b9bc80
Did first 3 2020-04-29 17:36:28 -04:00
dherrada
a2a32fea1a
Added newlines after every ellipsis 2020-04-29 15:55:06 -04:00
dherrada
093461e816
Fixed indentation 2020-04-29 15:45:19 -04:00
dherrada
deccdcc1d6
Did the same for the rest of busio 2020-04-29 15:20:05 -04:00
dherrada
93d1e53c66
Hopefully fixed whitespace issues 2020-04-29 14:19:04 -04:00
dherrada
c7b721f4f1
Fixed some more whitespace 2020-04-28 19:22:03 -04:00
dherrada
aacca61598
Fixed whitespace on audiocore 2020-04-28 18:56:19 -04:00
dherrada
c3897d0add
Fixed whitespace in analogio 2020-04-28 18:43:40 -04:00
dherrada
724dcda3ec
Fixed whitespace in busio 2020-04-28 18:39:58 -04:00
Scott Shawcroft
755d404edf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-27 16:45:10 -07:00
dherrada
829da5c127
Added inline pyi to audiomp3 2020-04-27 17:29:50 -04:00
dherrada
8330471068
Added inline pyi to audiomixer 2020-04-27 17:20:40 -04:00
dherrada
1363e6e724
Added inline pyi to audiocore 2020-04-27 17:02:48 -04:00
dherrada
088b5b1785
Added inline pyi to audiocore 2020-04-27 16:49:12 -04:00
dherrada
e96235d0cf
Added inline pyi to audiobusio 2020-04-27 16:35:03 -04:00
dherrada
8344fce994
Added inline pyi to analogio 2020-04-27 13:06:47 -04:00
dherrada
27e085ec36
Added pyi to OneWire.c 2020-04-25 15:36:16 -04:00
dherrada
e7874277ab
Fixed empty lines 2020-04-25 15:35:24 -04:00
dherrada
7070fe1995
Added inline pyi to UART.c 2020-04-25 15:25:31 -04:00
dherrada
28430a9919
Added inline pyi to I2C.c 2020-04-25 15:07:58 -04:00
dherrada
55bdee688f
Reorganized pyi again 2020-04-23 16:14:17 -04:00
dherrada
855c2033b5
Reogranized pyi in spi.c 2020-04-23 15:35:20 -04:00
dherrada
a18b991ca9
Added pyi to SPI.c 2020-04-22 15:22:34 -04:00
Jeff Epler
b87af3b071 ulab: Update from upstream
Closes: #2787
2020-04-22 09:04:12 -05:00
Dan Halbert
77cd93ac2d merge from adafruit 2020-04-21 17:47:51 -04:00
Dan Halbert
38ec3bc574 further ringbuf cleanup 2020-04-21 17:38:20 -04:00
Jeff Epler
507e17fbf1 displayio: Fix "bus type" problem introduced at 8cba145c90
When allocate_display_bus_or_raise was factored out, the assignment
of the bus's Python type was lost.  Restore it.

This would have affected displays of any type other than RGBMatrix, when
they were created dynamically.  Boards with displays configured in flash
were unaffected.

Closes: #2792
2020-04-21 13:48:34 -05:00
Scott Shawcroft
bebf27e733
Merge remote-tracking branch 'adafruit/master' into lower_power
This isn't perfect and needs a bit more testing.
2020-04-20 18:25:13 -07:00
Jeff Epler
898c09c35e RGBMatrix: nonessential change to kick Actions 2020-04-19 09:10:08 -05:00
Jeff Epler
9bfe6b7197 framebufferio: update copyright information 2020-04-17 18:44:07 -05:00
Jeff Epler
8c455f24bf RGBMatrix: this comment no longer describes the code
... allocate_display_bus_or_raise() uses fixed storage, not heap storage.
2020-04-17 18:44:07 -05:00
Jeff Epler
37cb6bafa8 RGBMatrix: documentation got behind the code 2020-04-17 18:44:07 -05:00
Jeff Epler
5fcc6d6286 RGBMatrix: finish renaming from Protomatter
This gets all the purely internal references.  Some uses of
protomatter/Protomatter/PROTOMATTER remain, as they are references
to symbols in the Protomatter C library itself.
2020-04-17 18:44:07 -05:00
Jeff Epler
1b478bbae6 RGBMatrix: remove unneeded properties 2020-04-17 18:43:57 -05:00
Jeff Epler
57ce2d1f41 framebufferio: get width, etc., from protocol, not object property 2020-04-17 18:43:57 -05:00
Jeff Epler
3d6258f63d Rename Protomatter -> RGBMatrix
This is a quick rename, it changes the user-facing names but not the
internal names of things.
2020-04-17 18:43:57 -05:00
Jeff Epler
64c3968a2e protomatter: move get_width/height to common_hal 2020-04-17 18:43:57 -05:00
Jeff Epler
545b6e560a fix doc build 2020-04-17 18:43:57 -05:00
Jeff Epler
1a91a75b9c framebufferio: get more properties direct from underlying framebuffer 2020-04-17 18:43:57 -05:00
Jeff Epler
a32337718d Rename _protomatter -> protomatter
I originally believed that there would be a wrapper library around it,
like with _pixelbuf; but this proves not to be the case, as there's
too little for the library to do.
2020-04-17 18:43:57 -05:00
Jeff Epler
d1ff23e004 framebufferio: get width, height from framebuffer properties 2020-04-17 18:43:57 -05:00
Jeff Epler
d2aac7a754 Protomatter: add width, height properties 2020-04-17 18:43:57 -05:00
Scott Shawcroft
b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler
0ce9c008c5 Protomatter: Make all arguments kw-only, add rgb count and optional height checking
They're not readily distinguishable by type.

I also added the requested height optional parameter; this is checked
against the computed one.  It's not feasible to use this parameter to
artificailly reduce the number of used rows, because changes in the
underlying C protomatter library would be required.

Finally, I added a better error message when the number of RGB pins was
not what was expected.
2020-04-14 18:24:59 -05:00
Jeff Epler
880fff80e9 protomatter: Respond to review comments
- rename oe_pin -> output_enable_pin
 - improve and reorganize docstrings
 - rename swapbuffers->refresh
 - rename "paused" -> "brightness", change semantics slightly
 - common_hal several functions
 - clarify why the common_hal routines can't be used directly in the
   protocol's function pointers
 - whitespace cleanups
 - remove prototypes for nonexistent functions
2020-04-14 18:24:59 -05:00
Jeff Epler
5d328c3b44 protomatter: clarify by comment why these functions exist 2020-04-14 18:24:58 -05:00
Jeff Epler
ba20bc8b43 framebufferio: move backlight down to the underlying framebuffer 2020-04-14 18:24:58 -05:00
Jeff Epler
129c6369cf protomatter: code style 2020-04-14 18:24:58 -05:00
Jeff Epler
4a05e938ed protomatter: validate pins to give better error message
The numbered error from the underlying library is not helpful for
beginning users
2020-04-14 18:24:58 -05:00
Jeff Epler
9019710a1e protomatter: improve an error message 2020-04-14 18:24:58 -05:00
Jeff Epler
baf04b7738 FramebufferDisplay: remove probably not needed constructor arguments 2020-04-14 18:24:58 -05:00
Jeff Epler
50219862e1 protomatter: make docstring match implementation 2020-04-14 18:24:58 -05:00
Jeff Epler
a663a7dd30 _protomatter: move get/set paused into shared-module 2020-04-14 18:24:58 -05:00
Jeff Epler
5fcba97a51 Make function name more descriptive 2020-04-14 18:24:58 -05:00
Jeff Epler
89eb45a13c use floor division in docstring
Co-Authored-By: Scott Shawcroft <scott@tannewt.org>
2020-04-14 18:24:58 -05:00
Jeff Epler
09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00
Jeff Epler
8cba145c90 displayio: implement, use allocate_new_display_bus_or_raise 2020-04-14 18:24:54 -05:00
Jeff Epler
6378d600c4 displayio: implement, use allocate_display_or_raise 2020-04-14 18:24:54 -05:00
Scott Shawcroft
ada102dd98
Merge pull request #2767 from jepler/update-ulab
ulab: Get updates from upstream
2020-04-14 15:59:33 -07:00
Scott Shawcroft
e063b066f0
Merge pull request #2756 from caternuson/bitmap_fill
Add fill method to displayio.Bitmap
2020-04-14 12:54:44 -07:00
Jeff Epler
693928d201 doc updates 2020-04-13 20:10:02 -05:00
caternuson
dc75746842 add docstring, clean up 2020-04-09 08:59:26 -07:00
caternuson
49fff2d9b4 initial working fill 2020-04-09 08:43:50 -07:00
sommersoft
61bab8e62e ulab/__init__.rst: fix attribute name; uint8 -> uint16 2020-04-09 08:45:26 -05:00
Scott Shawcroft
317b96e93a
Fix iMX builds 2020-03-31 17:00:30 -07:00
Scott Shawcroft
cbe9512691
Merge pull request #2741 from tannewt/fix_packetbuffer_server
Fix PacketBuffer server support
2020-03-31 13:39:34 -07:00