Skip to content

Commit bb03afd

Browse files
committed
Merge remote-tracking branch 'micropython/master'
2 parents 345dd14 + 60592fd commit bb03afd

82 files changed

Lines changed: 925 additions & 376 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ before_script:
1212
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
1313
- sudo dpkg --add-architecture i386
1414
- sudo apt-get update -qq || true
15-
- sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system mingw32
15+
- sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system gcc-mingw-w64
1616
- sudo apt-get install -y --force-yes gcc-arm-none-eabi
1717
# For teensy build
1818
- sudo apt-get install realpath
@@ -23,6 +23,7 @@ before_script:
2323
- python3 --version
2424

2525
script:
26+
- make -C mpy-cross
2627
- make -C minimal test
2728
- make -C unix deplibs
2829
- make -C unix
@@ -35,7 +36,7 @@ script:
3536
- make -C teensy
3637
- make -C cc3200 BTARGET=application BTYPE=release
3738
- make -C cc3200 BTARGET=bootloader BTYPE=release
38-
- make -C windows CROSS_COMPILE=i586-mingw32msvc-
39+
- make -C windows CROSS_COMPILE=i686-w64-mingw32-
3940

4041
# run tests without coverage info
4142
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests)

bare-arm/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define MICROPY_CPYTHON_COMPAT (0)
4343
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
4444
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
45+
#define MICROPY_USE_INTERNAL_PRINTF (0)
4546

4647
// type definitions for the specific machine
4748

cc3200/application.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ APP_LIB_SRC_C = $(addprefix lib/,\
154154
timeutils/timeutils.c \
155155
utils/pyexec.c \
156156
utils/pyhelp.c \
157-
utils/printf.c \
158157
)
159158

160159
APP_STM_SRC_C = $(addprefix stmhal/,\

cc3200/mods/modmachine.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ STATIC const mp_map_elem_t machine_module_globals_table[] = {
198198
{ MP_OBJ_NEW_QSTR(MP_QSTR_IDLE), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_ACTIVE) },
199199
{ MP_OBJ_NEW_QSTR(MP_QSTR_SLEEP), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_LPDS) },
200200
{ MP_OBJ_NEW_QSTR(MP_QSTR_DEEPSLEEP), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_HIBERNATE) },
201-
{ MP_OBJ_NEW_QSTR(MP_QSTR_POWER_ON), MP_OBJ_NEW_SMALL_INT(PYB_SLP_PWRON_RESET) },
201+
{ MP_OBJ_NEW_QSTR(MP_QSTR_POWER_ON), MP_OBJ_NEW_SMALL_INT(PYB_SLP_PWRON_RESET) }, // legacy constant
202+
{ MP_OBJ_NEW_QSTR(MP_QSTR_PWRON_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_PWRON_RESET) },
202203
{ MP_OBJ_NEW_QSTR(MP_QSTR_HARD_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_HARD_RESET) },
203204
{ MP_OBJ_NEW_QSTR(MP_QSTR_WDT_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WDT_RESET) },
204205
{ MP_OBJ_NEW_QSTR(MP_QSTR_DEEPSLEEP_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_HIB_RESET) },

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
# The short X.Y version.
100100
version = '1.8'
101101
# The full version, including alpha/beta/rc tags.
102-
release = '1.8.3'
102+
release = '1.8.4'
103103

104104
# The language for content autogenerated by Sphinx. Refer to documentation
105105
# for a list of supported languages.

docs/esp8266/quickref.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ Use the ``machine.ADC`` class::
162162
adc = ADC(0) # create ADC object on ADC pin
163163
adc.read() # read value, 0-1024
164164

165-
SPI bus
166-
-------
165+
Software SPI bus
166+
----------------
167167

168-
There are two SPI drivers. One is implemented in software and works on all pins::
168+
There are two SPI drivers. One is implemented in software (bit-banging)
169+
and works on all pins::
169170

170171
from machine import Pin, SPI
171172

