From 4dfba2f8acec7d76fa61c13fcec662b6d957f69a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 1 Nov 2018 17:14:11 -0400 Subject: [PATCH 1/6] put .frozen before /lib in sys.path; update frozen libraries --- frozen/Adafruit_CircuitPython_BusDevice | 2 +- frozen/Adafruit_CircuitPython_CircuitPlayground | 2 +- frozen/Adafruit_CircuitPython_Crickit | 2 +- frozen/Adafruit_CircuitPython_DotStar | 2 +- frozen/Adafruit_CircuitPython_HID | 2 +- frozen/Adafruit_CircuitPython_IRRemote | 2 +- frozen/Adafruit_CircuitPython_LIS3DH | 2 +- frozen/Adafruit_CircuitPython_Motor | 2 +- frozen/Adafruit_CircuitPython_NeoPixel | 2 +- frozen/Adafruit_CircuitPython_Thermistor | 2 +- frozen/Adafruit_CircuitPython_seesaw | 2 +- main.c | 3 ++- ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk | 2 ++ ports/esp8266/main.c | 3 ++- tools/preprocess_frozen_modules.py | 2 +- 15 files changed, 18 insertions(+), 14 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_BusDevice b/frozen/Adafruit_CircuitPython_BusDevice index 0791964147..d86fc7e81d 160000 --- a/frozen/Adafruit_CircuitPython_BusDevice +++ b/frozen/Adafruit_CircuitPython_BusDevice @@ -1 +1 @@ -Subproject commit 07919641470edb602585c6a91f7b8eacf17e664b +Subproject commit d86fc7e81d51465ca1eae6f8c1141f81f065f5aa diff --git a/frozen/Adafruit_CircuitPython_CircuitPlayground b/frozen/Adafruit_CircuitPython_CircuitPlayground index d0aa6dc56d..f4ee725fb9 160000 --- a/frozen/Adafruit_CircuitPython_CircuitPlayground +++ b/frozen/Adafruit_CircuitPython_CircuitPlayground @@ -1 +1 @@ -Subproject commit d0aa6dc56d66decfae92daced7384c1e3518a666 +Subproject commit f4ee725fb93fd1a31666d3f71d10c94eb96df7c8 diff --git a/frozen/Adafruit_CircuitPython_Crickit b/frozen/Adafruit_CircuitPython_Crickit index 44f52c5dac..412392c8bd 160000 --- a/frozen/Adafruit_CircuitPython_Crickit +++ b/frozen/Adafruit_CircuitPython_Crickit @@ -1 +1 @@ -Subproject commit 44f52c5dacd9fc605565e5794e95c9a785aaf693 +Subproject commit 412392c8bdb6b4378e007eb7974c76b92fa9ff1d diff --git a/frozen/Adafruit_CircuitPython_DotStar b/frozen/Adafruit_CircuitPython_DotStar index af25424ee7..03c24157d4 160000 --- a/frozen/Adafruit_CircuitPython_DotStar +++ b/frozen/Adafruit_CircuitPython_DotStar @@ -1 +1 @@ -Subproject commit af25424ee7dbebea3e5d77390c017018ffa52d36 +Subproject commit 03c24157d46672c723021686f7a838cfeb2db2ba diff --git a/frozen/Adafruit_CircuitPython_HID b/frozen/Adafruit_CircuitPython_HID index 5c2f6ef1ed..f5e70e0925 160000 --- a/frozen/Adafruit_CircuitPython_HID +++ b/frozen/Adafruit_CircuitPython_HID @@ -1 +1 @@ -Subproject commit 5c2f6ef1ed80f24b6a3878067d40350d3725e198 +Subproject commit f5e70e09250f2a25ebb6487a30a763041644c5d3 diff --git a/frozen/Adafruit_CircuitPython_IRRemote b/frozen/Adafruit_CircuitPython_IRRemote index c29e10b590..ec11164ec6 160000 --- a/frozen/Adafruit_CircuitPython_IRRemote +++ b/frozen/Adafruit_CircuitPython_IRRemote @@ -1 +1 @@ -Subproject commit c29e10b590efbdf06163897b49cd0c2bea82ad6e +Subproject commit ec11164ec6682094a48d0f9848d2c4c89c08f3bc diff --git a/frozen/Adafruit_CircuitPython_LIS3DH b/frozen/Adafruit_CircuitPython_LIS3DH index c4152a0d87..6298cd3638 160000 --- a/frozen/Adafruit_CircuitPython_LIS3DH +++ b/frozen/Adafruit_CircuitPython_LIS3DH @@ -1 +1 @@ -Subproject commit c4152a0d87a04903ae0e612eb381af440c9e28b3 +Subproject commit 6298cd363811ad6ac10d4325c898be87a70d7bb2 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index e0b709f171..4421e79661 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit e0b709f1710555da67705360870ba0d14ced7e06 +Subproject commit 4421e79661002ff8da6c0c4f22940ec843ee300b diff --git a/frozen/Adafruit_CircuitPython_NeoPixel b/frozen/Adafruit_CircuitPython_NeoPixel index e9f50cb667..72e8f3855e 160000 --- a/frozen/Adafruit_CircuitPython_NeoPixel +++ b/frozen/Adafruit_CircuitPython_NeoPixel @@ -1 +1 @@ -Subproject commit e9f50cb6678a1684591ee021b95a3c4b51786fee +Subproject commit 72e8f3855ecd136641d536a49311c38ee4f76f33 diff --git a/frozen/Adafruit_CircuitPython_Thermistor b/frozen/Adafruit_CircuitPython_Thermistor index 00f4ebca6c..eae584918e 160000 --- a/frozen/Adafruit_CircuitPython_Thermistor +++ b/frozen/Adafruit_CircuitPython_Thermistor @@ -1 +1 @@ -Subproject commit 00f4ebca6c740b76c1c464f83d514ac20b0600e1 +Subproject commit eae584918e72ff5fa323825470f276b31829ef9f diff --git a/frozen/Adafruit_CircuitPython_seesaw b/frozen/Adafruit_CircuitPython_seesaw index 340cd17fad..e3e3021d85 160000 --- a/frozen/Adafruit_CircuitPython_seesaw +++ b/frozen/Adafruit_CircuitPython_seesaw @@ -1 +1 @@ -Subproject commit 340cd17fad0c29d3a70d6e298a30ecc753df054e +Subproject commit e3e3021d8578fde450511b47a085d9d56ab46741 diff --git a/main.c b/main.c index cbc0b093c3..2484d3f1fe 100644 --- a/main.c +++ b/main.c @@ -92,9 +92,10 @@ void reset_mp(void) { mp_obj_list_init(mp_sys_path, 0); mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script) mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_)); - mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib)); // Frozen modules are in their own pseudo-dir, e.g., ".frozen". + // Prioritize .frozen over /lib. mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_FROZEN_FAKE_DIR_QSTR)); + mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib)); mp_obj_list_init(mp_sys_argv, 0); } diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk index 0f8d0f9ca4..ddc262a570 100644 --- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.mk @@ -10,6 +10,8 @@ LONGINT_IMPL = NONE CHIP_VARIANT = SAMD21E18A CHIP_FAMILY = samd21 +CFLAGS_INLINE_LIMIT = 45 + # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c index c590ab59eb..dda17bb379 100644 --- a/ports/esp8266/main.c +++ b/ports/esp8266/main.c @@ -95,10 +95,11 @@ STATIC void mp_reset(void) { mp_init(); mp_obj_list_init(mp_sys_path, 0); mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script) - mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib)); mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_)); // Frozen modules are in their own pseudo-dir, e.g., ".frozen". + // Prioritize .frozen over /lib. mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_FROZEN_FAKE_DIR_QSTR)); + mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib)); mp_obj_list_init(mp_sys_argv, 0); diff --git a/tools/preprocess_frozen_modules.py b/tools/preprocess_frozen_modules.py index d157deeee9..f2b59ffc0f 100755 --- a/tools/preprocess_frozen_modules.py +++ b/tools/preprocess_frozen_modules.py @@ -33,7 +33,7 @@ def copy_and_process(in_dir, out_dir): for root, subdirs, files in os.walk(in_dir): # Skip library examples directories. - if Path(root).name in ['examples', 'docs']: + if Path(root).name in ['examples', 'tests', 'docs']: continue for file in files: From 4f2f571536727aea7cf8cee68bfd27ed834ede49 Mon Sep 17 00:00:00 2001 From: ATMakersBill Date: Sat, 3 Nov 2018 14:01:30 -0400 Subject: [PATCH 2/6] Adding the serial_bytes_available() method to the 3.x branch --- .../common-hal/supervisor/Runtime.c | 4 +++ ports/nrf/common-hal/supervisor/Runtime.c | 4 +++ shared-bindings/supervisor/Runtime.c | 26 +++++++++++++++++++ shared-bindings/supervisor/Runtime.h | 2 ++ 4 files changed, 36 insertions(+) diff --git a/ports/atmel-samd/common-hal/supervisor/Runtime.c b/ports/atmel-samd/common-hal/supervisor/Runtime.c index 8efe7cb78d..2636fe6465 100755 --- a/ports/atmel-samd/common-hal/supervisor/Runtime.c +++ b/ports/atmel-samd/common-hal/supervisor/Runtime.c @@ -32,3 +32,7 @@ bool common_hal_get_serial_connected(void) { return (bool) usb_connected(); } +bool common_hal_get_serial_bytes_available(void) { + return (bool) usb_bytes_available(); +} + diff --git a/ports/nrf/common-hal/supervisor/Runtime.c b/ports/nrf/common-hal/supervisor/Runtime.c index b73a94a1ba..feab6987d8 100755 --- a/ports/nrf/common-hal/supervisor/Runtime.c +++ b/ports/nrf/common-hal/supervisor/Runtime.c @@ -32,3 +32,7 @@ bool common_hal_get_serial_connected(void) { return (bool) serial_connected(); } +bool common_hal_get_serial_bytes_available(void) { + return (bool) serial_bytes_available(); +} + diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index b061595cf8..27b62abd41 100755 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -53,6 +53,12 @@ //| //| Returns the USB serial communication status (read-only). //| +//| .. attribute:: runtime.serial_bytes_available +//| +//| Returns the whether any bytes are available to read +//| on the USB serial input. Allows for polling to see whether +//| to call the built-in input() or wait. (read-only) +//| //| .. note:: //| //| SAMD: Will return ``True`` if the USB serial connection @@ -80,8 +86,28 @@ const mp_obj_property_t supervisor_serial_connected_obj = { (mp_obj_t)&mp_const_none_obj}, }; +/*Added to allow for polling of USB Console*/ +STATIC mp_obj_t supervisor_get_serial_bytes_available(mp_obj_t self){ + if (!common_hal_get_serial_bytes_available()) { + return mp_const_false; + } + else { + return mp_const_true; + } +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_get_serial_bytes_available_obj, supervisor_get_serial_bytes_available); + +const mp_obj_property_t supervisor_serial_bytes_available_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&supervisor_get_serial_bytes_available_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + + STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_serial_connected_obj) }, + { MP_ROM_QSTR(MP_QSTR_serial_bytes_available), MP_ROM_PTR(&supervisor_serial_bytes_available_obj) }, }; STATIC MP_DEFINE_CONST_DICT(supervisor_runtime_locals_dict, supervisor_runtime_locals_dict_table); diff --git a/shared-bindings/supervisor/Runtime.h b/shared-bindings/supervisor/Runtime.h index 4a67925ece..864b070cdb 100755 --- a/shared-bindings/supervisor/Runtime.h +++ b/shared-bindings/supervisor/Runtime.h @@ -35,6 +35,8 @@ const mp_obj_type_t supervisor_runtime_type; bool common_hal_get_serial_connected(void); +bool common_hal_get_serial_bytes_available(void); + //TODO: placeholders for future functions //bool common_hal_get_repl_active(void); //bool common_hal_get_usb_enumerated(void); From bd4188a0924700d30d53a860c56e4bd4c081608b Mon Sep 17 00:00:00 2001 From: ATMakersBill Date: Sat, 3 Nov 2018 14:42:27 -0400 Subject: [PATCH 3/6] adding changes to mpconfigboard.mk to reduce memory usage on CPX per @danh --- .../boards/circuitplayground_express/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk index 831106adc8..aff875e294 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk @@ -17,3 +17,6 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor + +#Adding per @danh to reduce memory usage and get the latest changes in +CFLAGS_INLINE_LIMIT = 55 From a42515abbc897f5f9d27da53ff7afe6e47deb156 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Tue, 13 Nov 2018 19:41:40 -0600 Subject: [PATCH 4/6] update /docs/drivers.rst page; 19 drivers added --- docs/drivers.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/drivers.rst b/docs/drivers.rst index 37bebb46ac..4c5004d6bd 100644 --- a/docs/drivers.rst +++ b/docs/drivers.rst @@ -66,6 +66,9 @@ These libraries build on top of the low level APIs to simplify common tasks. AVR programming DC Motor and Servo SD Card + miniQR Non-hardware QR code generator + Slideshow + LED Animation Blinky -------- @@ -111,6 +114,7 @@ Motion relating sensing including ``acceleration``, ``magnetic``, ``gyro``, and .. toctree:: + ADXL34x 3 Axis Accelerometer BNO055 Accelerometer, Magnetometer, Gyroscope and Absolution Orientation FXAS21002C Gyroscope FXOS8700 Accelerometer @@ -119,6 +123,7 @@ Motion relating sensing including ``acceleration``, ``magnetic``, ``gyro``, and LSM303 Accelerometer and Magnetometer LSM9DS0 Accelerometer, Magnetometer, Gyroscope and Temperature LSM9DS1 Accelerometer, Magnetometer, Gyroscope and Temperature + MLX90390 3 Axis Mangetometer MMA8451 3 axis accelerometer Environmental Sensors @@ -134,13 +139,18 @@ equivalent carbon dioxide (``eco2`` / ``eCO2``), and total volatile organic comp BME280 Temperature, Humidity and Pressure BME680 Temperature, Humidity, Pressure and Gas BMP280 Barometric Pressure and Altitude + BMP3xx Barometric Pressure and Altimeter CCS811 Air Quality DHT Temperature and Humidity DS18x20 Temperature + HTU21D Temperature and Humidity MAX31865 Thermocouple Amplifier, Temperature MAX31855 Thermocouple Amplifier, Temperature + MAX31856 Thermocouple Amplifier, Temperature MCP9808 Temperature + MP115A2 Barometric Pressure, Temperature MPL3115A2 Barometric Pressure, Altitude and Temperature Sensor + MPRLS Ported Absolute Pressure SGP30 Air Quality SHT31-D Temperature and Humidity Si7021 Temperature and Humidity @@ -161,6 +171,7 @@ These sensors detect light related attributes such as ``color``, ``light`` (unit TSL2591 High Dynamic Range Light Sensor VCNL4010 Proximity and Light VEML6070 UV Index + VEML6075 UV Index Distance Sensors ------------------ @@ -169,6 +180,8 @@ These sensors measure the ``distance`` to another object and may also measure li .. toctree:: + Garmin LIDARLite I2C + TFmini IR Time of Flight ~30cm - 12m VL6180x 5 - 100 mm VL53L0x ~30 - 1000 mm @@ -179,6 +192,7 @@ These chips communicate to other's over radio. .. toctree:: + Adafruit Bluefruit LE SPI Friend RFM9x LoRa RFM69 Packet Radio @@ -206,9 +220,12 @@ Miscellaneous .. toctree:: + CAP1188 8-Key Capacitive Touch Si4713 Stereo FM Transmitter AMG88xx Grid-Eye IR Camera Trellis 4x4 Keypad + NeoTrellis 4x4 Keypad + NeoTrellis M4 4x8 Keypad DRV2605 Haptic Motor Controller MAX9744 Audio Amplifier Si5351 Clock Generator @@ -216,3 +233,5 @@ Miscellaneous VC0706 TTL Camera INA219 High Side Current Fingerprint + VS1053 Audio Codec + FRAM Non-Volatile Memory From df663e42e939b50ad61cf192dc708e1495882887 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Wed, 14 Nov 2018 22:02:19 -0600 Subject: [PATCH 5/6] remove pca10056 from 3.x travis builds --- tools/build_adafruit_bins.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_adafruit_bins.sh b/tools/build_adafruit_bins.sh index 29ee35c6ad..961162bd3b 100755 --- a/tools/build_adafruit_bins.sh +++ b/tools/build_adafruit_bins.sh @@ -2,7 +2,7 @@ rm -rf ports/atmel-samd/build* rm -rf ports/esp8266/build* rm -rf ports/nrf/build* -ATMEL_BOARDS="arduino_zero circuitplayground_express circuitplayground_express_crickit feather_m0_basic feather_m0_adalogger itsybitsy_m0_express itsybitsy_m4_express feather_m0_rfm69 feather_m0_rfm9x feather_m0_express feather_m0_express_crickit feather_m4_express metro_m0_express metro_m4_express pirkey_m0 trinket_m0 gemma_m0 feather52832 feather_huzzah pca10056 hallowing_m0_express" +ATMEL_BOARDS="arduino_zero circuitplayground_express circuitplayground_express_crickit feather_m0_basic feather_m0_adalogger itsybitsy_m0_express itsybitsy_m4_express feather_m0_rfm69 feather_m0_rfm9x feather_m0_express feather_m0_express_crickit feather_m4_express metro_m0_express metro_m4_express pirkey_m0 trinket_m0 gemma_m0 feather52832 feather_huzzah hallowing_m0_express" ROSIE_SETUPS="rosie-ci" PARALLEL="-j 5" From 3f9b0f764d7977aa891bae8fd49ddbc31a81f50a Mon Sep 17 00:00:00 2001 From: sommersoft Date: Wed, 14 Nov 2018 22:18:32 -0600 Subject: [PATCH 6/6] remove pca10056 from 3.x .travis.yml too --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3f123fe6eb..330a16e41f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ env: - TRAVIS_BOARD=gemma_m0 - TRAVIS_BOARD=hallowing_m0_express - TRAVIS_BOARD=feather52832 - - TRAVIS_BOARD=pca10056 +# - TRAVIS_BOARD=pca10056 - TRAVIS_TEST=qemu - TRAVIS_TEST=unix - TRAVIS_TEST=docs