Skip to content

Commit 435e894

Browse files
committed
Merge branch 'master' into 3.0_hid
2 parents d005b12 + 98c7d70 commit 435e894

85 files changed

Lines changed: 769 additions & 1202 deletions

Some content is hidden

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

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
path = lib/stm32lib
3434
url = https://github.com/micropython/stm32lib
3535
branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0
36-
[submodule "freetouch2"]
37-
path = ports/atmel-samd/freetouch
38-
url = https://github.com/adafruit/Adafruit_FreeTouch.git
3936
[submodule "atmel-samd/asf4"]
4037
path = ports/atmel-samd/asf4
4138
url = https://github.com/adafruit/asf4.git
@@ -46,3 +43,6 @@
4643
[submodule "lib/nrfutil"]
4744
path = lib/nrfutil
4845
url = https://github.com/adafruit/nRF52_nrfutil
46+
[submodule "ports/atmel-samd/freetouch"]
47+
path = ports/atmel-samd/freetouch
48+
url = https://github.com/adafruit/Adafruit_FreeTouch.git

.travis.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ env:
1111
- TRAVIS_BOARD=feather_m0_rfm69
1212
- TRAVIS_BOARD=feather_m0_rfm9x
1313
- TRAVIS_BOARD=feather_m0_express
14+
- TRAVIS_BOARD=feather_m4_express
1415
- TRAVIS_BOARD=itsybitsy_m0_express
1516
- TRAVIS_BOARD=metro_m0_express
1617
- TRAVIS_BOARD=metro_m4_express
@@ -77,24 +78,24 @@ script:
7778
- echo -en 'travis_fold:end:qemu\\r'
7879

7980
# run tests without coverage info
80-
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests)
81-
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native)
81+
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests -j1)
82+
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests -j1 --emit native)
8283

8384
# run tests with coverage info
8485
- echo 'Test all' && echo -en 'travis_fold:start:test_all\\r'
85-
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests))
86+
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1))
8687
- echo -en 'travis_fold:end:test_all\\r'
8788

8889
- echo 'Test threads' && echo -en 'travis_fold:start:test_threads\\r'
89-
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -d thread))
90+
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread))
9091
- echo -en 'travis_fold:end:test_threads\\r'
9192

9293
- echo 'Testing with native' && echo -en 'travis_fold:start:test_native\\r'
93-
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --emit native))
94+
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native))
9495
- echo -en 'travis_fold:end:test_native\\r'
9596

9697
- (echo 'Testing with mpy' && echo -en 'travis_fold:start:test_mpy\\r')
97-
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --via-mpy -d basics float))
98+
- ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float))
9899
- echo -en 'travis_fold:end:test_mpy\\r'
99100