@@ -190,18 +191,19 @@ There are two SPI drivers. One is implemented in software and works on all pins:
190191
spi.write_readinto(buf, buf) # write buf to MOSI and read MISO back into buf
191192

192193

193-
Hardware SPI
194-
------------
194+
Hardware SPI bus
195+
----------------
195196

196197
The hardware SPI is faster (up to 80Mhz), but only works on following pins:
197-
``MISO`` is gpio12, ``MOSI`` is gpio13, and ``SCK`` is gpio14. It has the same
198-
methods as SPI, except for the pin parameters for the constructor and init
199-
(as those are fixed).
198+
``MISO`` is GPIO12, ``MOSI`` is GPIO13, and ``SCK`` is GPIO14. It has the same
199+
methods as the bitbanging SPI class above, except for the pin parameters for the
200+
constructor and init (as those are fixed)::
200201

201202
from machine import Pin, SPI
202203

203-
hspi = SPI(0, baudrate=80000000, polarity=0, phase=0)
204+
hspi = SPI(1, baudrate=80000000, polarity=0, phase=0)
204205

206+
(``SPI(0)`` is used for FlashROM and not available to users.)
205207

206208
I2C bus
207209
-------

docs/library/machine.WDT.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Example usage::
1414
wdt = WDT(timeout=2000) # enable it with a timeout of 2s
1515
wdt.feed()
1616

17-
Availability of this class: WiPy.
17+
Availability of this class: pyboard, WiPy.
1818

1919
Constructors
2020
------------

docs/library/machine.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Constants
125125

126126
irq wake values
127127

128-
.. data:: machine.POWER_ON
128+
.. data:: machine.PWRON_RESET
129129
.. data:: machine.HARD_RESET
130130
.. data:: machine.WDT_RESET
131131
.. data:: machine.DEEPSLEEP_RESET

docs/library/pyb.SPI.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Methods
6868
- ``polarity`` can be 0 or 1, and is the level the idle clock line sits at.
6969
- ``phase`` can be 0 or 1 to sample data on the first or second clock edge
7070
respectively.
71+
- ``bits`` can be 8 or 16, and is the number of bits in each transferred word.
7172
- ``firstbit`` can be ``SPI.MSB`` or ``SPI.LSB``.
7273
- ``crc`` can be None for no CRC, or a polynomial specifier.
7374

docs/reference/isr_rules.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ the flag. The memory allocation occurs in the main program code when the object
110110
The MicroPython library I/O methods usually provide an option to use a pre-allocated buffer. For
111111
example ``pyb.i2c.recv()`` can accept a mutable buffer as its first argument: this enables its use in an ISR.
112112

113+
A means of creating an object without employing a class or globals is as follows:
114+
115+
.. code:: python
116+
117+
def set_volume(t, buf=bytearray(3)):
118+
buf[0] = 0xa5
119+
buf[1] = t >> 4
120+
buf[2] = 0x5a
121+
return buf
122+
123+
The compiler instantiates the default ``buf`` argument when the function is
124+
loaded for the first time (usually when the module it's in is imported).
125+
113126
Use of Python objects
114127
~~~~~~~~~~~~~~~~~~~~~
115128

@@ -300,3 +313,20 @@ that access to the critical variables is denied. A simple example of a mutex may
300313
but only for the duration of eight machine instructions: the benefit of this approach is that other interrupts are
301314
virtually unaffected.
302315

316+
Interrupts and the REPL
317+
~~~~~~~~~~~~~~~~~~~~~~~
318+
319+
Interrupt handlers, such as those associated with timers, can continue to run
320+
after a program terminates. This may produce unexpected results where you might
321+
have expected the object raising the callback to have gone out of scope. For
322+
example on the Pyboard:
323+
324+
.. code:: python
325+
326+
def bar():
327+
foo = pyb.Timer(2, freq=4, callback=lambda t: print('.', end=''))
328+
329+
bar()
330+
331+
This continues to run until the timer is explicitly disabled or the board is
332+
reset with ``ctrl D``.

0 commit comments

Comments
 (0)