Commit Graph

358 Commits

Author SHA1 Message Date
Dan Halbert a77b2363ef evt handler list bugs; unique evt handler names; remove uuid128_reference 2019-01-03 21:42:42 -05:00
Dan Halbert ccb3c6fac6 Remove print methods from bleio; Python lib will do it 2019-01-03 10:51:49 -05:00
Dan Halbert c46d06f34c Move 128-bit UUID string parsing to Python; simplify UUID API 2019-01-02 23:11:03 -05:00
Dan Halbert 87c6f33bcc Broadcaster now takes whole packet. Also should be scannable 2019-01-01 14:11:59 -05:00
Dan Halbert b6b5ed9c89 Remove nRF52832 support 2018-12-30 22:49:20 -05:00
Dan Halbert 1dc3957e72 LocalPeripheral is now Peripheral; more work on basic GATTS support; UART not working yet 2018-12-30 22:33:49 -05:00
Dan Halbert ef39e72c7c free event handlers on reset; fix typo in Broadcaster 2018-12-29 13:55:10 -05:00
Dan Halbert 4d1f0ec07b Add Broadcaster. Reset correctly on reload. 2018-12-28 23:34:23 -05:00
Dan Halbert 4167bf5b24 wip: advertising works, but not connection 2018-12-27 00:04:04 -05:00
Dan Halbert a7a24096f4 bleio WIP: redo for more immutability; use sd_* routines for internal flash write 2018-12-07 16:52:47 -05:00
Dan Halbert 125901e4e2 Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-06 12:41:38 -05:00
Dan Halbert 63cd9209f1 allow KeyboardInterrupt on UART read; fix nrf UART pin claiming; rename feather 52840 UART pins 2018-12-04 15:05:39 -05:00
Scott Shawcroft 1b4359eaec
Merge pull request #1372 from dhalbert/pyserial-compat-for-uart
UART changes: timeout in secs, write bytes, etc.
2018-12-03 14:20:44 -08:00
Dan Halbert 80db2cec99 UART changes: timeout in secs, write bytes, etc. 2018-12-03 12:04:32 -05:00
Dan Halbert 72e3cfdfb8 Fix arg type for AudioOut(..., quiescent_value=...) 2018-12-03 11:20:33 -05:00
Dan Halbert 3164b16196 WIP: debug; add hash and __eq__ to UUID 2018-11-26 21:09:17 -05:00
Dan Halbert 1763ffe245 More UUID work; use mp_raise for exceptions 2018-11-20 23:04:58 -05:00
Dan Halbert c424ad844b Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-11-20 14:47:05 -05:00
Dan Halbert 31cc71f7fb WIP: bleio revisions 2018-11-20 09:36:45 -05:00
Carlos 060b84a0fa Remove reference to clock_id on the function descriptiions 2018-11-18 10:43:28 -06:00
Carlos 55a9e2d697 Fix time.monotonic_ns docstring 2018-11-18 10:41:35 -06:00
Scott Shawcroft 355abc835e
Fix output overflow and make help translatable 2018-11-09 16:41:08 -08:00
Scott Shawcroft 9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00
Dan Halbert 64d457dad9 bring bleio PR up to date 2018-11-07 14:12:22 -05:00
caternuson 55cbeb6fc6 in doc string as well 2018-11-05 14:49:24 -08:00
caternuson 85fbdefe77 change channels to channel_count 2018-11-05 08:05:43 -08:00
caternuson 46f1a0719e add channels and bits_per_sample to audioio.WaveFile 2018-10-31 18:08:10 -07:00
Nick Moore f6482699a0 Merge remote-tracking branch 'origin/master' into circuitpython/nickzoic/703-wiznet-5500-native 2018-10-25 12:20:50 +11:00
Nick Moore b714f5d650 Add "dhcp" property to turn DHCP on and off 2018-10-25 11:29:27 +11:00
Jeff Epler ec1aec1921 shared-bindings/time: introduce time.monotonic_ns
This is intended to be compatible with Python 3.7's time.monotonic_ns.
The "actual resolution" is 1ms due to this being the unit at which
common_hal_time_monotonic ticks.

