microbit: Updates to all components to include MicroBitConfig.h

Also added configuration option to enable / disable MicroBitHeapAllocator
overloads.
This commit is contained in:
Joe Finney 2016-03-17 17:33:57 +00:00
parent 0e8034c5bc
commit 3531cde893
86 changed files with 101 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include "mbed.h"
#include "MicroBitConfig.h"
#ifndef MICROBIT_DYNAMIC_PWM_H
#define MICROBIT_DYNAMIC_PWM_H

View File

@ -1,6 +1,8 @@
#ifndef ERROR_NO_H
#define ERROR_NO_H
#include "MicroBitConfig.h"
/**
* Error codes used in the micro:bit runtime.
* These may be returned from functions implemented in the micro:bit runtime.

View File

@ -2,6 +2,7 @@
#define EVENT_MODEL_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
#include "MicroBitEvent.h"
#include "MicroBitListener.h"

View File

@ -1,6 +1,7 @@
#ifndef MANAGED_STRING_H
#define MANAGED_STRING_H
#include "MicroBitConfig.h"
#include "RefCounted.h"
struct StringData : RefCounted

View File

@ -1,6 +1,8 @@
#ifndef MICROBIT_MANAGED_TYPE_H
#define MICROBIT_MANAGED_TYPE_H
#include "MicroBitConfig.h"
/**
* Class definition for a Generic Managed Type.
*

View File

@ -1,6 +1,8 @@
#ifndef MICROBIT_MATRIX4_H
#define MICROBIT_MATRIX4_H
#include "MicroBitConfig.h"
/**
* Class definition for a simple matrix, that is optimised for nx4 or 4xn matrices.
*

View File

@ -2,6 +2,7 @@
#define MEMBER_FUNCTION_CALLBACK_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitEvent.h"
#include "MicroBitCompat.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_ACCELEROMETER_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
#include "MicroBitCoordinateSystem.h"
#include "MicroBitI2C.h"

View File

@ -1,6 +1,7 @@
#ifndef MICROBIT_ACCELEROMETER_SERVICE_H
#define MICROBIT_ACCELEROMETER_SERVICE_H
#include "MicroBitConfig.h"
#include "ble/BLE.h"
#include "MicroBitAccelerometer.h"
#include "EventModel.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_BLE_MANAGER_H
#include "mbed.h"
#include "MicroBitConfig.h"
/*
* The underlying Nordic libraries that support BLE do not compile cleanly with the stringent GCC settings we employ

View File

@ -2,6 +2,7 @@
#define MICROBIT_BUTTON_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
#include "MicroBitEvent.h"

View File

@ -1,6 +1,7 @@
#ifndef MICROBIT_BUTTON_SERVICE_H
#define MICROBIT_BUTTON_SERVICE_H
#include "MicroBitConfig.h"
#include "ble/BLE.h"
#include "EventModel.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_COMPASS_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
#include "MicroBitCoordinateSystem.h"
#include "MicroBitAccelerometer.h"

View File

@ -6,6 +6,7 @@
#define MICROBIT_COMPAT_H
#include "mbed.h"
#include "MicroBitConfig.h"
#define PI 3.14159265359

View File

@ -1,6 +1,7 @@
#ifndef MICROBIT_COMPONENT_H
#define MICROBIT_COMPONENT_H
#include "MicroBitConfig.h"
/**
* Class definition for MicroBitComponent
* All components should inherit from this class.

View File

@ -37,6 +37,13 @@
#define MICROBIT_HEAP_BLOCK_SIZE 4
#endif
// Enables or disables the MicroBitHeapllocator. Note that if disabled, no reuse of the SRAM normally
// reserved for SoftDevice is possible, and out of memory condition wil lno longer be trapped...
// i.e. panic() will no longer be triggered on memory full conditions.
#ifndef MICROBIT_HEAP_ENABLED
#define MICROBIT_HEAP_ENABLED 1
#endif
// The proportion of SRAM available on the mbed heap to reserve for the micro:bit heap.
#ifndef MICROBIT_HEAP_SIZE
#define MICROBIT_HEAP_SIZE 0.75
@ -382,4 +389,10 @@
#define CONFIG_ENABLED(X) (X == 1)
#define CONFIG_DISABLED(X) (X != 1)
#if CONFIG_ENABLED(MICROBOT_HEAP_ALLOCATOR)
#include "MicroBitHeapAllocator.h"
#endif
#endif

View File

@ -1,5 +1,6 @@
#ifndef MICROBIT_COORDINATE_SYSTEM_H
#define MICROBIT_COORDINATE_SYSTEM_H
#include "MicroBitConfig.h"
/**
* Co-ordinate systems that can be used.

View File

@ -2,6 +2,7 @@
#define MICROBIT_DFU_SERVICE_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "ble/BLE.h"
#include "MicroBitEvent.h"

View File

@ -8,6 +8,7 @@
*/
#ifndef MICROBIT_DEVICE_H
#define MICROBIT_DEVICE_H
#include "MicroBitConfig.h"
/*
* The underlying Nordic libraries that support BLE do not compile cleanly with the stringent GCC settings we employ
* If we're compiling under GCC, then we suppress any warnings generated from this code (but not the rest of the DAL)

View File

@ -2,6 +2,7 @@
#define MICROBIT_DISPLAY_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "ManagedString.h"
#include "MicroBitComponent.h"
#include "MicroBitImage.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_EVENT_H
#include "mbed.h"
#include "MicroBitConfig.h"
// Wildcard event codes
#define MICROBIT_ID_ANY 0

View File

@ -1,6 +1,7 @@
#ifndef MICROBIT_EVENT_SERVICE_H
#define MICROBIT_EVENT_SERVICE_H
#include "MicroBitConfig.h"
#include "ble/BLE.h"
#include "MicroBitEvent.h"
#include "EventModel.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_FONT_H
#include "mbed.h"
#include "MicroBitConfig.h"
#define MICROBIT_FONT_WIDTH 5
#define MICROBIT_FONT_HEIGHT 5

View File

@ -27,6 +27,7 @@
#define MICROBIT_HEAP_ALLOCTOR_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include <new>
// The number of heap segments created.

View File

@ -2,6 +2,7 @@
#define MICROBIT_I2C_H
#include "mbed.h"
#include "MicroBitConfig.h"
#define MICROBIT_I2C_MAX_RETRIES 9

View File

@ -2,6 +2,7 @@
#define MICROBIT_IO_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
#include "MicroBitPin.h"

View File

@ -1,6 +1,7 @@
#ifndef MICROBIT_IO_PIN_SERVICE_H
#define MICROBIT_IO_PIN_SERVICE_H
#include "MicroBitConfig.h"
#include "ble/BLE.h"
#include "MicroBitIO.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_IMAGE_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "ManagedString.h"
#include "RefCounted.h"

View File

@ -1,6 +1,7 @@
#ifndef MICROBIT_LED_SERVICE_H
#define MICROBIT_LED_SERVICE_H
#include "MicroBitConfig.h"
#include "ble/BLE.h"
#include "MicroBitDisplay.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_LIGHT_SENSOR_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
#include "EventModel.h"
#include "MicroBitMatrixMaps.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_LISTENER_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitEvent.h"
#include "MemberFunctionCallback.h"
#include "MicroBitConfig.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_MAGNETOMETER_SERVICE_H
#include "ble/BLE.h"
#include "MicroBitConfig.h"
#include "MicroBitCompass.h"
#include "EventModel.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_MESSAGE_BUS_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
#include "MicroBitEvent.h"
#include "MicroBitListener.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_MULTI_BUTTON_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitButton.h"
#include "EventModel.h"

View File

@ -1,6 +1,7 @@
#ifndef MICROBIT_PANIC_H
#define MICROBIT_PANIC_H
#include "MicroBitConfig.h"
#include "MicroBitDisplay.h"
/**

View File

@ -2,6 +2,7 @@
#define MICROBIT_PIN_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
// Status Field flags...
#define IO_STATUS_DIGITAL_IN 0x01 // Pin is configured as a digital input, with no pull up.

View File

@ -5,6 +5,7 @@ class MicroBitRadio;
struct FrameBuffer;
#include "mbed.h"
#include "MicroBitConfig.h"
#include "PacketBuffer.h"
#include "MicroBitRadioDatagram.h"
#include "MicroBitRadioEvent.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_RADIO_DATAGRAM_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitRadio.h"
/**

View File

@ -2,6 +2,7 @@
#define MICROBIT_RADIO_EVENT_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitRadio.h"
#include "EventModel.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_SERIAL_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "ManagedString.h"
#include "MicroBitImage.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_STORAGE_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitBLEManager.h"
#include "MicroBitCompass.h"

View File

@ -1,6 +1,7 @@
#ifndef MICROBIT_TEMPERATURE_SERVICE_H
#define MICROBIT_TEMPERATURE_SERVICE_H
#include "MicroBitConfig.h"
#include "ble/BLE.h"
#include "MicroBitThermometer.h"
#include "EventModel.h"

View File

@ -2,6 +2,7 @@
#define MICROBIT_THERMOMETER_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitComponent.h"
#define MICROBIT_THERMOMETER_PERIOD 1000

View File

@ -2,6 +2,7 @@
#define MICROBIT_PACKET_BUFFER_H
#include "mbed.h"
#include "MicroBitConfig.h"
#include "RefCounted.h"
struct PacketData : RefCounted

View File

@ -2,6 +2,7 @@
#define REF_COUNTED_H
#include "mbed.h"
#include "MicroBitConfig.h"
/**
* Base class for payload for ref-counted objects. Used by ManagedString and MicroBitImage.

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "DynamicPwm.h"
#include "MicroBitPin.h"
#include "ErrorNo.h"

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include "mbed.h"
#include "MicroBitConfig.h"
#include "ManagedString.h"
#include "MicroBitCompat.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "Matrix4.h"
#include "mbed.h"

View File

@ -9,6 +9,7 @@
* events to C++ methods.
*/
#include "MicroBitConfig.h"
#include "MemberFunctionCallback.h"
/**

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
/*
* The underlying Nordic libraries that support BLE do not compile cleanly with the stringent GCC settings we employ
* If we're compiling under GCC, then we suppress any warnings generated from this code (but not the rest of the DAL)

View File

@ -5,6 +5,7 @@
* Also includes basic data caching and on demand activation.
*/
#include "MicroBitConfig.h"
#include "MicroBitAccelerometer.h"
#include "ErrorNo.h"
#include "MicroBitConfig.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitButton.h"
#include "MicroBitSystemTimer.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitCompass.h"
#include "MicroBitStorage.h"
#include "MicroBitFiber.h"

