Commit Graph

353 Commits

Author SHA1 Message Date
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
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
sommersoft d1974e0038 supervisor/Runtime: updated documentation for 'no disconnect' 2018-04-06 01:56:51 +00:00
Jeff Epler 92853e611d RunMode: Fix repr(RunMode.BOOTLOADER) 2018-04-05 08:16:53 -05:00
Dan Halbert 435e894fa0 Merge branch 'master' into 3.0_hid 2018-04-02 19:19:43 -04:00
Radomir Dopieralski 6ca4fd82ed Add a type check to the gamepad module
Make sure that all the arguments passed are indeed DigitalInOut.
This avoids crashes when the users pass something else.
2018-03-31 20:41:16 +02:00
Dan Halbert df91878d2e WIP: works with just keyboard but not complex report descriptor 2018-03-30 23:24:00 -04:00
sommersoft 6ee573c7c9
Merge branch 'master' into super_status 2018-03-30 14:27:39 -05:00
Jeff Epler 34f5498760 Document storage.VfsFat more thoroughly 2018-03-27 21:28:19 -05:00
Jeff Epler c08f5a3a00 Add storage.getmount to retrieve the mount object associated with a path 2018-03-27 21:28:18 -05:00
Dan Halbert 31f5b6a238 WIP: simple working HID 2018-03-24 18:29:12 -04:00
Jeff Epler 002797a3b4 Fix array vs pointer error in declaration of circuitpython_help_text
Building with gcc 5.4.1 (Debian Stretch) with the unsupported
-Wno-error=lto-type-mismatch flag removed, the following diagnostic
occurs:

../../py/builtin.h:121:19: error: type of 'circuitpython_help_text' does not match original declaration [-Werror]
 extern const char MICROPY_PY_BUILTINS_HELP_TEXT[];
                   ^
../../shared-bindings/help.c:38:13: note: previously declared here
 const char *circuitpython_help_text =
             ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/arm-none-eabi-gcc returned 1 exit status
2018-03-19 22:11:40 -05:00
Radomir Dopieralski 493c1452f3 _stage: use 16 bit for coordinates to support larger screens 2018-03-11 12:07:23 +01:00
sommersoft 2569b33c84 1 more sphinx fix; added '.. class::' constructor 2018-03-09 21:00:15 +00:00
sommersoft f21038b913 sphinx fix; incorrect currentmodule ref 2018-03-09 20:24:07 +00:00
sommersoft 01471e1e22 sphinx fix; added toctree to include 'runtime' 2018-03-09 03:22:00 +00:00
sommersoft c1c3a79ec4 atmel-samd: changed Status to Runtime; instituted runtime singleton 2018-03-09 02:19:51 +00:00
Scott Shawcroft bf05183158 Merge remote-tracking branch 'adafruit/2.x' into merge_2x 2018-02-27 15:24:16 -08:00
Dan Halbert 9b4477e1dc Implement UART for 3.0 + related fixes.
1. UART: ported to ASF4. Allow rx-only and tx-only. Add .baudrate r/w property.

2. Make NeoPixel timing deterministic by turning off caches during NeoPixel writes.
3. Incorporate asf4 updates:
  a. async USART driver
  b. bringing Atmel START configuration closer to what we use
  c. Clock initialization order now specified by CIRCUITPY_GCLK_INIT_1ST and _LAST.
4. supervisor/port.c: Move commented-out clock-test pin setting to correct location.
2018-02-21 17:18:49 -05:00
Scott Shawcroft 20dd3b1e43 Delete a bunch of docs, drivers and examples not relevant to CircuitPython.
This fixes #345 and fixes #215.
2018-02-20 17:34:59 -08:00
sommersoft fca9c66c27 added Status submodule to shared-bindings/supervisor; issue #544 2018-02-19 20:40:17 +00:00
Kattni 446a31302c
Merge pull request #600 from tannewt/clarify_property_comments
Clarify style of attribute comments in the Design Guide.
2018-02-14 22:03:37 -05:00
Kevin Townsend 9d191f7f9f
Merge pull request #589 from arturo182/nrf_gamepad
nrf: Implement ticks, add gamepad module and example
2018-02-07 22:17:05 +01:00
Scott Shawcroft 15db02664d Clarify style of attribute comments in the Design Guide.
And update the core attributes to match the style.
2018-02-07 13:08:42 -08:00
arturo182 ff041caa52 shared-bindings: Fix incorrect code comments
Most likely caused by copy-paste.
2018-02-06 22:03:17 +01:00
Scott Shawcroft 6c5cb01b4a
Merge pull request #564 from deanm1278/master
DM: added write_readinto to bitbangio
2018-02-06 09:38:17 -08:00
arturo182 1de2ee6884 nrf: Implement ticks, add gamepad module and example 2018-02-05 20:48:25 +01:00
dean 68309c3fac replace tabs with spaces 2018-02-05 10:44:29 -05:00
dean 0e13aba2fe DM: fix sytling 2018-01-30 17:45:04 -05:00
dean a7f72eb2d8 DM: added write_readinto to bitbangio 2018-01-30 17:18:57 -05:00
Dan Halbert cc87363234 documentation: caution on SPI clock speed for SAMD21 2018-01-30 14:31:20 -05:00
Dan Halbert e550b024c5 atmel-samd: Correct computation of SPI baud rate.
all: Add .frequency read-only property for busio.SPI to return actual frequency.