Closes #519
2018-10-21 10:22:52 -05:00
arturo182 4bc24c4f60 bleio: Fix errors after rebase 2018-10-21 17:15:27 +02:00
arturo182 c62b708012 bleio: Fix docs error 2018-10-21 16:00:15 +02:00
arturo182 5354aeab4c bleio: Allow using len() on UUID 2018-10-21 16:00:12 +02:00
arturo182 13dd27a047 bleio: Remove UUID static variables 2018-10-21 16:00:08 +02:00
arturo182 eceb21a017 bleio: Don't register the services until needed
Because of the very specific way nRF requires service registration
(characteristics can be added only to last added service), we would
have to write the Python code in a specific way. With this patch the
user has more freedom.
2018-10-21 16:00:04 +02:00
arturo182 ad466b3edb bleio: Let Characteristic inherit the Services UUID length 2018-10-21 16:00:01 +02:00
arturo182 beee58a56f bleio: Add scan_entry as an param for the Device constructor 2018-10-21 15:59:57 +02:00
arturo182 684f2673ce bleio: Remove unneeded TODO 2018-10-21 15:59:53 +02:00
arturo182 19fab4af5a bleio: Remove deep copy constructor for UUID 2018-10-21 15:59:50 +02:00
arturo182 b5e5805bb4 bleio: Remove redundant struct field 2018-10-21 15:59:46 +02:00
arturo182 c7b42d80b3 bleio: A bit of cleanup 2018-10-21 15:59:42 +02:00
arturo182 17f13ecc2c nrf: Cleanup of the ble driver
Moved the functions to classes that they belong to.
2018-10-21 15:54:13 +02:00
arturo182 a126897f52 bleio: Fix incorrect role detection 2018-10-21 15:51:08 +02:00
arturo182 5412bf66c3 bleio: Improve type documentation 2018-10-21 15:50:53 +02:00
arturo182 3bd65fbae5 nrf: Move the Peripheral class to bleio as Device
This was the last class from ubluepy and so that module is now gone.
The Device class offers both Peripheral and Central functionality.
See the inline docs for more info.
2018-10-21 15:50:45 +02:00
arturo182 bda734223e nrf: Move the Service class from ubluepy to the shared bleio module 2018-10-21 15:43:51 +02:00
arturo182 cc78249226 nrf: Move the Characteristic class from ubluepy to the shared bleio module 2018-10-21 15:43:48 +02:00
arturo182 1c6bf9a150 bleio: Move the Scanner class to a shared module 2018-10-21 15:43:29 +02:00
arturo182 7390dc7dab bleio: Move ScanEntry to shared module and add a new AdvertisementData class 2018-10-21 15:43:24 +02:00
arturo182 345334aaf1 bleio: Add a new Address class
Use the new in the Adapter singleton.
2018-10-21 15:43:21 +02:00
arturo182 d5f942a971 bleio: Add a AddressType enum-like class 2018-10-21 15:43:17 +02:00
arturo182 20b8d5169d nrf: Move the Descriptor class from ubluepy to the shared bleio module 2018-10-21 15:43:13 +02:00
arturo182 f4940c9aec nrf: Move the UUID class from ubluepy to the shared bleio module
Also added a UUIDType enum-like class for determining UUID type.
2018-10-21 15:43:08 +02:00
Scott Shawcroft 4eb1fe18e5
Tweaks from feedback:
* default_value is now quiescent_value
* Use step = -step format for sign switch
* Add note about analogout_reset being empty
2018-10-17 11:31:08 -07:00
Scott Shawcroft c209165d43
Ramp values to and from a default value while active.
This reduces the popping sound on initial playback of an audio
sample.

The M4 DAC has a pop on startup that cannot be prevented. It also
does not allow readback so current values of the DAC are ignored.