View File

@ -1,6 +1,7 @@
/**
* Compatibility / portability funcitons and constants for the MicroBit DAL.
*/
#include "MicroBitConfig.h"
#include "MicroBitCompat.h"
#include "ErrorNo.h"

View File

@ -1,6 +1,7 @@
/**
* Compatibility / portability funcitons and constants for the MicroBit DAL.
*/
#include "MicroBitConfig.h"
#include "mbed.h"
#include "ErrorNo.h"

View File

@ -3,6 +3,7 @@
*
* A MicroBitDisplay represents the LED matrix array on the MicroBit device.
*/
#include "MicroBitConfig.h"
#include "MicroBitDisplay.h"
#include "MicroBitSystemTimer.h"
#include "MicroBitFiber.h"

View File

@ -4,6 +4,7 @@
* The MicroBitEvent is the event object that represents an event that has occurred on the ubit.
*/
#include "MicroBitConfig.h"
#include "MicroBitEvent.h"
#include "MicroBitSystemTimer.h"
#include "EventModel.h"

View File

@ -7,6 +7,7 @@
* 2) To provide ISR decoupling for Messagebus events generted in an ISR context.
*/
#include "MicroBitConfig.h"
#include "MicroBitFiber.h"
#include "MicroBitSystemTimer.h"

