Commit 7bbfca6b authored by Sandeep Mistry's avatar Sandeep Mistry

Add variant for the BBC micro:bit

parent 49058c99
......@@ -9,6 +9,7 @@ Program [Nordic Semiconductor](https://www.nordicsemi.com) nR5 based boards with
* [Bluz DK](http://bluz.io)
* [RedBearLab BLE Nano](http://redbearlab.com/blenano/)
* [RedBearLab nRF51822](http://redbearlab.com/redbearlab-nrf51822/)
* [BBC micro:bit](https://www.microbit.co.uk)
## Installing
......
......@@ -184,6 +184,45 @@ RedBearLab_nRF51822.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF5
RedBearLab_nRF51822.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_{build.chip}.ld
BBCmicrobit.name=BBC micro:bit
BBCmicrobit.vid.0=0x0d28
BBCmicrobit.pid.0=0x0204
BBCmicrobit.upload.tool=sandeepmistry:openocd
BBCmicrobit.upload.target=nrf51
BBCmicrobit.upload.maximum_size=262144
BBCmicrobit.bootloader.tool=sandeepmistry:openocd
BBCmicrobit.build.mcu=cortex-m0
BBCmicrobit.build.f_cpu=16000000
BBCmicrobit.build.board=BLUZ_DK
BBCmicrobit.build.core=nRF5
BBCmicrobit.build.variant=BBCmicrobit
BBCmicrobit.build.variant_system_lib=
BBCmicrobit.build.extra_flags=-DNRF51
BBCmicrobit.build.float_flags=
BBCmicrobit.build.ldscript=nrf51_xxaa.ld
BBCmicrobit.menu.softdevice.none=None
BBCmicrobit.menu.softdevice.none.softdevice=none
BBCmicrobit.menu.softdevice.s110=S110
BBCmicrobit.menu.softdevice.s110.softdevice=s110
BBCmicrobit.menu.softdevice.s110.softdeviceversion=8.0.0
BBCmicrobit.menu.softdevice.s110.upload.maximum_size=151552
BBCmicrobit.menu.softdevice.s110.build.extra_flags=-DNRF51 -DS110 -DNRF51_S110
BBCmicrobit.menu.softdevice.s110.build.ldscript=armgcc_s110_nrf51822_xxaa.ld
BBCmicrobit.menu.softdevice.s130=S130
BBCmicrobit.menu.softdevice.s130.softdevice=s130
BBCmicrobit.menu.softdevice.s130.softdeviceversion=2.0.0
BBCmicrobit.menu.softdevice.s130.upload.maximum_size=151552
BBCmicrobit.menu.softdevice.s130.build.extra_flags=-DNRF51 -DS130 -DNRF51_S130
BBCmicrobit.menu.softdevice.s130.build.ldscript=armgcc_s130_nrf51822_xxaa.ld
Generic_nRF51822.name=Generic nRF51822
Generic_nRF51822.upload.tool=sandeepmistry:openocd
......
/*
binary.h - Definitions for binary constants
Copyright (c) 2006 David A. Mellis. All right reserved.
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef Binary_h
#define Binary_h
#endif
// API compatibility
#include "variant.h"
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
const uint32_t g_ADigitalPinMap[] = {
// 0 - 4
3, // A0 - left pad
2, // A1 - middle pad
1, // A2 - right pad
4, // A3 - COL1
5, // A4 - COL2
// 5 - 9
17, // BTN A
12, // COL9
11, // COL8
18,
10, // COL7
6, // A5 - COL3
26, // BTN B
20,
23, // SCK
22, // MISO
21, // MOSI
16,
// 17 + 18
(uint32_t)-1, // 3.3V
(uint32_t)-1, // 3.3V
0, // SCL
30, // SDA
25, // RX
24, // TX
7, // COL4
8, // COL5
9, // COL6
13, // ROW1
14, // ROW2
15, // ROW3
28, // ACCEL INT 1
27, // ACCEL INT 2
29, // MAG INT 2
19 // RST
};
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_BBC_MICROBIT_
#define _VARIANT_BBC_MICROBIT_
/** Master clock frequency */
#define VARIANT_MCK (16000000ul)
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (33u)
#define NUM_DIGITAL_PINS (20u)
#define NUM_ANALOG_INPUTS (6u)
#define NUM_ANALOG_OUTPUTS (0u)
// LEDs
#define PIN_LED (13)
#define LED_BUILTIN PIN_LED
// #define
// Buttons
#define PIN_BUTTON_A (5)
#define PIN_BUTTON_B (11)
/*
* Analog pins
*/
#define PIN_A0 (0)
#define PIN_A1 (1)
#define PIN_A2 (2)
#define PIN_A3 (3)
#define PIN_A4 (4)
#define PIN_A5 (10)
static const uint8_t A0 = PIN_A0 ;
static const uint8_t A1 = PIN_A1 ;
static const uint8_t A2 = PIN_A2 ;
static const uint8_t A3 = PIN_A3 ;
static const uint8_t A4 = PIN_A4 ;
static const uint8_t A5 = PIN_A5 ;
#define ADC_RESOLUTION 10
/*
* Serial interfaces
*/
// Serial
#define PIN_SERIAL_RX (21)
#define PIN_SERIAL_TX (22)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (14)
#define PIN_SPI_MOSI (15)
#define PIN_SPI_SCK (13)
static const uint8_t SS = 16 ;
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (20u)
#define PIN_WIRE_SCL (19u)
#ifdef __cplusplus
}
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment