fork

Dependencies:   microbit

Committer:
jaafreitas
Date:
Wed Oct 04 18:59:27 2017 +0000
Revision:
1:a61cc2e6192f
Parent:
0:cb05cb0eb8d5
Trying to reproduce the fimware from https://github.com/sandeepmistry/node-bbc-microbit-firmware;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jaafreitas 0:cb05cb0eb8d5 1 /*
jaafreitas 0:cb05cb0eb8d5 2 The MIT License (MIT)
jaafreitas 0:cb05cb0eb8d5 3
jaafreitas 0:cb05cb0eb8d5 4 Copyright (c) 2016 British Broadcasting Corporation.
jaafreitas 0:cb05cb0eb8d5 5 This software is provided by Lancaster University by arrangement with the BBC.
jaafreitas 0:cb05cb0eb8d5 6
jaafreitas 0:cb05cb0eb8d5 7 Permission is hereby granted, free of charge, to any person obtaining a
jaafreitas 0:cb05cb0eb8d5 8 copy of this software and associated documentation files (the "Software"),
jaafreitas 0:cb05cb0eb8d5 9 to deal in the Software without restriction, including without limitation
jaafreitas 0:cb05cb0eb8d5 10 the rights to use, copy, modify, merge, publish, distribute, sublicense,
jaafreitas 0:cb05cb0eb8d5 11 and/or sell copies of the Software, and to permit persons to whom the
jaafreitas 0:cb05cb0eb8d5 12 Software is furnished to do so, subject to the following conditions:
jaafreitas 0:cb05cb0eb8d5 13
jaafreitas 0:cb05cb0eb8d5 14 The above copyright notice and this permission notice shall be included in
jaafreitas 0:cb05cb0eb8d5 15 all copies or substantial portions of the Software.
jaafreitas 0:cb05cb0eb8d5 16
jaafreitas 0:cb05cb0eb8d5 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
jaafreitas 0:cb05cb0eb8d5 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
jaafreitas 0:cb05cb0eb8d5 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
jaafreitas 0:cb05cb0eb8d5 20 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
jaafreitas 0:cb05cb0eb8d5 21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
jaafreitas 0:cb05cb0eb8d5 22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
jaafreitas 0:cb05cb0eb8d5 23 DEALINGS IN THE SOFTWARE.
jaafreitas 0:cb05cb0eb8d5 24 */
jaafreitas 0:cb05cb0eb8d5 25
jaafreitas 0:cb05cb0eb8d5 26 #include "MicroBit.h"
jaafreitas 0:cb05cb0eb8d5 27 //#include "MicroBitUARTService.h"
jaafreitas 0:cb05cb0eb8d5 28
jaafreitas 0:cb05cb0eb8d5 29 MicroBit uBit;
jaafreitas 0:cb05cb0eb8d5 30
jaafreitas 0:cb05cb0eb8d5 31 int main()
jaafreitas 0:cb05cb0eb8d5 32 {
jaafreitas 0:cb05cb0eb8d5 33 printf("starting uBit...\n");
jaafreitas 0:cb05cb0eb8d5 34
jaafreitas 0:cb05cb0eb8d5 35 // Initialise the micro:bit runtime.
jaafreitas 0:cb05cb0eb8d5 36 uBit.init();
jaafreitas 0:cb05cb0eb8d5 37
jaafreitas 0:cb05cb0eb8d5 38 new MicroBitLEDService(*uBit.ble, uBit.display);
jaafreitas 0:cb05cb0eb8d5 39 new MicroBitTemperatureService(*uBit.ble, uBit.thermometer);
jaafreitas 0:cb05cb0eb8d5 40 // new MicroBitUARTService(*uBit.ble, 32, 32);
jaafreitas 0:cb05cb0eb8d5 41 new MicroBitAccelerometerService(*uBit.ble, uBit.accelerometer);
jaafreitas 0:cb05cb0eb8d5 42 new MicroBitMagnetometerService(*uBit.ble, uBit.compass);
jaafreitas 0:cb05cb0eb8d5 43 new MicroBitButtonService(*uBit.ble);
jaafreitas 0:cb05cb0eb8d5 44 new MicroBitIOPinService(*uBit.ble, uBit.io);
jaafreitas 0:cb05cb0eb8d5 45
jaafreitas 0:cb05cb0eb8d5 46 printf("Go!\n");
jaafreitas 0:cb05cb0eb8d5 47
jaafreitas 0:cb05cb0eb8d5 48 // If main exits, there may still be other fibers running or registered event handlers etc.
jaafreitas 0:cb05cb0eb8d5 49 // Simply release this fiber, which will mean we enter the scheduler. Worse case, we then
jaafreitas 0:cb05cb0eb8d5 50 // sit in the idle task forever, in a power efficient sleep.
jaafreitas 0:cb05cb0eb8d5 51 release_fiber();
jaafreitas 0:cb05cb0eb8d5 52 }