View File

@ -3,6 +3,7 @@
* It represents a font that can be used by the display to render text.
*/
#include "MicroBitConfig.h"
#include "MicroBitFont.h"
/**

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitI2C.h"
#include "ErrorNo.h"
#include "twi_master.h"

View File

@ -4,6 +4,7 @@
* Represents a single IO pin on the edge connector.
*/
#include "MicroBitConfig.h"
#include "MicroBitIO.h"
/**

View File

@ -5,6 +5,7 @@
* n.b. This is a mutable, managed type.
*/
#include "MicroBitConfig.h"
#include "MicroBitImage.h"
#include "MicroBitFont.h"
#include "MicroBitCompat.h"

View File

@ -4,6 +4,7 @@
* This is an object that interleaves light sensing with uBit.display.
*/
#include "MicroBitConfig.h"
#include "MicroBitLightSensor.h"
#include "MicroBitDisplay.h"

View File

@ -4,6 +4,7 @@
* MicroBitListener holds all the information related to a single event handler required
* to match and fire event handlers to incoming events.
*/
#include "MicroBitConfig.h"
#include "MicroBitListener.h"
/**

View File

@ -4,6 +4,7 @@
* The MicroBitMessageBus handles all messages passed between components.
*/
#include "MicroBitConfig.h"
#include "MicroBitMessageBus.h"
#include "MicroBitFiber.h"
#include "ErrorNo.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitMultiButton.h"
/**

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitPin.h"
#include "MicroBitButton.h"
#include "DynamicPwm.h"

View File

@ -1,4 +1,5 @@
#include "mbed.h"
#include "MicroBitConfig.h"
#include "MicroBitSerial.h"
/**

View File

@ -3,6 +3,7 @@
* This allows reading and writing of FLASH memory.
*/
#include "MicroBitConfig.h"
#include "MicroBitStorage.h"
/*

View File

@ -1,5 +1,6 @@
#ifdef UBIT_SUPERMAIN
#include "MicroBitConfig.h"
#include "MicroBit.h"
MicroBit uBit;

View File

@ -9,6 +9,7 @@
* The latter is useful to avoid costs associated with multiple mbed Ticker instances
* in microbit-dal components, as each incurs a significant additional RAM overhead (circa 80 bytes).
*/
#include "MicroBitConfig.h"
#include "MicroBitSystemTimer.h"
#include "ErrorNo.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitThermometer.h"
#include "MicroBitSystemTimer.h"
#include "MicroBitFiber.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "PacketBuffer.h"
#include "ErrorNo.h"

