Skip to content

Commit

Permalink
Merge branch 'master' into pxtgc
Browse files Browse the repository at this point in the history
  • Loading branch information
Juri committed Jul 14, 2019
2 parents 93efd38 + 3db7ffd commit dfc17dd
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build
yotta_modules
yotta_targets/*
.idea
*.iml
3 changes: 2 additions & 1 deletion .yotta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"build": {
"target": "bbc-microbit-classic-gcc,*"
"target": "calliope-mini-classic-gcc,*",
"targetSetExplicitly": true
}
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
> This is a fork of the original microbit adapted for the [Calliope](http://calliope.cc) board.
> The master branch tracks the latest changes (board rev. 1.0+), for code covering the 2016 board (rev 0.3 and lower)
> see the [calliope-mini-2016 branch](../../tree/calliope-mini-2016).

# microbit

A collection of the commonly used components of the micro:bit runtime with a
Expand Down
35 changes: 23 additions & 12 deletions inc/MicroBit.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The MIT License (MIT)
Copyright (c) 2016 British Broadcasting Corporation.
This software is provided by Lancaster University by arrangement with the BBC.
Modifications Copyright (c) 2016 Calliope GbR
Modifications are provided by DELTA Systems (Georg Sommer) - Thomas Kern
und Björn Eberhardt GbR by arrangement with Calliope GbR.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
Expand Down Expand Up @@ -47,8 +51,9 @@ DEALINGS IN THE SOFTWARE.
#include "MicroBitButton.h"
#include "MicroBitPin.h"
#include "MicroBitCompass.h"
#include "MicroBitCompass-bmx.h"
#include "MicroBitCompassCalibrator.h"
#include "MicroBitAccelerometer.h"
#include "MicroBitAccelerometer-bmx.h"
#include "MicroBitThermometer.h"
#include "MicroBitLightSensor.h"
#include "MicroBitMultiButton.h"
Expand All @@ -65,6 +70,9 @@ DEALINGS IN THE SOFTWARE.
#include "MicroBitRadio.h"
#include "MicroBitStorage.h"

#include "CalliopeRGB.h"
#include "CalliopeSoundMotor.h"

// MicroBit::flags values
#define MICROBIT_INITIALIZED 0x01

Expand All @@ -90,19 +98,19 @@ class MicroBit
uint8_t status;

public:

// Serial Interface
MicroBitSerial serial;

// Reset Button
InterruptIn resetButton;

// Persistent key value store
MicroBitStorage storage;

// I2C Interface
MicroBitI2C i2c;

// Device level Message Bus abstraction
MicroBitMessageBus messageBus;

Expand All @@ -115,15 +123,19 @@ class MicroBit
MicroBitCompass &compass;
MicroBitCompassCalibrator compassCalibrator;
MicroBitThermometer thermometer;

//An object of available IO pins on the device
MicroBitIO io;

// Bluetooth related member variables.
MicroBitBLEManager bleManager;
MicroBitRadio radio;
BLEDevice *ble;


//Calliope MINI specific devices
CalliopeRGB rgb;
CalliopeSoundMotor soundmotor;

/**
* Constructor.
*
Expand Down Expand Up @@ -184,7 +196,7 @@ class MicroBit
* Delay execution for the given amount of time.
*
* If the scheduler is running, this will deschedule the current fiber and perform
* a power efficient, concurrent sleep operation.
* a power efficent, concurrent sleep operation.
*
* If the scheduler is disabled or we're running in an interrupt context, this
* will revert to a busy wait.
Expand Down Expand Up @@ -424,15 +436,14 @@ inline void MicroBit::reset()
// Wait a little while for the connection to drop.
wait_ms(100);
}

microbit_reset();
}

/**
* Delay execution for the given amount of time.
*
* If the scheduler is running, this will deschedule the current fiber and perform
* a power efficient, concurrent sleep operation.
* a power efficent, concurrent sleep operation.
*
* If the scheduler is disabled or we're running in an interrupt context, this
* will revert to a busy wait.
Expand Down Expand Up @@ -464,7 +475,7 @@ inline void MicroBit::sleep(uint32_t milliseconds)
* than the hardware random number generator built int the processor, which takes
* a long time and uses a lot of energy.
*
* KIDS: You shouldn't use this is the real world to generate cryptographic keys though...
* KIDS: You shouldn't use this is the real world to generte cryptographic keys though...
* have a think why not. :-)
*
* @param max the upper range to generate a number for. This number cannot be negative.
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "microbit",
"version": "2.1.1",
"version": "2.0.0-calliope-1.0.5",
"description": "A simple to use collection of the most commonly used components in the micro:bit runtime",
"license": "MIT",
"dependencies": {
"microbit-dal": "lancaster-university/microbit-dal#pxtgc-0"
"microbit-dal": "calliope-mini/microbit-dal#v2.0.0-calliope-1.0.5"
},
"extraIncludes": [
"inc"
Expand Down
20 changes: 18 additions & 2 deletions source/MicroBit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
====================
Modifications Copyright (c) 2016 Calliope GbR
Modifications are provided by DELTA Systems (Georg Sommer) - Thomas Kern
und Björn Eberhardt GbR by arrangement with Calliope GbR.
*/

#include <pinmap.h>
#include "MicroBitConfig.h"
/*
* The underlying Nordic libraries that support BLE do not compile cleanly with the stringent GCC settings we employ
Expand Down Expand Up @@ -78,10 +84,17 @@ MicroBit::MicroBit() :
MICROBIT_ID_IO_P9,MICROBIT_ID_IO_P10,MICROBIT_ID_IO_P11,
MICROBIT_ID_IO_P12,MICROBIT_ID_IO_P13,MICROBIT_ID_IO_P14,
MICROBIT_ID_IO_P15,MICROBIT_ID_IO_P16,MICROBIT_ID_IO_P19,
MICROBIT_ID_IO_P20),
MICROBIT_ID_IO_P20
#ifdef TARGET_NRF51_CALLIOPE
,
MICROBIT_ID_IO_P21
#endif
),
bleManager(storage),
radio(),
ble(NULL)
ble(NULL),
rgb(),
soundmotor()
{
// Clear our status
status = 0;
Expand Down Expand Up @@ -111,6 +124,9 @@ void MicroBit::init()
if (status & MICROBIT_INITIALIZED)
return;

// configure the accelerometer
accelerometer.configure();

// Bring up fiber scheduler.
scheduler_init(messageBus);

Expand Down

0 comments on commit dfc17dd

Please sign in to comment.