Commit Graph

302 Commits

Author SHA1 Message Date
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
Scott Shawcroft
933add6cd8
Support internationalisation. 2018-08-07 14:58:57 -07:00
Dan Halbert
dfa2581ffd
Merge pull request #1057 from tannewt/flexible_heap
Add basic memory allocation outside Python runtime
2018-08-02 18:43:06 -04:00
Scott Shawcroft
168aa394db
Move pin struct to the peripherals library.
Its slimmed down by removing the qstr and bit packing TCC info.

The trinket m0 build actually grows by 20 bytes. The arduino zero
build shrinks by 188 bytes.
2018-08-02 13:59:05 -07:00
Dan Halbert
761f9a938e
Merge pull request #1075 from tannewt/more_mp_raise
Use more mp_raise_* to save 28 bytes code size.
2018-07-31 19:09:10 -04:00
Scott Shawcroft
0bf999f52a
Use more mp_raise_* to save 28 bytes code size. 2018-07-31 13:50:48 -07:00
Scott Shawcroft
a88cdaca6a
Remove rogue execute bit. Must a common incorrect shortcut for me. :-) 2018-07-31 12:42:21 -07:00
Scott Shawcroft
12cf5e51c2
Allow for resizing the stack area. 2018-07-31 05:18:23 -07:00
Scott Shawcroft
777542c716
Add basic memory allocation outside Python runtime
This allows for the heap to fill all space but the stack. It also
allows us to designate space for memory outside the runtime for
things such as USB descriptors, flash cache and main filename.

Fixes #754
2018-07-31 05:18:03 -07:00
Dan Halbert
f48b70050e merge finished 2018-07-28 13:29:47 -04:00
Dan Halbert
2809b4f9dd Merge branch 'master' into micropython-25ae98f-merge 2018-07-16 19:36:40 -04:00
Dan Halbert
e2e01efa84 compiles and runs; hangs on import storage;storage.VfsFat.<tab> 2018-07-13 22:51:10 -04:00
arturo182
05c1384b67 nrf: Split the ble module into a shared part and the port implementation
This allows other ports to implement these shared bindings.
2018-07-13 16:01:15 +02:00
Kattni Rembor
a10c61ef89 Fixed issue with code in docs for audioio
Removed incorrect arg from RawSample in AudioOut example code.
Replaced variable sample with dac.
2018-06-29 16:46:25 -04:00
Dan Halbert
327b0f76da fix os.listdir() when current dir is '/' 2018-06-15 10:51:03 -04:00
Scott Shawcroft
2fbab8067a Prevent freezing USB during high frequency PulseIn.
We now track the last time the background task ran and bail on the
PulseIn if it starves the background work. In practice, this
happens after the numbers from pulsein are no longer accurate.

This also adjusts interrupt priorities so most are the lowest level
except for the tick and USB interrupts.

Fixes #516 and #876
2018-06-08 12:56:32 -07:00
Kattni Rembor
3a38172627 Fixed documentation formatting for RTD 2018-06-06 18:28:01 -04:00
Scott Shawcroft
717199018b Adapt for feedback and hack around pIRkey size constraint. 2018-06-01 15:08:52 -07:00
Scott Shawcroft
d0fb6e7a2f atmel-samd: Add rotary encoder support.
Fixes #283
2018-06-01 15:08:48 -07:00
Scott Shawcroft
fd71e56891 atmel-samd: Re-org helper peripheral files into their own subdirectory.
Ideally in the future they won't depend on ASF4 or MicroPython.
2018-06-01 15:07:31 -07:00
Radomir Dopieralski
b219ce6d37 Add gamepad_singleton to root pointers 2018-05-30 23:11:22 +02:00
Radomir Dopieralski
c37b69e1a5 Make the gamepad singleton long-lived
So that it is not later moved.
2018-05-30 23:11:22 +02:00
Radomir Dopieralski
42e36a883b Remove volatile from the gamepad struct 2018-05-23 21:49:20 +02:00
Radomir Dopieralski
f17a235b40 Raise an error if more than 8 buttons passed to gamepad 2018-05-23 21:41:56 +02:00
Radomir Dopieralski
240678e714 Avoid uninitialized gamepad on exception
Raise exceptions before the gamepad_singleton is created.
Also, use mp_raise for creating the exceptions.
2018-05-23 21:39:06 +02:00
Radomir Dopieralski
edf2935ab1 Make gamepad.get_pressed work when gamepad was created from frozen code
For some reason, when the GamePad is created from frozen code, the
get_pressed method would always return 0. This fixes it, and makes it
work properly no matter how the object was created.
2018-05-23 12:44:22 +02:00
Radomir Dopieralski
52d05bbc37 Cache pullup state in gamepad
Don't check the pin's pull direction on every tick, instead cache it
at the beginning. Also avoid a "can't get pull of output pin" error
when one of the pins passed is in output mode.
2018-05-23 11:26:16 +02:00
Scott Shawcroft
be12e07d74
Merge pull request #846 from notro/epoch1970
time: Use 1970 epoch
2018-05-19 12:30:34 -05:00
jerryneedell
1d9bcc5ddf
fix doc error in audioOut.c
fixes #851
2018-05-19 10:41:36 -04:00
Noralf Trønnes
95e70cd0ea time: Use 1970 epoch
Use UNIX epoch to match CPython.
This overflows small int so time.{time,localtime,mktime} is only supported with long int.
Also remove some comment cruft in time_time().
2018-05-18 12:35:33 +02:00
Scott Shawcroft
6a8db03ade
Merge pull request #838 from rhooper/master
add supervisor.reload() to soft reboot from code
2018-05-16 17:52:16 -04:00
Scott Shawcroft
918d30cb97
Rephrase the doc 2018-05-16 16:28:43 -05:00
Roy Hooper
92b1cb5743 move reload exception to reload.c 2018-05-14 17:41:17 -04:00
Roy Hooper
698912633f Rename reload_next_character to reload_requested to make it match it's intended use 2018-05-14 17:00:38 -04:00
Roy Hooper
567f3e30a7 Initial implementation of supervisor.reload() 2018-05-14 16:57:50 -04:00
Jerry Needell
d6c26942a5 add timeout keyword to I2C - for bitbangio - ignored for busio 2018-05-13 21:54:44 -04:00
dean
82b5efa7bc remove unnecessary comment 2018-05-09 15:14:26 -04:00
dean
fba1e221c6 DM: add kwargs to bitbangio spi 2018-05-09 15:12:42 -04:00
Scott Shawcroft
fc7c25af6d Make resume idempotent (allowing you to call it twice without complaining.) 2018-05-08 13:00:05 -07:00
Scott Shawcroft
24116eff23 Tweak exception message. 2018-05-08 12:44:27 -07:00
Scott Shawcroft
50fc90bc5f Add pause/resume control to AudioOut and I2SOut
Fixes #808
2018-05-08 11:53:13 -07:00
Jeff Epler
2955ada22f docs: fix references to uhashlib 2018-05-06 12:31:54 -05:00
Jeff Epler
647ff387d9 docs: fix references to ubinascii 2018-05-03 09:34:43 -05:00
Scott Shawcroft
cfea51ec68 Re-enable PDMIn without ASF and using the helpers added with
I2SOut.