Fixes #1090
2018-10-16 16:23:29 -07:00
Dan Halbert 2262efc311 PulseOut working 2018-10-16 11:05:02 -04:00
Nick Moore 06894be294 timer ticks for DHCP state machine for wiznet 2018-10-16 23:10:18 +11:00
Nick Moore 5bb12793a0 update documentation and translations again 2018-10-11 22:19:46 +11:00
Nick Moore a4a0cf826b fix doc comments, translations again 2018-10-11 17:02:29 +11:00
Nick Moore bb239052ea Split wiznet driver into shared-bindings vs shared-module 2018-10-11 15:05:25 +11:00
Nick Moore aab28748bb Merge remote-tracking branch 'origin/master' into circuitpython/nickzoic/703-wiznet-5500-native 2018-10-11 14:19:10 +11:00
Nick Moore 823ff779ca network module c api into shared-module 2018-10-11 14:02:18 +11:00
Dan Halbert 8d58093328
Merge pull request #1259 from dhalbert/nrf-pwmout
Allow variable freq PWMOut; use multiple channels if same freq
2018-10-10 12:27:27 -04:00
Scott Shawcroft df80ad8e6e
Merge pull request #1193 from ATMakersBill/master
Add supervisor.runtime.serial_bytes_available so that input() can be used without blocking.
2018-10-09 23:58:43 -07:00
Scott Shawcroft 0688709c4f
Move the docs next to the implementation 2018-10-09 23:15:25 -07:00
ATMakersBill 05d4b8cf50 Added Documentation for the serial_bytes_available attribute 2018-10-09 22:50:59 -04:00
Dan Halbert 91a88cf568 Allow variable freq PWMOut; use multiple channels if same freq 2018-10-09 20:52:55 -04:00
ATMakersBill 9f94712ad1 replacing change to input() with separate method to check for USB Serial input 2018-10-09 18:37:52 -04:00
Scott Shawcroft 6da25c8893
Rename stop to stop_voice in case we want stop to stop everything later. 2018-10-09 13:28:00 -07:00
Nick Moore 6d9c2c5254 Documentation builds (though has no real content yet) 2018-10-09 22:37:49 +11:00
Nick Moore a60700b1c5 Get DHCP working ... 2018-10-09 16:28:30 +11:00
Nick Moore 9b36d33df1 move random mac address function into network module 2018-10-09 13:12:04 +11:00
Nick Moore 6e624b9c6a Split wiznet.WIZNET5K off into its own file 2018-10-09 13:05:58 +11:00
Nick Moore 4b767ff080 Change WIZNET5K.isconnected to connected property 2018-10-09 12:24:24 +11:00
Scott Shawcroft 15d80a8c46
Fix doc build 2018-10-05 15:19:08 -07:00
Scott Shawcroft 76008ce304
Introduce audioio.Mixer which can mix multiple audio samples
to produce a single sample.

Only works with 16 bit samples on the M4.

Fixes #987
2018-10-05 15:12:23 -07:00
Nick Moore 15b59bee1b change initialization method + mod_network names 2018-10-04 22:31:47 +10:00
Nick Moore d33f6214f1 modify modnetwork and modusocket for circuitpython 2018-10-04 22:02:25 +10:00
Nick Moore f4c32139f5 Copy modnetwork and modusocket across from MicroPython 2018-10-04 22:02:25 +10:00
Nick Moore 27fc84a157 Modify wiznet module for circuitpython 2018-10-04 22:02:25 +10:00
Nick Moore 3c32d046bf Copy wiznet module across from MicroPython 2018-10-04 21:22:09 +10:00
Dan Halbert 21d331c8cc round SPI freq down; check max freq 2018-10-02 21:06:40 -04:00
Dan Halbert aa95526428 nrf: remove error check for SPI baudrate too high; round to nearest baudrate 2018-10-01 18:54:13 -04:00
Dan Halbert bc510e714f merge 3.0.2 to master 2018-09-18 15:38:12 -04:00
Scott Shawcroft f21cf15c38
Add OnDiskBitmap which loads pixel data straight from disk.
Also, renamed Sprite's palette to pixel_shader so it can be
anything that produces colors based on values (including color values).
Added a ColorConverter that converts RGB888 (found in bitmaps) to
RGB565 for the display.