View File

@ -1,4 +1,5 @@
#include "mbed.h"
#include "MicroBitConfig.h"
#include "RefCounted.h"
#include "MicroBitDisplay.h"

View File

@ -2,6 +2,7 @@
* Class definition for the custom MicroBit Accelerometer Service.
* Provides a BLE service to remotely read the state of the accelerometer, and configure its behaviour.
*/
#include "MicroBitConfig.h"
#include "ble/UUID.h"
#include "MicroBitAccelerometerService.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitBLEManager.h"
#include "MicroBitStorage.h"
#include "MicroBitFiber.h"

View File

@ -2,6 +2,7 @@
* Class definition for the custom MicroBit Button Service.
* Provides a BLE service to remotely read the state of each button, and configure its behaviour.
*/
#include "MicroBitConfig.h"
#include "ble/UUID.h"
#include "MicroBitButtonService.h"

View File

@ -7,6 +7,7 @@
* We assume any device that is paied with the micro:bit is authorized to reprogram the device.
*
*/
#include "MicroBitConfig.h"
#include "MicroBitDFUService.h"
#include "ble/UUID.h"
#include "MicroBitConfig.h"

View File

@ -3,6 +3,7 @@
* Provides a BLE gateway onto the MicroBit Message Bus.
*/
#include "MicroBitConfig.h"
#include "MicroBitEventService.h"
#include "ble/UUID.h"
#include "ExternalEvents.h"

View File

@ -2,6 +2,7 @@
* Class definition for the custom MicroBit IOPin Service.
* Provides a BLE service to remotely read the state of the ioPin, and configure its behaviour.
*/
#include "MicroBitConfig.h"
#include "ble/UUID.h"
#include "MicroBitIOPinService.h"

View File

@ -2,6 +2,7 @@
* Class definition for the custom MicroBit LED Service.
* Provides a BLE service to remotely read and write the state of the LED display.
*/
#include "MicroBitConfig.h"
#include "ble/UUID.h"
#include "MicroBitLEDService.h"

View File

@ -2,6 +2,7 @@
* Class definition for the custom MicroBit Magnetometer Service.
* Provides a BLE service to remotely read the state of the magnetometer, and configure its behaviour.
*/
#include "MicroBitConfig.h"
#include "ble/UUID.h"
#include "MicroBitMagnetometerService.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitRadio.h"
#include "MicroBitComponent.h"
#include "EventModel.h"

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitRadio.h"
/**

View File

@ -1,3 +1,4 @@
#include "MicroBitConfig.h"
#include "MicroBitRadio.h"
/**

View File

@ -2,6 +2,7 @@
* Class definition for the custom MicroBit Temperature Service.
* Provides a BLE service to remotely read the state of the temperature, and configure its behaviour.
*/
#include "MicroBitConfig.h"
#include "ble/UUID.h"
#include "MicroBitTemperatureService.h"