100101
- (echo 'Building docs' && echo -en 'travis_fold:start:build_docs\\r')

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ so will result in corrective actions such as time out or ban from the project.
88
## Developer contact
99
[@tannewt](https://github.com/tannewt) is the main developer of CircuitPython
1010
and is sponsored by [Adafruit Industries LLC](https://adafruit.com). He is
11-
reachable on [Discord](https://adafru.it/discord) as tannewt and
12-
[Gitter](gitter.im/adafruit/circuitpython) as tannewt during US West Coast
11+
reachable on [Discord](https://adafru.it/discord) as tannewt during US West Coast
1312
working hours. He also checks GitHub issues and the [Adafruit support forum](https://forums.adafruit.com/viewforum.php?f=60).
1413

1514
## Licensing

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ Conduct <https://github.com/adafruit/circuitpython/blob/master/CODE_OF_CONDUCT.m
8383
Contributors who follow the `Code of
8484
Conduct <https://github.com/adafruit/circuitpython/blob/master/CODE_OF_CONDUCT.md>`__
8585
are welcome to submit pull requests and they will be promptly reviewed
86-
by project admins. Please join the `Gitter
87-
chat <https://gitter.im/adafruit/circuitpython>`__ or
86+
by project admins. Please join the
8887
`Discord <https://discord.gg/nBQh6qu>`__ too.
8988

9089
--------------

docs/drivers.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Multi-color led drivers.
7676

7777
NeoPixel <https://circuitpython.readthedocs.io/projects/neopixel/en/latest/>
7878
DotStar <https://circuitpython.readthedocs.io/projects/dotstar/en/latest/>
79+
WS2801 <https://circuitpython.readthedocs.io/projects/ws2801/en/latest/>
7980

8081
Displays
8182
-------------
@@ -111,7 +112,7 @@ Motion relating sensing including ``acceleration``, ``magnetic``, ``gyro``, and
111112
.. toctree::
112113

113114
BNO055 Accelerometer, Magnetometer, Gyroscope and Absolution Orientation <https://circuitpython.readthedocs.io/projects/bno055/en/latest/>
114-
FXAS21002C Gyroscope <https://circuitpython.readthedocs.io/projects/fxas21002C/en/latest/>
115+
FXAS21002C Gyroscope <https://circuitpython.readthedocs.io/projects/fxas21002c/en/latest/>
115116
FXOS8700 Accelerometer <https://circuitpython.readthedocs.io/projects/fxos8700/en/latest/>
116117
GPS Global Position <https://circuitpython.readthedocs.io/projects/gps/en/latest/>
117118
LIS3DH Accelerometer <https://circuitpython.readthedocs.io/projects/lis3dh/en/latest/>
@@ -154,6 +155,7 @@ These sensors detect light related attributes such as ``color``, ``light`` (unit
154155
.. toctree::
155156

156157
APDS9960 Proximity, Light, RGB, and Gesture <https://circuitpython.readthedocs.io/projects/apds9960/en/latest/>
158+
AS726x Color Spectrum Sensor <https://circuitpython.readthedocs.io/projects/as726x/en/latest/>
157159
TCS34725 Color Sensor <https://circuitpython.readthedocs.io/projects/tcs34725/en/latest/>
158160
TSL2561 Light Sensor <https://circuitpython.readthedocs.io/projects/tsl2561/en/latest/>
159161
TSL2591 High Dynamic Range Light Sensor <https://circuitpython.readthedocs.io/projects/tsl2591/en/latest/>
@@ -191,6 +193,7 @@ These provide functionality similar to `analogio`, `digitalio`, `pulseio`, and `
191193
ADS1x15 Analog-to-Digital Converter <https://circuitpython.readthedocs.io/projects/ads1x15/en/latest/>
192194
DS2413 OneWire GPIO Expander <https://circuitpython.readthedocs.io/projects/ds2413/en/latest/>
193195
FocalTech Capacitive Touch <https://circuitpython.readthedocs.io/projects/focaltouch/en/latest/>
196+
MCP230xx GPIO Expander <https://circuitpython.readthedocs.io/projects/mcp230xx/en/latest/>
194197
MCP4725 Digital-to-Analog Converter <https://circuitpython.readthedocs.io/projects/mcp4725/en/latest/>
195198
PCA9685 16 x 12-bit PWM Driver <https://circuitpython.readthedocs.io/projects/pca9685/en/latest/>
196199
TLC5947 24 x 12-bit PWM Driver <https://circuitpython.readthedocs.io/projects/tlc5947/en/latest/>

extmod/vfs_fat.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#endif
3434

3535
#include <string.h>
36+
#include "py/objproperty.h"
3637
#include "py/runtime.h"
3738
#include "py/mperrno.h"
3839
#include "lib/oofatfs/ff.h"
@@ -317,6 +318,39 @@ STATIC mp_obj_t vfs_fat_umount(mp_obj_t self_in) {
317318
}
318319
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_umount_obj, vfs_fat_umount);
319320

321+
#if MICROPY_FATFS_USE_LABEL
322+
STATIC mp_obj_t vfs_fat_getlabel(mp_obj_t self_in) {
323+
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
324+
char working_buf[12];
325+
FRESULT res = f_getlabel(&self->fatfs, working_buf, NULL);
326+
if (res != FR_OK) {
327+
mp_raise_OSError(fresult_to_errno_table[res]);
328+
}
329+
return mp_obj_new_str(working_buf, strlen(working_buf), false);
330+
}
331+
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getlabel_obj, vfs_fat_getlabel);
332+
333+
static mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
334+
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
335+
const char *label_str = mp_obj_str_get_str(label_in);
336+
FRESULT res = f_setlabel(&self->fatfs, label_str);
337+
if (res != FR_OK) {
338+
if(res == FR_WRITE_PROTECTED) {
339+
mp_raise_msg(&mp_type_OSError, "Read-only filesystem");
340+
}
341+
mp_raise_OSError(fresult_to_errno_table[res]);
342+
}
343+
return mp_const_none;
344+
}
345+
STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_setlabel_obj, vfs_fat_setlabel);
346+
STATIC const mp_obj_property_t fat_vfs_label_obj = {
347+
.base.type = &mp_type_property,
348+
.proxy = {(mp_obj_t)&fat_vfs_getlabel_obj,
349+
(mp_obj_t)&fat_vfs_setlabel_obj,
350+
(mp_obj_t)&mp_const_none_obj},
351+
};
352+
#endif
353+
320354
STATIC const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
321355
{ MP_ROM_QSTR(MP_QSTR_mkfs), MP_ROM_PTR(&fat_vfs_mkfs_obj) },
322356
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&fat_vfs_open_obj) },
@@ -331,6 +365,9 @@ STATIC const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
331365
{ MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&fat_vfs_statvfs_obj) },
332366
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&vfs_fat_mount_obj) },
333367
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&fat_vfs_umount_obj) },
368+
#if MICROPY_FATFS_USE_LABEL
369+
{ MP_ROM_QSTR(MP_QSTR_label), MP_ROM_PTR(&fat_vfs_label_obj) },
370+
#endif
334371
};
335372
STATIC MP_DEFINE_CONST_DICT(fat_vfs_locals_dict, fat_vfs_locals_dict_table);
336373

extmod/vfs_fat_file.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,7 @@ STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
125125
break;
126126

127127
case 1: // SEEK_CUR
128-
if (s->offset != 0) {
129-
*errcode = MP_EOPNOTSUPP;
130-
return MP_STREAM_ERROR;
131-
}
132-
// no-operation
128+
f_lseek(&self->fp, f_tell(&self->fp) + s->offset);
133129
break;
134130

135131
case 2: // SEEK_END

ports/atmel-samd/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ BASE_CFLAGS = \
7272
-Wnested-externs \
7373
-Wunreachable-code \
7474
-Wcast-align \
75-
-Wno-error=lto-type-mismatch \
7675
-D__$(CHIP_VARIANT)__ \
7776
-ffunction-sections \
7877
-fdata-sections \

ports/atmel-samd/README.rst

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,54 @@ PB03 **Yes** **Yes** **Yes** **Yes**
115115

116116
Setup
117117
-----
118-
Install required compiler packages:
118+
119+
An ARM compiler is required for the build, along with the associated binary
120+
utilities. On Ubuntu, these can be installed as follows:
119121

120122
.. code-block:: shell
121123
122124
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
123125
sudo apt-get install gcc-arm-embedded
124126
127+
On Arch Linux the compiler is available for via the package
128+
``arm-none-eabi-gcc``.
129+
130+
For other systems, the `GNU Arm Embedded Toolchain <https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads>`_
131+
may be available in binary form.
132+
133+
The latest available package from team-gcc-arm-embedded is used to produce the
134+
binaries shipped by AdaFruit. Other compiler versions, particularly older
135+
ones, may not work properly. In particular, the ``gcc-arm-none-eabi`` package
136+
in Debian Stretch is too old.
137+
138+
The compiler can be changed using the ``CROSS_COMPILE`` variable when invoking
139+
``make``.
140+
125141
Building
126142
--------
127143

144+
Before building the firmware for a given board, there are two additional steps.
145+
These commands should be executed from the root directory of the repository
146+
(``circuitpython/``).
147+
148+
1. There are various submodules that reside in different repositories. In order
149+
to have these submodules locally, you must pull them into your clone, using:
150+
151+
.. code-block:: shell
152+
153+
git submodule update --init --recursive
154+
155+
2. The MicroPython cross-compiler must be built; it will be used to pre-compile
156+
some of the built-in scripts to bytecode. The cross-compiler is built and
157+
run on the host machine, using:
158+
159+
.. code-block:: shell
160+
161+
make -C mpy-cross
162+
163+
164+
Build commands are run from the ``circuitpython/ports/atmel-samd`` directory.
165+
128166
To build for the Arduino Zero:
129167

130168
.. code-block:: shell

ports/atmel-samd/boards/circuitplayground_express/pins.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@
22

33
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
44
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
5+
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA02) },
56
{ MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_PA02) },
67
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) },
8+
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA05) },
79
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA06) },
10+
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA06) },
811
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA07) },
12+
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA07) },
913
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB03) },
14+
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB03) },
1015
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) },
1116
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) },
17+
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB02) },
1218
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) },
1319
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB09) },
20+
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB09) },
1421
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB09) },
1522
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB08) },
23+
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB08) },
1624
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB08) },
1725
{ MP_ROM_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PA11) },
1826
{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA11) },

0 commit comments

Comments
 (0)