Fix esp8266/posix_helpers.c, which was not up to date for the new
long-lived/short-lived heap allocation scheme.
2018-01-30 12:08:41 -05:00
sommersoft 44bc1711aa Added Unique ID Functions/Updated Support Matrix (#527)
shared_bindings/index.rst: updated Support Matrix format as discussed in PR #503 & Issue #448.

shared-bindings/microcontroller/Processor.c & .h: added UID lookup functionality for use with all ports. Fixes #462.
2018-01-18 11:39:11 -08:00
Radomir Dopieralski 0ff128ec03 Fix example for gamepad
The example code for the gamepad module would skip detected
button presses in the code that waits for a button to be released,
because it would run it even when no button is pressed.

Also updated the example pin names to not use RX and TX.
2018-01-11 17:06:53 +01:00
Dan Halbert 065e82015f merge from 2.2.0 + fix up board defs 2018-01-02 21:25:41 -05:00
sommersoft 881fa8e2b9 shared-bindings/index.rst: added audiobusio
shared-bindings/index.rst: added `aduiobusio` to Support Matrix. Used `audiobusio/_init_.c` to verify applicable ports; SAMD21 was the only one listed...ESP8266 wasn't. This fixes issue #448.
2017-12-30 01:36:23 -06:00
sommersoft 36ec29d4e8 Documentation Updates (mcu.delay() and Design Guide) (#481)
/docs/design_guide: added links to firmware build learning guides for SAMD21 & ESP8266. Changes were placed in the "Adding native modules" section, since that seemed to me the best place based on target audience.

Updated documentation for `delay()` which fixes #243.
2017-12-14 10:02:43 -08:00
Dan Halbert 43650b6896 Fix PDMIn MEMS microphone support (#479)
Changes:

    * New faster filter loop, by @ladyada. New filter coefficients as well.
    * Turn on microphone clock when PDMIn object is created, and run it all the time, so the user code doesn't have to wait for microphone startup, which can be 10ms or even 100ms.
    * Wait for microphone startup when PDMIn is first created, based on new optional parameter microphone_startup in seconds (takes a float).
    * record() returns number of samples actually recorded, so you can see if it's not keeping up.
    * Fix buffer overflow errors when buffer size was not a multiple of 16 or something like that.
    * Tweak a few peripheral settings.
    * Minimum sampling frequency is now 16kHZ or so, because 8kHz runs microphone at only 0.5MHz, which is too slow for many mics.

Note: I tried 128x oversampling instead of 64x, but the code cannot keep up at 24kHz or above sampling. 128x would reduce the high-frequency noise by 6db.
2017-12-13 10:12:49 -08:00
Scott Shawcroft a91e1cb682 Fix a couple spelling errors. 2017-12-05 16:04:47 -08:00
Scott Shawcroft b4d3699047 Introduce reset mechanics to microcontroller.
This allows one to configure how a subsequent reset will behave and
also trigger a reset.

Fixes #350 and fixes #173
2017-12-05 14:50:58 -08:00
Dan Halbert e75fd0e166 add SPI.write_readinto() - bidirectional SPI 2017-12-05 11:17:16 -08:00
Dan Halbert 72c911be97 Support SPI flash chips for CIRCUITPY, using non-DMA SPI for now. 2017-11-27 21:00:24 -05:00
Kattni 4902f0937f Resolved formatting issue in doc 2017-11-22 21:44:18 -05:00
Kattni 1d6bf8e04a Updated frequency minimum requirements in docs and examples (#444)
Updated frequency minimum requirements in docs and examples
2017-11-19 22:19:22 -08:00
Dan Halbert a9f75a71c5
Merge pull request #443 from dhalbert/3.0_spi
non-DMA SPI working; adding this now for testing; will continue with DMA
2017-11-16 19:28:24 -05:00
Dan Halbert 312444bbd2 non-DMA SPI working; adding this now for testing; will continue with DMA
Also, fixed pin mappings for rev B Metro M4:
swap PA12 and PA13 on SPI 2x3 header
swap A3 and A5

Comment out all frozen modules in CPX again to make room while waiting
for SPI flash.
2017-11-16 19:09:35 -05:00
Scott Shawcroft ecc47d5258 Create supervisor module.
It can control autoreload and the rgb status led.
2017-11-16 09:04:17 -08:00
Radomir Dopieralski 216fcedfbb Add a _stage module (#398)
This is a C module with some low-level functions required for the
CircuitPython "stage" library. It provides support for fast
rendering of tile grids and sprites on SPI-based RGB displays.
2017-11-07 10:05:25 -08:00
Dan Halbert 7292984204 Implement busio.I2c.
* Added asf4_conf/samd*/hpl_sercom_config.h
* Adjusted clocks in peripheral_clk_config.h.
* Put some frozen libs back in CPX for testing.
* Implement common-hal I2C
* Add samd*_peripherals.h in parallel with samd*_pins.h for common
  functions and data.
* Store SERCOM index in pins table for convenience.
* Canonicalize some #include guard names in various .h files.

simpler reset of SERCOMs; remove unused routine
2017-11-07 09:59:54 -08:00
Radomir Dopieralski 78f6c2232c Allow empty reads and writes for busio.SPI
This is mostly for convenience, so that user code doesn't
need to add additional checks.

Also, bring the bitbangio into compatibility with busio wrt. empty
buffers.
2017-11-03 17:33:37 +01:00
Scott Shawcroft 8c1f5427bc atmel-samd: Add empty line for RST docs
Right now calcsize is being grouped with the doc above: https://circuitpython.readthedocs.io/en/latest/shared-bindings/struct/__init__.html
2017-10-30 18:57:28 -07:00