Fixes #1182
2018-09-12 15:25:59 -07:00
Dan Halbert 6a046f55c4 UART fixes and enhancements; default board object fix 2018-09-12 17:19:43 -04:00
Scott Shawcroft 06a610fd0c
Merge pull request #1166 from dfarning/clean-up-docs
Reorder status matrix and module list in shared-bindings for increase…
2018-09-07 12:02:23 -07:00
David Farning 62fab2e9c4 Reorder status matrix and module list in shared-bindings for increase user read ability 2018-09-07 03:30:28 -05:00
Scott Shawcroft 86288f14f1
Merge translations and update title underline 2018-09-06 14:56:26 -07:00
Scott Shawcroft 1683eb913d
Minor tweaks based on feedback 2018-09-06 14:49:49 -07:00
Scott Shawcroft 121903b6ee
Tweaks based on feedback 2018-08-31 14:21:48 -07:00
Scott Shawcroft 6697544cdf
Introduce displayio to render graphics to displays.
It's designed to minimize RAM footprint by using Sprites to
represent objects on the screen. The object model also facilitates
partial screen updating which reduces the bandwidth needed to display.

This is all handled in C. Python simply manipulates the objects with
the ability to synchronize to frame timing.
2018-08-31 12:31:52 -07:00
Noralf Trønnes 39ee12d1ac Fix os.stat() to use 1970 epoch
Commit 95e70cd0ea 'time: Use 1970 epoch' changed epoch for the time
module, but not for other users. This patch does the same for the only
other core timeutils user: extmod/vfs_fat.c:fat_vfs_stat().
Other timeutils users: cc3200, esp8266 and stm32, are not changed.

Ports that don't use long ints, will still get wrong time values from
os.stat().
2018-08-25 20:43:02 +02:00
Noralf Trønnes eefb6842a0 i2cslave: Fix missing translate() when raising exceptions
The translate() changes where applied after travis had checked the
i2cslave PR so this wasn't caught.
2018-08-18 16:00:06 +02:00
Scott Shawcroft 4a4d84ba42
Merge pull request #1064 from notro/i2cslave
Add busio.I2CSlave
2018-08-17 16:51:45 -07:00
Scott Shawcroft de5a9d72dc
Compress all translated strings with Huffman coding.
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
2018-08-16 17:40:57 -07:00
Noralf Trønnes 11cbeb87ad ports/atmel-samd: Implement i2cslave.I2CSlave
This adds support for SAMD acting as a I2C slave in polled mode.
2018-08-16 17:20:49 +02:00
Noralf Trønnes 1ed0e45fc2 Add i2cslave.I2CSlave bindings 2018-08-16 17:11:20 +02:00
Scott Shawcroft 96ebf5bc3f
Two fixes and translate more strings.
* Fix finding translations with escaped characters.
* Add back \r to translations since its needed by screen.
2018-08-09 13:29:30 -07:00
Jeff Epler e1b4e9b7c7 UART: Always allocate UART objects in the long-lived pool
Particularly when they have buffers that are written via IRQ or DMA,
UART objects do not relocate gracefully.  If such an object is
relocated to the long-lived pool after its original creation, the
IRQ or DMA will write to an unexpected location within the Python
heap, leading to a variety of symptoms.  The most frequent symptom
is inability to read from the UART.

Consider the particular case of atmel-samd: usart_uart_obj_t
contains a usart_async_descriptor contains a _usart_async_device.
In _sercom_init_irq_param the address of this contained
_usart_async_device is assigned to a global array
sercom_to_sercom_dev which is later used from the interrupt context
_sercom_usart_interrupt_handler to store the received data in the
right ring buffer.

When the UART object is relocated to the long-lived heap, there's no
mechanism to re-point these internal pointers, so instead take the
cowardly way and allocate the UART object as long-lived.

Happily, almost all UART objects are likely to be long-lived, so
this is unlikely to have a negative effect on memory usage or heap
fragmentation.

Closes: #1056
2018-08-08 19:21:57 -05:00