microbit-dal: added yotta configuration mappings to DAL specific configuration options.

Yotta can now be used to configure the configuration options for the
dal.

An full config.json looks like:

{
    "microbit-dal":{
        "bluetooth":{
            "enabled": 1,
            "pairing_mode": 0,
            "private_addressing": 0,
            "open": 0,
            "whitelist": 1,
            "advertising_timeout": 0,
            "tx_power": 0,
            "dfu_service": 1,
            "event_service": 1,
            "device_info_service": 1
        },
        "reuse_sd": 1,
        "gatt_table_size": "0x300",
        "heap_allocator": 1,
        "nested_heap_proportion": 0.75,
        "system_tick_period": 6,
        "system_components": 10,
        "idle_components": 6,
        "use_accel_lsb": 0,
        "min_display_brightness": 1,
        "max_display_brightness": 255,
        "display_scroll_speed": 120,
        "display_scroll_stride": -1,
        "display_print_speed": 400,
        "panic_on_heap_full": 1,
        "debug": 0,
        "heap_debug": 0,
        "stack_size":2048,
        "sram_base":"0x20000008",
        "sram_end":"0x20004000",
        "sd_limit":"0x20002000",
        "gatt_table_start":"0x20001900"
    }
}
This commit is contained in:
James Devine 2016-04-19 15:02:28 +01:00
parent c844e6104a
commit 8875dc35d2
3 changed files with 146 additions and 1 deletions

View file

@ -31,6 +31,7 @@ DEALINGS IN THE SOFTWARE.
#define MICROBIT_CONFIG_H
#include "mbed.h"
#include "yotta_cfg_mappings.h"
//
// Memory configuration

View file

@ -0,0 +1,143 @@
#ifndef YOTTA_CFG_MAPPINGS_H
#define YOTTA_CFG_MAPPINGS_H
/**
* This header file contains mappings from a yotta config.json file for the DAL,
* to DAL specific #defines used in the DAL.
*/
//DAL mappings
#ifdef YOTTA_CFG_MICROBIT_DAL_HEAP_ALLOCATOR
#define MICROBIT_HEAP_ALLOCATOR YOTTA_CFG_MICROBIT_DAL_HEAP_ALLOCATOR
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_NESTED_HEAP_PROPORTION
#define MICROBIT_NESTED_HEAP_SIZE YOTTA_CFG_MICROBIT_DAL_NESTED_HEAP_PROPORTION
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_REUSE_SD
#define MICROBIT_HEAP_REUSE_SD YOTTA_CFG_MICROBIT_DAL_REUSE_SD
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_GATT_TABLE_SIZE
#define MICROBIT_SD_GATT_TABLE_SIZE YOTTA_CFG_MICROBIT_DAL_GATT_TABLE_SIZE
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_SYSTEM_TICK_PERIOD
#define SYSTEM_TICK_PERIOD_MS YOTTA_CFG_MICROBIT_DAL_SYSTEM_TICK_PERIOD
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_SYSTEM_COMPONENTS
#define MICROBIT_SYSTEM_COMPONENTS YOTTA_CFG_MICROBIT_DAL_SYSTEM_COMPONENTS
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_IDLE_COMPONENTS
#define MICROBIT_IDLE_COMPONENTS YOTTA_CFG_MICROBIT_DAL_IDLE_COMPONENTS
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_ENABLED
#define MICROBIT_BLE_ENABLED YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_ENABLED
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_USE_ACCEL_LSB
#define USE_ACCEL_LSB YOTTA_CFG_MICROBIT_DAL_USE_ACCEL_LSB
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_MIN_DISPLAY_BRIGHTNESS
#define MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS YOTTA_CFG_MICROBIT_DAL_MIN_DISPLAY_BRIGHTNESS
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_MAX_DISPLAY_BRIGHTNESS
#define MICROBIT_DISPLAY_MAXIMUM_BRIGHTNESS YOTTA_CFG_MICROBIT_DAL_MAX_DISPLAY_BRIGHTNESS
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_DISPLAY_SCROLL_SPEED
#define MICROBIT_DEFAULT_SCROLL_SPEED YOTTA_CFG_MICROBIT_DAL_DISPLAY_SCROLL_SPEED
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_DISPLAY_SCROLL_STRIDE
#define MICROBIT_DEFAULT_SCROLL_STRIDE YOTTA_CFG_MICROBIT_DAL_DISPLAY_SCROLL_STRIDE
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_DISPLAY_PRINT_SPEED
#define MICROBIT_DEFAULT_PRINT_SPEED YOTTA_CFG_MICROBIT_DAL_DISPLAY_PRINT_SPEED
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_PANIC_ON_HEAP_FULL
#define MICROBIT_PANIC_HEAP_FULL YOTTA_CFG_MICROBIT_DAL_PANIC_ON_HEAP_FULL
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_DEBUG
#define MICROBIT_DBG YOTTA_CFG_MICROBIT_DAL_DEBUG
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_HEAP_DEBUG
#define MICROBIT_HEAP_DBG YOTTA_CFG_MICROBIT_DAL_HEAP_DEBUG
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_STACK_SIZE
#define MICROBIT_STACK_SIZE YOTTA_CFG_MICROBIT_DAL_STACK_SIZE
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_SRAM_BASE
#define MICROBIT_SRAM_BASE YOTTA_CFG_MICROBIT_DAL_SRAM_BASE
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_SRAM_END
#define MICROBIT_SRAM_END YOTTA_CFG_MICROBIT_DAL_SRAM_END
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_SD_LIMIT
#define MICROBIT_SD_LIMIT YOTTA_CFG_MICROBIT_DAL_SD_LIMIT
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_GATT_TABLE_START
#define MICROBIT_SD_GATT_TABLE_START YOTTA_CFG_MICROBIT_DAL_GATT_TABLE_START
#endif
//Bluetooth mappings
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_PAIRING_MODE
#define MICROBIT_BLE_PAIRING_MODE YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_PAIRING_MODE
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_PRIVATE_ADDRESSING
#define MICROBIT_BLE_PRIVATE_ADDRESSES YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_PRIVATE_ADDRESSING
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_OPEN
#define MICROBIT_BLE_OPEN YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_OPEN
#endif
//we check if the user has requested open mode, otherwise we will double def!
#if (YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_OPEN == 0)
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_WHITELIST
#define MICROBIT_BLE_WHITELIST YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_WHITELIST
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_ADVERTISING_TIMEOUT
#define MICROBIT_BLE_ADVERTISING_TIMEOUT YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_ADVERTISING_TIMEOUT
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_TX_POWER
#define MICROBIT_BLE_DEFAULT_TX_POWER YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_TX_POWER
#endif
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_DFU_SERVICE
#define MICROBIT_BLE_DFU_SERVICE YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_DFU_SERVICE
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_EVENT_SERVICE
#define MICROBIT_BLE_EVENT_SERVICE YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_EVENT_SERVICE
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_DEVICE_INFO_SERVICE
#define MICROBIT_BLE_DEVICE_INFORMATION_SERVICE YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_DEVICE_INFO_SERVICE
#endif
#endif

View file

@ -23,6 +23,7 @@
"inc/core",
"inc/types",
"inc/drivers",
"inc/bluetooth"
"inc/bluetooth",
"inc/platform"
]
}