The API is almost the same except the frequency attribute has been
renamed to sample_rate so that its less likely to be confused with
frequencies within the audio itself.

Fixes #263.
2018-05-01 14:35:43 -07:00
Scott Shawcroft
81d395d825
Merge pull request #745 from notro/time_rtc
RFC: Add rtc module
2018-04-16 15:26:54 -07:00
Scott Shawcroft
301479cd44
Remove "Get or set" 2018-04-16 15:00:58 -07:00
Scott Shawcroft
84d4be279e
Add a table of contents reference to RTC 2018-04-16 15:00:01 -07:00
Noralf Trønnes
8d1719f190 Add rtc module
Add an rtc module that provides a singleton RTC class with
- a datetime property to set and get time if the board supports it.
- a calbration property to adjust the clock.

There's also an rtc.set_time_source() method to override this RTC object using pure python.

The time module gets 3 methods:
- time.time()
- time.localtime()
- time.mktime()

The rtc timesource is used to provide time to the time module.

lib/timeutils is used for time conversions and thus only supports dates after 2000.
2018-04-16 12:49:10 +02:00
Scott Shawcroft
5af4e79ed3 Correct example. Thanks @jepler! 2018-04-13 16:43:21 -07:00
Scott Shawcroft
812fe0c93f Turn on nvm in 3.0.
Its 256b on M0 and 8k on M4 to match flash erase sizes.

Fixes #758
2018-04-13 16:22:28 -07:00
Scott Shawcroft
22194d5977 Tweaks based on dhalbert's feedback. 2018-04-13 10:51:01 -07:00
Scott Shawcroft
28642ab10d Add audio output support!
This evolves the API from 2.x (and breaks it). Playback devices are now
separate from the samples themselves. This allows for greater playback
flexibility. Two sample sources are audioio.RawSample and audioio.WaveFile.
They can both be mono or stereo. They can be output to audioio.AudioOut or
audiobusio.I2SOut.

Internally, the dma tracking has changed from a TC counting block transfers
to an interrupt generated by the block event sent to the EVSYS. This reduces
the overhead of each DMA transfer so multiple can occure without using up TCs.

Fixes #652. Fixes #522. Huge progress on #263
2018-04-12 16:35:13 -07:00
Dan Halbert
5f98953ed8 esp8266 and nrf: raise NotImplementedError 2018-04-10 12:08:41 -04:00
Dan Halbert
aa8c262d14 add storage.erase_filesystem() to erase and reformat CIRCUITPY 2018-04-09 12:52:42 -04:00
Scott Shawcroft
4e053cea0d
Merge pull request #628 from sommersoft/super_status
Added Function To Check the Serial Connection From CircuitPython Layer
2018-04-08 22:06:09 -07:00
Dan Halbert
726d5e52a3 Merge branch 'master' into 3.0_hid 2018-04-08 09:52:29 -04:00
sommersoft
cc644032ea Merge branch 'super_status' of https://github.com/sommersoft/circuitpython into super_status 2018-04-06 01:58:29 +00:00