diff --git a/CHANGELOG.md b/CHANGELOG.md index 65648e861ca72314e2e10e797fdddf7cf7cf5088..78dfc0332b2e17a5281d7f17759dd1754d468fdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Added +- `micropython.mem_use()` function. +- High-pass filter and pulse detection in default ECG app. + +### Fixed +- Backlight and Vibration motor were not reset when switching apps. +- Mismatch in default settings of the *Card10 Nickname* app. ## [v1.9] - 2019-08-28 23:23 - [IcebergLettuce] diff --git a/Documentation/bluetooth/card10.rst b/Documentation/bluetooth/card10.rst index a88115119cbb7fb255434c504f1e403914efdca5..16bf38e18c5beabcd78523b2b7626b6d232739ca 100644 --- a/Documentation/bluetooth/card10.rst +++ b/Documentation/bluetooth/card10.rst @@ -33,22 +33,22 @@ The current draft uses following service specification: - Background LED Bottom Left characteristic: UUID: ``42230211-2342-2342-2342-234223422342`` - write no response + read and write no response - Background LED Bottom Right characteristic: UUID: ``42230212-2342-2342-2342-234223422342`` - write no response + read and write no response - Background LED Top Right characteristic: UUID: ``42230213-2342-2342-2342-234223422342`` - write no response + read and write no response - Background LED Top Left characteristic: UUID: ``42230214-2342-2342-2342-234223422342`` - write no reponse + read and write no reponse - LEDS dim bottom characteristic: @@ -78,7 +78,7 @@ The current draft uses following service specification: - LEDs above characteristic: UUID: ``42230220-2342-2342-2342-234223422342`` - write no reponse + read and write no reponse - Light sensor characteristic: @@ -120,7 +120,7 @@ Background LED <Position> characteristic ---------------------------------------- The Background LEDs <Position> characteristic makes it possible to address the bottom LEDs by position. -Just write there three ``uint8`` for the rgb color. +Just write there three ``uint8`` for the rgb color or read the current value. Dataformat: @@ -170,7 +170,7 @@ It writes always as persistant and it gives feedback if the value is in range an LEDs above characteristic --------------------------------- -This characteristic set every 11 leds on the top module at once. +This characteristic set or read the current value of every 11 leds on the top module at once. By defining 11x rgb from left to right. You need also to set exchange a bigger MTU to use this feature. - set a rainbow beginnig with red on the right edge: ``0xff0000ff8b00e8ff005dff0000ff2e00ffb900b9ff002eff5d00ffe800ffff008b`` diff --git a/epicardium/ble/card10.c b/epicardium/ble/card10.c index 78e128bb4e82ac74133614cad0ef56cd0f198d89..ebea5b3a09a339548ab59f3f080d3605b6ce9223 100644 --- a/epicardium/ble/card10.c +++ b/epicardium/ble/card10.c @@ -125,7 +125,7 @@ static const uint8_t UUID_attChar_rockets[] = { /* BLE UUID for card10 led background bottom left */ static const uint8_t UUID_char_led_bg_bottom_left[] = { - ATT_PROP_WRITE_NO_RSP, + ATT_PROP_READ | ATT_PROP_WRITE_NO_RSP, UINT16_TO_BYTES(CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL), CARD10_UUID_SUFFIX, 0x11, CARD10_UUID_PREFIX }; @@ -134,9 +134,13 @@ static const uint8_t UUID_attChar_led_bg_bottom_left[] = { CARD10_UUID_SUFFIX, 0x11, CARD10_UUID_PREFIX }; +static uint8_t ledBGBottomLeftValue[] = { 0,0,0 }; +// works vor everyone? +static uint16_t rgbLen = sizeof(ledBGBottomLeftValue); + /* BLE UUID for card10 led background bottom right */ static const uint8_t UUID_char_led_bg_bottom_right[] = { - ATT_PROP_WRITE_NO_RSP, + ATT_PROP_READ | ATT_PROP_WRITE_NO_RSP, UINT16_TO_BYTES(CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL), CARD10_UUID_SUFFIX, 0x12, CARD10_UUID_PREFIX }; @@ -145,9 +149,11 @@ static const uint8_t UUID_attChar_led_bg_bottom_right[] = { CARD10_UUID_SUFFIX, 0x12, CARD10_UUID_PREFIX }; +static uint8_t ledBGBottomRightValue[] = { 0,0,0 }; + /* BLE UUID for card10 led background top right */ static const uint8_t UUID_char_led_bg_top_right[] = { - ATT_PROP_WRITE_NO_RSP, + ATT_PROP_READ | ATT_PROP_WRITE_NO_RSP, UINT16_TO_BYTES(CARD10_LED_BG_TOP_RIGHT_VAL_HDL), CARD10_UUID_SUFFIX, 0x13, CARD10_UUID_PREFIX }; @@ -156,9 +162,11 @@ static const uint8_t UUID_attChar_led_bg_top_right[] = { CARD10_UUID_SUFFIX, 0x13, CARD10_UUID_PREFIX }; +static uint8_t ledBGTopRightValue[] = { 0,0,0 }; + /* BLE UUID for card10 led background top left */ static const uint8_t UUID_char_led_bg_top_left[] = { - ATT_PROP_WRITE_NO_RSP, + ATT_PROP_READ | ATT_PROP_WRITE_NO_RSP, UINT16_TO_BYTES(CARD10_LED_BG_TOP_LEFT_VAL_HDL), CARD10_UUID_SUFFIX, 0x14, CARD10_UUID_PREFIX }; @@ -167,6 +175,8 @@ static const uint8_t UUID_attChar_led_bg_top_left[] = { CARD10_UUID_SUFFIX, 0x14, CARD10_UUID_PREFIX }; +static uint8_t ledBGTopLeftValue[] = { 0,0,0 }; + /* BLE UUID for card10 dim leds on bottom */ static const uint8_t UUID_char_leds_bottom_dim[] = { ATT_PROP_WRITE, @@ -227,7 +237,7 @@ static uint16_t personalStateLen = sizeof(personalStateValue); /* BLE UUID for card10 above leds */ static const uint8_t UUID_char_leds_above[] = { - ATT_PROP_WRITE_NO_RSP, + ATT_PROP_READ | ATT_PROP_WRITE_NO_RSP, UINT16_TO_BYTES(CARD10_LEDS_ABOVE_VAL_HDL), CARD10_UUID_SUFFIX, 0x20, CARD10_UUID_PREFIX }; @@ -235,6 +245,21 @@ static const uint8_t UUID_char_leds_above[] = { static const uint8_t UUID_attChar_leds_above[] = { CARD10_UUID_SUFFIX, 0x20, CARD10_UUID_PREFIX }; +static uint8_t aboveLEDsValue[] = { + 0,0,0, // 0 + 0,0,0, // 1 + 0,0,0, // 2 + 0,0,0, // 3 + 0,0,0, // 4 + 0,0,0, // 5 + 0,0,0, // 6 + 0,0,0, // 7 + 0,0,0, // 8 + 0,0,0, // 9 + 0,0,0, // 10 +}; +static uint16_t aboveLEDsLen = sizeof(aboveLEDsValue); + // starting at 0xf0 with read only characteristics /* BLE UUID for card10 char light sensor */ @@ -331,11 +356,13 @@ static const attsAttr_t card10SvcAttrList[] = { }, { .pUuid = UUID_attChar_led_bg_bottom_left, - .pValue = NULL, + .pValue = ledBGBottomLeftValue, + .pLen = &rgbLen, .maxLen = 3 * sizeof(uint8_t), - .settings = ATTS_SET_WRITE_CBACK, + .settings = ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK, .permissions = ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC | - ATTS_PERMIT_WRITE_AUTH, + ATTS_PERMIT_WRITE_AUTH | ATTS_PERMIT_READ | + ATTS_PERMIT_READ_ENC | ATTS_PERMIT_READ_AUTH, }, // BG LED Bottom right @@ -349,15 +376,16 @@ static const attsAttr_t card10SvcAttrList[] = { }, { .pUuid = UUID_attChar_led_bg_bottom_right, - .pValue = NULL, + .pValue = ledBGBottomRightValue, + .pLen = &rgbLen, .maxLen = 3 * sizeof(uint8_t), - .settings = ATTS_SET_WRITE_CBACK, + .settings = ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK, .permissions = ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC | - ATTS_PERMIT_WRITE_AUTH, + ATTS_PERMIT_WRITE_AUTH | ATTS_PERMIT_READ | + ATTS_PERMIT_READ_ENC | ATTS_PERMIT_READ_AUTH, }, // BG LED top right - { .pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_led_bg_top_right, @@ -368,11 +396,13 @@ static const attsAttr_t card10SvcAttrList[] = { }, { .pUuid = UUID_attChar_led_bg_top_right, - .pValue = NULL, + .pValue = ledBGTopRightValue, + .pLen = &rgbLen, .maxLen = 3 * sizeof(uint8_t), - .settings = ATTS_SET_WRITE_CBACK, + .settings = ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK, .permissions = ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC | - ATTS_PERMIT_WRITE_AUTH, + ATTS_PERMIT_WRITE_AUTH | ATTS_PERMIT_READ | + ATTS_PERMIT_READ_ENC | ATTS_PERMIT_READ_AUTH, }, // BG LED top left @@ -386,11 +416,13 @@ static const attsAttr_t card10SvcAttrList[] = { }, { .pUuid = UUID_attChar_led_bg_top_left, - .pValue = NULL, + .pValue = ledBGTopLeftValue, + .pLen = &rgbLen, .maxLen = 3 * sizeof(uint8_t), - .settings = ATTS_SET_WRITE_CBACK, + .settings = ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK, .permissions = ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC | - ATTS_PERMIT_WRITE_AUTH, + ATTS_PERMIT_WRITE_AUTH | ATTS_PERMIT_READ | + ATTS_PERMIT_READ_ENC | ATTS_PERMIT_READ_AUTH, }, // Dim bottom module @@ -497,11 +529,13 @@ static const attsAttr_t card10SvcAttrList[] = { }, { .pUuid = UUID_attChar_leds_above, - .pValue = NULL, + .pValue = aboveLEDsValue, + .pLen = &aboveLEDsLen, .maxLen = 11 * 3 * sizeof(uint8_t), - .settings = ATTS_SET_WRITE_CBACK, + .settings = ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK, .permissions = ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC | - ATTS_PERMIT_WRITE_AUTH, + ATTS_PERMIT_WRITE_AUTH | ATTS_PERMIT_READ | + ATTS_PERMIT_READ_ENC | ATTS_PERMIT_READ_AUTH, }, // Light sensor @@ -544,6 +578,38 @@ static uint8_t setTime(uint8_t *pValue) return ATT_SUCCESS; } +/* + * Set a rgb led + */ +static uint8_t setRGBLed(uint8_t led, uint8_t *pValue) +{ + epic_leds_set(led, pValue[0], pValue[1], pValue[2]); + APP_TRACE_INFO4( + "ble-card10: set rgb led %d: #%02x%02x%02x\n", + led, + pValue[0], + pValue[1], + pValue[2] + ); + return ATT_SUCCESS; +} + +/* + * Get value of a rgb led + */ +static uint8_t getRGBLed(uint8_t led, attsAttr_t *pAttr) +{ + epic_leds_get_rgb(led, pAttr->pValue); + APP_TRACE_INFO4( + "ble-card10: set rgb led %d: #%02x%02x%02x\n", + led, + pAttr->pValue[0], + pAttr->pValue[1], + pAttr->pValue[2] + ); + return ATT_SUCCESS; +} + /* * BLE card10 write callback. */ @@ -584,41 +650,13 @@ static uint8_t writeCard10CB( return ATT_SUCCESS; // bg leds case CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL: - epic_leds_set(11, pValue[0], pValue[1], pValue[2]); - APP_TRACE_INFO3( - "ble-card10: set bg bottom left: #%02x%02x%02x\n", - pValue[0], - pValue[1], - pValue[2] - ); - return ATT_SUCCESS; + return setRGBLed(11, pValue); case CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL: - epic_leds_set(12, pValue[0], pValue[1], pValue[2]); - APP_TRACE_INFO3( - "ble-card10: set bg bottom right: #%02x%02x%02x\n", - pValue[0], - pValue[1], - pValue[2] - ); - return ATT_SUCCESS; + return setRGBLed(12, pValue); case CARD10_LED_BG_TOP_RIGHT_VAL_HDL: - epic_leds_set(13, pValue[0], pValue[1], pValue[2]); - APP_TRACE_INFO3( - "ble-card10: set bg top right: #%02x%02x%02x\n", - pValue[0], - pValue[1], - pValue[2] - ); - return ATT_SUCCESS; + return setRGBLed(13, pValue); case CARD10_LED_BG_TOP_LEFT_VAL_HDL: - epic_leds_set(14, pValue[0], pValue[1], pValue[2]); - APP_TRACE_INFO3( - "ble-card10: set bg top left: #%02x%02x%02x\n", - pValue[0], - pValue[1], - pValue[2] - ); - return ATT_SUCCESS; + return setRGBLed(14, pValue); // dim case CARD10_LEDS_BOTTOM_DIM_VAL_HDL: ui8 = pValue[0]; @@ -769,8 +807,10 @@ static uint8_t readCard10CB( ) { uint16_t ui16 = 0; uint64_t ui64 = 0; + uint8_t rgb[] = { 0, 0, 0 }; switch (handle) { + // time case CARD10_TIME_VAL_HDL: ui64 = epic_rtc_get_milliseconds(); uint64_t time; @@ -780,11 +820,38 @@ static uint8_t readCard10CB( APP_TRACE_INFO0("ble-card10: read time\n"); return ATT_SUCCESS; + // background leds + case CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL: + return getRGBLed(11, pAttr); + case CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL: + return getRGBLed(12, pAttr); + case CARD10_LED_BG_TOP_RIGHT_VAL_HDL: + return getRGBLed(13, pAttr); + case CARD10_LED_BG_TOP_LEFT_VAL_HDL: + return getRGBLed(14, pAttr); + // personal state case CARD10_PERSONAL_STATE_VAL_HDL: ui16 = epic_personal_state_get(); *pAttr->pValue = ui16; APP_TRACE_INFO1("ble-card10: read personal state: %d\n", ui16); return ATT_SUCCESS; + // leds above + case CARD10_LEDS_ABOVE_VAL_HDL: + for (ui16 = 0; ui16 < 11; ui16++) { + epic_leds_get_rgb(ui16, rgb); + pAttr->pValue[ui16 * 3] = rgb[0]; + pAttr->pValue[ui16 * 3 + 1] = rgb[1]; + pAttr->pValue[ui16 * 3 + 2] = rgb[2]; + APP_TRACE_INFO4( + "ble-card10: get led %ld above to #%02x%02x%02x\n", + ui16, + pAttr->pValue[ui16 * 3], + pAttr->pValue[ui16 * 3 + 1], + pAttr->pValue[ui16 * 3 + 2] + ); + } + return ATT_SUCCESS; + // light sensor case CARD10_LIGHT_SENSOR_VAL_HDL: epic_light_sensor_get(&ui16); *pAttr->pValue = ui16; diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index ff8fb0f6b2e55dc1cfe4b341d2d82dde791b02ae..7e9aba5aa203beccdacc9fc7f22d11b1c95c2b70 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -97,6 +97,7 @@ typedef _Bool bool; #define API_LEDS_SET_ALL_HSV 0x6b #define API_LEDS_SET_GAMMA_TABLE 0x6c #define API_LEDS_CLEAR_ALL 0x6d +#define API_LEDS_GET 0x6f #define API_VIBRA_SET 0x70 #define API_VIBRA_VIBRATE 0x71 @@ -149,6 +150,13 @@ typedef uint32_t api_int_id_t; * the other direction. These interrupts can be enabled/disabled * (masked/unmasked) using :c:func:`epic_interrupt_enable` and * :c:func:`epic_interrupt_disable`. + * + * .. warning:: + * + * Never attempt to call the API from inside an ISR. This might trigger an + * assertion if a call is already being made from thread context. We plan to + * lift this restriction at some point, but for the time being, this is how + * it is. */ /** @@ -176,17 +184,16 @@ API(API_INTERRUPT_DISABLE, int epic_interrupt_disable(api_int_id_t int_id)); #define EPIC_INT_CTRL_C 1 /** UART Receive interrupt. See :c:func:`epic_isr_uart_rx`. */ #define EPIC_INT_UART_RX 2 -/** RTC Alarm interrupt. See :c:func:`epic_isr_rtc_alarm` */ +/** RTC Alarm interrupt. See :c:func:`epic_isr_rtc_alarm`. */ #define EPIC_INT_RTC_ALARM 3 -/** BHI */ +/** BHI180 Accelerometer. See :c:func:`epic_isr_bhi160_accelerometer`. */ #define EPIC_INT_BHI160_ACCELEROMETER 4 -API_ISR(EPIC_INT_BHI160_ACCELEROMETER, epic_isr_bhi160_accelerometer); +/** BHI180 Orientation Sensor. See :c:func:`epic_isr_bhi160_orientation`. */ #define EPIC_INT_BHI160_ORIENTATION 5 -API_ISR(EPIC_INT_BHI160_ORIENTATION, epic_isr_bhi160_orientation); +/** BHI180 Gyroscope. See :c:func:`epic_isr_bhi160_gyroscope`. */ #define EPIC_INT_BHI160_GYROSCOPE 6 -API_ISR(EPIC_INT_BHI160_GYROSCOPE, epic_isr_bhi160_gyroscope); +/** MAX30001 ECG. See :c:func:`epic_isr_max30001_ecg`. */ #define EPIC_INT_MAX30001_ECG 7 -API_ISR(EPIC_INT_MAX30001_ECG, epic_isr_max30001_ecg); /* Number of defined interrupts. */ #define EPIC_INT_NUM 8 @@ -304,8 +311,7 @@ API(API_THERMISTOR_VOLTAGE, int epic_read_thermistor_voltage(float *result)); * :param length: Amount of bytes to print. */ API(API_UART_WRITE_STR, void epic_uart_write_str( - const char *str, - intptr_t length + const char *str, intptr_t length )); /** @@ -331,7 +337,7 @@ API(API_UART_READ_CHAR, int epic_uart_read_char(void)); API(API_UART_READ_STR, int epic_uart_read_str(char *buf, size_t cnt)); /** - * **Interrupt Service Routine** + * **Interrupt Service Routine** for :c:data:`EPIC_INT_UART_RX` * * UART receive interrupt. This interrupt is triggered whenever a new character * becomes available on any connected UART device. This function is weakly @@ -361,7 +367,7 @@ API(API_UART_READ_STR, int epic_uart_read_str(char *buf, size_t cnt)); API_ISR(EPIC_INT_UART_RX, epic_isr_uart_rx); /** - * **Interrupt Service Routine** + * **Interrupt Service Routine** for :c:data:`EPIC_INT_CTRL_C` * * A user-defineable ISR which is triggered when a ``^C`` (``0x04``) is received * on any serial input device. This function is weakly aliased to @@ -489,7 +495,9 @@ enum gpio_mode { * :param uint8_t mode: Mode to be configured. Use a combination of the :c:type:`gpio_mode` flags. * :returns: ``0`` if the mode was set, ``-EINVAL`` if ``pin`` is not valid or the mode could not be set. */ -API(API_GPIO_SET_PIN_MODE, int epic_gpio_set_pin_mode(uint8_t pin, uint8_t mode)); +API(API_GPIO_SET_PIN_MODE, int epic_gpio_set_pin_mode( + uint8_t pin, uint8_t mode +)); /** * Get the mode of a card10 GPIO pin. @@ -584,6 +592,19 @@ API(API_GPIO_READ_PIN, int epic_gpio_read_pin(uint8_t pin)); */ API(API_LEDS_SET, void epic_leds_set(int led, uint8_t r, uint8_t g, uint8_t b)); + +/** + * Get one of card10's RGB LEDs in format of RGB. + * + * :c:func:`epic_leds_get_rgb` will get the value of a RGB LED described by ``led``. + * + * :param int led: Which LED to get. 0-10 are the LEDs on the top and 11-14 + * are the 4 "ambient" LEDs. + * :param uint8_t * rgb: need tree byte array to get the value of red, green and blue. + * :returns: ``0`` on success or ``-EPERM`` if the LED is blocked by personal-state. + */ +API(API_LEDS_GET, int epic_leds_get_rgb(int led, uint8_t * rgb)); + /** * Set one of card10's RGB LEDs to a certain color in HSV format. * @@ -596,7 +617,9 @@ API(API_LEDS_SET, void epic_leds_set(int led, uint8_t r, uint8_t g, uint8_t b)); * :param float s: Saturation component of the color. (0 <= s <= 1) * :param float v: Value/Brightness component of the color. (0 <= v <= 0) */ -API(API_LEDS_SET_HSV, void epic_leds_set_hsv(int led, float h, float s, float v)); +API(API_LEDS_SET_HSV, void epic_leds_set_hsv( + int led, float h, float s, float v +)); /** * Set multiple of card10's RGB LEDs to a certain color in RGB format. @@ -619,7 +642,9 @@ API(API_LEDS_SET_ALL, void epic_leds_set_all(uint8_t *pattern, uint8_t len)); * LEDs. (0 <= h < 360, 0 <= s <= 1, 0 <= v <= 1) * :param uint8_t len: Length of 1st dimension of ``pattern``, see above. */ -API(API_LEDS_SET_ALL_HSV, void epic_leds_set_all_hsv(float *pattern, uint8_t len)); +API(API_LEDS_SET_ALL_HSV, void epic_leds_set_all_hsv( + float *pattern, uint8_t len +)); /** * Prepare one of card10's RGB LEDs to be set to a certain color in RGB format. @@ -632,7 +657,9 @@ API(API_LEDS_SET_ALL_HSV, void epic_leds_set_all_hsv(float *pattern, uint8_t len * :param uint8_t g: Green component of the color. * :param uint8_t b: Blue component of the color. */ -API(API_LEDS_PREP, void epic_leds_prep(int led, uint8_t r, uint8_t g, uint8_t b)); +API(API_LEDS_PREP, void epic_leds_prep( + int led, uint8_t r, uint8_t g, uint8_t b +)); /** * Prepare one of card10's RGB LEDs to be set to a certain color in HSV format. @@ -645,7 +672,9 @@ API(API_LEDS_PREP, void epic_leds_prep(int led, uint8_t r, uint8_t g, uint8_t b) * :param uint8_t s: Saturation component of the color. (float, 0 <= s <= 1) * :param uint8_t v: Value/Brightness component of the color. (float, 0 <= v <= 0) */ -API(API_LEDS_PREP_HSV, void epic_leds_prep_hsv(int led, float h, float s, float v)); +API(API_LEDS_PREP_HSV, void epic_leds_prep_hsv( + int led, float h, float s, float v +)); /** * Set global brightness for top RGB LEDs. @@ -728,8 +757,7 @@ API(API_LEDS_SET_FLASHLIGHT, void epic_set_flashlight(bool power)); * :param uint8_t[256] gamma_table: Gamma lookup table. (default = 4th order power function rounded up) */ API(API_LEDS_SET_GAMMA_TABLE, void epic_leds_set_gamma_table( - uint8_t rgb_channel, - uint8_t *gamma_table + uint8_t rgb_channel, uint8_t *gamma_table )); /** @@ -739,7 +767,9 @@ API(API_LEDS_SET_GAMMA_TABLE, void epic_leds_set_gamma_table( * :param uint8_t g: Value for the green color channel. * :param uint8_t b: Value for the blue color channel. */ -API(API_LEDS_CLEAR_ALL, void epic_leds_clear_all(uint8_t r, uint8_t g, uint8_t b)); +API(API_LEDS_CLEAR_ALL, void epic_leds_clear_all( + uint8_t r, uint8_t g, uint8_t b +)); /** * BME680 @@ -806,8 +836,9 @@ API(API_BME680_DEINIT, int epic_bme680_deinit()); * - ``-EIO``: Communication with the device failed. * - ``-ENODEV``: Device was not found. */ -API(API_BME680_GET_DATA, - int epic_bme680_read_sensors(struct bme680_sensor_data *data)); +API(API_BME680_GET_DATA, int epic_bme680_read_sensors( + struct bme680_sensor_data *data +)); /** * Personal State @@ -850,8 +881,9 @@ enum personal_state { * :param bool persistent: Indicates whether the configured personal state will remain set and active on pycardium application restart/change. * :returns: ``0`` on success, ``-EINVAL`` if an invalid state was requested. */ -API(API_PERSONAL_STATE_SET, int epic_personal_state_set(uint8_t state, - bool persistent)); +API(API_PERSONAL_STATE_SET, int epic_personal_state_set( + uint8_t state, bool persistent +)); /** * Get the users personal state. @@ -1108,6 +1140,36 @@ API(API_BHI160_DISABLE, int epic_bhi160_disable_sensor( */ API(API_BHI160_DISABLE_ALL, void epic_bhi160_disable_all_sensors()); +/** + * BHI160 Interrupt Handlers + * ------------------------- + */ + +/** + * **Interrupt Service Routine** for :c:data:`EPIC_INT_BHI160_ACCELEROMETER` + * + * :c:func:`epic_isr_bhi160_accelerometer` is called whenever the BHI160 + * accelerometer has new data available. + */ +API_ISR(EPIC_INT_BHI160_ACCELEROMETER, epic_isr_bhi160_accelerometer); + +/** + * **Interrupt Service Routine** for :c:data:`EPIC_INT_BHI160_ORIENTATION` + * + * :c:func:`epic_isr_bhi160_orientation` is called whenever the BHI160 + * orientation sensor has new data available. + */ +API_ISR(EPIC_INT_BHI160_ORIENTATION, epic_isr_bhi160_orientation); + +/** + * **Interrupt Service Routine** for :c:data:`EPIC_INT_BHI160_GYROSCOPE` + * + * :c:func:`epic_isr_bhi160_orientation` is called whenever the BHI160 + * gyroscrope has new data available. + */ +API_ISR(EPIC_INT_BHI160_GYROSCOPE, epic_isr_bhi160_gyroscope); + + /** * Vibration Motor * =============== @@ -1246,7 +1308,7 @@ API(API_DISP_PRINT, * Font Selection */ enum disp_font_name { - DISP_FONT8 = 0, + DISP_FONT8 = 0, DISP_FONT12 = 1, DISP_FONT16 = 2, DISP_FONT20 = 3, @@ -1266,15 +1328,14 @@ enum disp_font_name { * * - ``-EBUSY``: Display was already locked from another task. */ -API(API_DISP_PRINT_ADV, - int epic_disp_print_adv( - uint8_t font, - uint16_t posx, - uint16_t posy, - const char *pString, - uint16_t fg, - uint16_t bg) -); +API(API_DISP_PRINT_ADV, int epic_disp_print_adv( + uint8_t font, + uint16_t posx, + uint16_t posy, + const char *pString, + uint16_t fg, + uint16_t bg +)); /** * Fills the whole screen with one color @@ -1296,12 +1357,9 @@ API(API_DISP_CLEAR, int epic_disp_clear(uint16_t color)); * * - ``-EBUSY``: Display was already locked from another task. */ -API(API_DISP_PIXEL, - int epic_disp_pixel( - uint16_t x, - uint16_t y, - uint16_t color) - ); +API(API_DISP_PIXEL, int epic_disp_pixel( + uint16_t x, uint16_t y, uint16_t color +)); /** * Draws pixels on the display @@ -1329,16 +1387,15 @@ API(API_DISP_PIXELS, * * - ``-EBUSY``: Display was already locked from another task. */ -API(API_DISP_LINE, - int epic_disp_line( - uint16_t xstart, - uint16_t ystart, - uint16_t xend, - uint16_t yend, - uint16_t color, - enum disp_linestyle linestyle, - uint16_t pixelsize) - ); +API(API_DISP_LINE, int epic_disp_line( + uint16_t xstart, + uint16_t ystart, + uint16_t xend, + uint16_t yend, + uint16_t color, + enum disp_linestyle linestyle, + uint16_t pixelsize +)); /** * Draws a rectangle on the display @@ -1354,16 +1411,15 @@ API(API_DISP_LINE, * * - ``-EBUSY``: Display was already locked from another task. */ -API(API_DISP_RECT, - int epic_disp_rect( - uint16_t xstart, - uint16_t ystart, - uint16_t xend, - uint16_t yend, - uint16_t color, - enum disp_fillstyle fillstyle, - uint16_t pixelsize) - ); +API(API_DISP_RECT, int epic_disp_rect( + uint16_t xstart, + uint16_t ystart, + uint16_t xend, + uint16_t yend, + uint16_t color, + enum disp_fillstyle fillstyle, + uint16_t pixelsize +)); /** * Draws a circle on the display @@ -1378,15 +1434,14 @@ API(API_DISP_RECT, * * - ``-EBUSY``: Display was already locked from another task. */ -API(API_DISP_CIRC, - int epic_disp_circ( - uint16_t x, - uint16_t y, - uint16_t rad, - uint16_t color, - enum disp_fillstyle fillstyle, - uint16_t pixelsize) - ); +API(API_DISP_CIRC, int epic_disp_circ( + uint16_t x, + uint16_t y, + uint16_t rad, + uint16_t color, + enum disp_fillstyle fillstyle, + uint16_t pixelsize +)); /** * Immediately send the contents of a framebuffer to the display. This overrides @@ -1397,7 +1452,9 @@ API(API_DISP_CIRC, * * - ``-EBUSY``: Display was already locked from another task. */ -API(API_DISP_FRAMEBUFFER, int epic_disp_framebuffer(union disp_framebuffer *fb)); +API(API_DISP_FRAMEBUFFER, int epic_disp_framebuffer( + union disp_framebuffer *fb +)); /** @@ -1498,10 +1555,9 @@ API(API_FILE_READ, int epic_file_read(int fd, void* buf, size_t nbytes)); * :return: ``< 0`` on error, ``nbytes`` on success. (Partial writes don't occur on success!) * */ -API( - API_FILE_WRITE, - int epic_file_write(int fd, const void* buf, size_t nbytes) -); +API(API_FILE_WRITE, int epic_file_write( + int fd, const void* buf, size_t nbytes +)); /** */ API(API_FILE_FLUSH, int epic_file_flush(int fd)); @@ -1667,7 +1723,9 @@ API(API_RTC_GET_MILLISECONDS, uint64_t epic_rtc_get_milliseconds(void)); /** * Sets the current RTC time in milliseconds */ -API(API_RTC_SET_MILLISECONDS, void epic_rtc_set_milliseconds(uint64_t milliseconds)); +API(API_RTC_SET_MILLISECONDS, void epic_rtc_set_milliseconds( + uint64_t milliseconds +)); /** * Schedule the RTC alarm for the given timestamp. @@ -1681,7 +1739,7 @@ API(API_RTC_SET_MILLISECONDS, void epic_rtc_set_milliseconds(uint64_t millisecon API(API_RTC_SCHEDULE_ALARM, int epic_rtc_schedule_alarm(uint32_t timestamp)); /** - * **Interrupt Service Routine** + * **Interrupt Service Routine** for :c:data:`EPIC_INT_RTC_ALARM` * * ``epic_isr_rtc_alarm()`` is called when the RTC alarm triggers. The RTC alarm * can be scheduled using :c:func:`epic_rtc_schedule_alarm`. @@ -1733,8 +1791,8 @@ struct max30001_sensor_config { bool usb; /** - * Set to true if the interal lead bias of the MAX30001 is to be used. - */ + * Set to true if the interal lead bias of the MAX30001 is to be used. + */ bool bias; /** Always zero. Reserved for future parameters. */ @@ -1742,9 +1800,10 @@ struct max30001_sensor_config { }; /** - * Enable a MAX30001 ecg sensor. Calling this funciton will instruct the - * MAX30001 to collect data for this sensor. You can then - * retrieve the samples using :c:func:`epic_stream_read`. + * Enable a MAX30001 ecg sensor. + * + * Calling this funciton will instruct the MAX30001 to collect data for this + * sensor. You can then retrieve the samples using :c:func:`epic_stream_read`. * * :param max30001_sensor_config* config: Configuration for this sensor. * :returns: A sensor descriptor which can be used with @@ -1764,23 +1823,36 @@ API(API_MAX30001_ENABLE, int epic_max30001_enable_sensor( * * .. versionadded:: 1.6 */ -API(API_MAX30001_DISABLE, int epic_max30001_disable_sensor( -void -)); +API(API_MAX30001_DISABLE, int epic_max30001_disable_sensor()); + +/** + * **Interrupt Service Routine** for :c:data:`EPIC_INT_MAX30001_ECG` + * + * This interrupt handler is called whenever the MAX30001 ECG has new data + * available. + */ +API_ISR(EPIC_INT_MAX30001_ECG, epic_isr_max30001_ecg); + +/** + * USB + * === + */ /** * De-initialize the currently configured USB device (if any) * */ API(API_USB_SHUTDOWN, int epic_usb_shutdown(void)); + /** * Configure the USB peripheral to export the internal FLASH - * as a Mass Storage device + * as a Mass Storage device. */ API(API_USB_STORAGE, int epic_usb_storage(void)); + /** * Configure the USB peripheral to provide card10's stdin/stdout - * on a USB CDC-ACM device + * on a USB CDC-ACM device. */ API(API_USB_CDCACM, int epic_usb_cdcacm(void)); diff --git a/epicardium/modules/hardware.c b/epicardium/modules/hardware.c index 17c707217283c41f61bfad79b9b6fb69d7b20d11..370f9afbe33f00046b9d55084bb934d068cef573 100644 --- a/epicardium/modules/hardware.c +++ b/epicardium/modules/hardware.c @@ -254,6 +254,12 @@ int hardware_reset(void) * Display */ display_init_slim(); + epic_disp_backlight(20); + + /* + * Vibration Motor + */ + epic_vibra_set(false); /* * BHI160 diff --git a/epicardium/modules/leds.c b/epicardium/modules/leds.c index 93b80a993717adaa0d058da554e3d7f6433e2dc5..aab84c86e2d80dddf7617cb1e667068421bc5753 100644 --- a/epicardium/modules/leds.c +++ b/epicardium/modules/leds.c @@ -49,6 +49,17 @@ void epic_leds_prep(int led, uint8_t r, uint8_t g, uint8_t b) leds_prep(led, r, g, b); } +int epic_leds_get_rgb(int led, uint8_t *rgb) +{ + if (led == PERSONAL_STATE_LED && personal_state_enabled()) + return -EPERM; + if (led < 0 || led >= NUM_LEDS) + return -EINVAL; + + leds_get_rgb(led, rgb); + return 0; +} + void epic_leds_prep_hsv(int led, float h, float s, float v) { if (led == PERSONAL_STATE_LED && personal_state_enabled()) diff --git a/lib/card10/leds.c b/lib/card10/leds.c index 3f284db4ab1d1dae0f561510e1671b93b83bcafe..d21049cfd6cf1337ee9eccee9627da6487fb91e2 100644 --- a/lib/card10/leds.c +++ b/lib/card10/leds.c @@ -206,6 +206,13 @@ void leds_prep(uint8_t led, uint8_t r, uint8_t g, uint8_t b) leds[led][2] = b; } +void leds_get_rgb(uint8_t led, uint8_t *rgb) +{ + rgb[0] = leds[led][0]; + rgb[1] = leds[led][1]; + rgb[2] = leds[led][2]; +} + #if 0 //don't use, is buggy void leds_set_autodim(uint8_t led, uint8_t r, uint8_t g, uint8_t b) diff --git a/lib/card10/leds.h b/lib/card10/leds.h index 8977daa7cc75233ac6d4b5bf9ace7a1f03781811..cdb4dfdb0b10e401f8872615ab7c3cca4331e9c0 100644 --- a/lib/card10/leds.h +++ b/lib/card10/leds.h @@ -6,6 +6,7 @@ void leds_set_dim_top(uint8_t value); void leds_set_dim_bottom(uint8_t value); void leds_prep(uint8_t led, uint8_t r, uint8_t g, uint8_t b); +void leds_get_rgb(uint8_t led, uint8_t * rgb); void leds_prep_hsv(uint8_t led, float h, float s, float v); void leds_update_power(void); void leds_update(void); diff --git a/preload/apps/card10_nickname/__init__.py b/preload/apps/card10_nickname/__init__.py index 09d8b149846e3d94026ed71bbaa1e09a81336f9c..c6cd1b0b8037252cbc5f33f56ce19122a8c6c2cc 100644 --- a/preload/apps/card10_nickname/__init__.py +++ b/preload/apps/card10_nickname/__init__.py @@ -349,5 +349,5 @@ else: ([0, 0, 0], [0, 0, 0]), ([0, 0, 0], [0, 0, 0]), 0, - (0, [255, 0, 255], [255, 0, 255], [255, 0, 255]), + (True, [0, 230, 0], [255, 215, 0], [255, 0, 0]), ) diff --git a/preload/apps/ecg/__init__.py b/preload/apps/ecg/__init__.py index b6adca37ff1a959840b39578aee84e3084d55bcf..6a0dd08886f37173306c49bbf40eee792d105f89 100644 --- a/preload/apps/ecg/__init__.py +++ b/preload/apps/ecg/__init__.py @@ -41,16 +41,83 @@ leds.dim_top(1) COLORS = [((23 + (15 * i)) % 360, 1.0, 1.0) for i in range(11)] +# variables for high-pass filter +moving_average = 0 +alpha = 2 +beta = 3 + + +def update_history(datasets): + global history, moving_average, alpha, beta + for val in datasets: + history.append(val - moving_average) + moving_average = (alpha * moving_average + beta * val) / (alpha + beta) + + # trim old elements + history = history[-HISTORY_MAX:] + + +# variables for pulse detection +pulse = -1 +samples_since_last_pulse = 0 +q_threshold = -1 +r_threshold = 1 +q_spike = -ECG_RATE + + +def neighbours(n, lst): + """ + neighbours(2, "ABCDE") = ("AB", "BC", "CD", "DE") + neighbours(3, "ABCDE") = ("ABC", "BCD", "CDE") + """ + + for i in range(len(lst) - (n - 1)): + yield lst[i : i + n] + + +def detect_pulse(num_new_samples): + global history, pulse, samples_since_last_pulse, q_threshold, r_threshold, q_spike + + # look at 3 consecutive samples, starting 2 samples before the samples that were just added, e.g.: + # existing samples: "ABCD" + # new samples: "EF" => "ABCDEF" + # consider ["CDE", "DEF"] + # new samples: "GHI" => "ABCDEFGHI" + # consider ["EFG", "FGH", "GHI"] + for [prev, cur, next_] in neighbours(3, history[-(num_new_samples + 2) :]): + samples_since_last_pulse += 1 + + if prev > cur < next_ and cur < q_threshold: + q_spike = samples_since_last_pulse + # we expect the next q-spike to be at least 60% as high as this one + q_threshold = (cur * 3) // 5 + elif ( + prev < cur > next_ + and cur > r_threshold + and samples_since_last_pulse - q_spike < ECG_RATE // 10 + ): + # the full QRS complex is < 0.1s long, so the q and r spike in particular cannot be more than ECG_RATE//10 samples apart + pulse = 60 * ECG_RATE // samples_since_last_pulse + samples_since_last_pulse = 0 + q_spike = -ECG_RATE + if pulse < 30 or pulse > 210: + pulse = -1 + # we expect the next r-spike to be at least 60% as high as this one + r_threshold = (cur * 3) // 5 + elif samples_since_last_pulse > 2 * ECG_RATE: + q_threshold = -1 + r_threshold = 1 + pulse = -1 + + def callback_ecg(datasets): global update_screen, history, filebuffer, write update_screen += len(datasets) # update histogram datalist if not pause_histogram: - history += datasets - - # trim old elements - history = history[-HISTORY_MAX:] + update_history(datasets) + detect_pulse(len(datasets)) # buffer for writes if write > 0: @@ -207,12 +274,24 @@ def draw_histogram(): ) else: draw_leds((max(history[-5:]) * scale + SCALE_FACTOR) * 11 / (SCALE_FACTOR * 2)) - disp.print( - current_mode + ("+Bias" if bias else ""), - posx=0, - posy=0, - fg=(COLOR_MODE_FINGER if current_mode == MODE_FINGER else COLOR_MODE_USB), - ) + if pulse < 0: + disp.print( + current_mode + ("+Bias" if bias else ""), + posx=0, + posy=0, + fg=( + COLOR_MODE_FINGER if current_mode == MODE_FINGER else COLOR_MODE_USB + ), + ) + else: + disp.print( + "BPM: {}".format(pulse), + posx=0, + posy=0, + fg=( + COLOR_MODE_FINGER if current_mode == MODE_FINGER else COLOR_MODE_USB + ), + ) # announce writing ecg log if write > 0: diff --git a/pycardium/modules/py/display.py b/pycardium/modules/py/display.py index 75d37034f3d99e90834a4fb47d9eb7af70155843..22891bcb0813e61307bc6b792d8a4de117560694 100644 --- a/pycardium/modules/py/display.py +++ b/pycardium/modules/py/display.py @@ -92,13 +92,13 @@ class Display: def print(self, text, *, fg=None, bg=None, posx=0, posy=0, font=FONT20): """ - Prints a string on the display. Font size is locked to 20px + Prints a string on the display. :param text: Text to print :param fg: Foreground color (expects RGB triple) :param bg: Background color (expects RGB triple) - :param posx: X-Position of the first character, 0 <= posx <= 160 - :param posy: Y-Position of the first character, 0 <= posy <= 80 + :param posx: X-Position of the first character, 0 <= posx <= 159 + :param posy: Y-Position of the first character, 0 <= posy <= 79 :param font: 0 <= font <= 4 (currently) selects a font Avaiable Fonts: @@ -128,8 +128,8 @@ class Display: """ Draws a pixel on the display - :param x: X coordinate, 0<= x <= 160 - :param y: Y coordinate, 0<= y <= 80 + :param x: X coordinate, 0<= x <= 159 + :param y: Y coordinate, 0<= y <= 79 :param col: color of the pixel (expects RGB tripple) """ @@ -186,10 +186,10 @@ class Display: """ Draws a line on the display. - :param xs: X start coordinate, 0 <= xs <= 160 - :param ys: Y start coordinate, 0 <= ys <= 80 - :param xe: X end coordinate, 0 <= xe <= 160 - :param ye: Y end coordinate, 0 <= ye <= 80 + :param xs: X start coordinate, 0 <= xs <= 159 + :param ys: Y start coordinate, 0 <= ys <= 79 + :param xe: X end coordinate, 0 <= xe <= 159 + :param ye: Y end coordinate, 0 <= ye <= 79 :param col: color of the line (expects RGB triple) :param dotted: whether the line should be dotted or not (questionable implementation: draws every other pixel white, draws @@ -206,10 +206,10 @@ class Display: """ Draws a rectangle on the display. - :param xs: X start coordinate, 0 <= xs <= 160 - :param ys: Y start coordinate, 0 <= ys <= 80 - :param xe: X end coordinate, 0 <= xe <= 160 - :param ye: Y end coordinate, 0 <= ye <= 80 + :param xs: X start coordinate, 0 <= xs <= 159 + :param ys: Y start coordinate, 0 <= ys <= 79 + :param xe: X end coordinate, 0 <= xe <= 159 + :param ye: Y end coordinate, 0 <= ye <= 79 :param col: color of the outline and fill (expects RGB triple) :param filled: whether the rectangle should be filled or not :param size: size of the individual pixels, ranges from 1 to 8 @@ -224,8 +224,8 @@ class Display: """ Draws a circle on the display. - :param x: center x coordinate, 0 <= x <= 160 - :param y: center y coordinate, 0 <= y <= 80 + :param x: center x coordinate, 0 <= x <= 159 + :param y: center y coordinate, 0 <= y <= 79 :param rad: radius :param col: color of the outline and fill (expects RGB triple) :param filled: whether the rectangle should be filled or not diff --git a/pycardium/modules/py/leds.py b/pycardium/modules/py/leds.py index ad5563cfb2a3c8fca7bf4a4909ac460ba0e86808..9b7d2511544be91ab632d04cb3b598503b1c166f 100644 --- a/pycardium/modules/py/leds.py +++ b/pycardium/modules/py/leds.py @@ -131,6 +131,17 @@ def set(led, color): sys_leds.set(led, color) +def get_rgb(led): + """ + Get the current RGB value for an RGB LED. + + :param int led: Which LED to set. 0-10 are the LEDs on the top and 11-14 + are the 4 "ambient" LEDs + :return [r,g,b] color: RGB triplet + """ + return sys_leds.get_rgb(led) + + def set_hsv(led, color): """ Prepare an RGB LED to be set to an HSV value. diff --git a/pycardium/modules/qstrdefs.h b/pycardium/modules/qstrdefs.h index ea26c59ef244b7ab36cbede84882490213b29aa5..e54d726a4e8b5f236721ee0202466ee349336619 100644 --- a/pycardium/modules/qstrdefs.h +++ b/pycardium/modules/qstrdefs.h @@ -8,6 +8,7 @@ Q(sys_leds) Q(update) Q(set) +Q(get_rgb) Q(set_hsv) Q(prep) Q(prep_hsv) diff --git a/pycardium/modules/sys_leds.c b/pycardium/modules/sys_leds.c index 7c1c2d5a35156ae06c31c424546bf1623d69d311..990a4a36a3a97612ebe5d9dd745bd6317b61f438 100644 --- a/pycardium/modules/sys_leds.c +++ b/pycardium/modules/sys_leds.c @@ -6,7 +6,6 @@ #include <stdio.h> - static mp_obj_t mp_leds_set(mp_obj_t led_in, mp_obj_t color_in) { int led = mp_obj_get_int(led_in); @@ -79,6 +78,33 @@ static mp_obj_t mp_leds_prep(mp_obj_t led_in, mp_obj_t color_in) } static MP_DEFINE_CONST_FUN_OBJ_2(leds_prep_obj, mp_leds_prep); +static mp_obj_t mp_leds_get_rgb(mp_obj_t led_in) +{ + int led = mp_obj_get_int(led_in); + uint8_t rgb[] = { 0, 0, 0 }; + int retAPI = epic_leds_get_rgb(led, rgb); + if (retAPI == -EPERM) { + mp_raise_ValueError( + "no permission: maybe blocked by personal state" + ); + } + if (retAPI == -EINVAL) { + mp_raise_ValueError( + "invalid value: maybe the led does not exists" + ); + } + + mp_obj_t ret = mp_obj_new_tuple(3, NULL); + mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(ret); + + tuple->items[0] = MP_OBJ_NEW_SMALL_INT(rgb[0]); + tuple->items[1] = MP_OBJ_NEW_SMALL_INT(rgb[1]); + tuple->items[2] = MP_OBJ_NEW_SMALL_INT(rgb[2]); + + return ret; +} +static MP_DEFINE_CONST_FUN_OBJ_1(leds_get_rgb_obj, mp_leds_get_rgb); + static mp_obj_t mp_leds_prep_hsv(mp_obj_t led_in, mp_obj_t color_in) { int led = mp_obj_get_int(led_in); @@ -238,6 +264,7 @@ static const mp_rom_map_elem_t leds_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_set), MP_ROM_PTR(&leds_set_obj) }, { MP_ROM_QSTR(MP_QSTR_set_hsv), MP_ROM_PTR(&leds_set_hsv_obj) }, { MP_ROM_QSTR(MP_QSTR_prep), MP_ROM_PTR(&leds_prep_obj) }, + { MP_ROM_QSTR(MP_QSTR_get_rgb), MP_ROM_PTR(&leds_get_rgb_obj) }, { MP_ROM_QSTR(MP_QSTR_prep_hsv), MP_ROM_PTR(&leds_prep_hsv_obj) }, { MP_ROM_QSTR(MP_QSTR_set_all), MP_ROM_PTR(&leds_set_all_obj) }, { MP_ROM_QSTR(MP_QSTR_set_all_hsv), MP_ROM_PTR(&leds_set_all_hsv_obj) }, diff --git a/pycardium/mpconfigport.h b/pycardium/mpconfigport.h index aad4320d8516f121552eb0f63d8ebbd91fa841a6..744a38e38cd2c25ea037e90ac420d4f2403c0d2b 100644 --- a/pycardium/mpconfigport.h +++ b/pycardium/mpconfigport.h @@ -3,6 +3,7 @@ #define MICROPY_HW_MCU_NAME "max32666" /* MicroPython Config Options */ +#define MICROPY_PY_MICROPYTHON_MEM_INFO (1) /* We raise asynchronously from an interrupt handler */ #define MICROPY_ASYNC_KBD_INTR (1)