From bd2fa666efcdcbb8ed9158af755c6015f78bacc0 Mon Sep 17 00:00:00 2001 From: Carlos Pereira Atencio Date: Thu, 29 Feb 2024 14:53:35 +0000 Subject: [PATCH] Add initial version of the DAL programme. --- .gitignore | 6 ++++++ .yotta.json | 5 +++++ README.md | 32 ++++++++++++++++++++++++++++++-- config.json | 18 ++++++++++++++++++ module.json | 11 +++++++++++ src/main.cpp | 22 ++++++++++++++++++++++ 6 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 .yotta.json create mode 100644 config.json create mode 100644 module.json create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5afab4b --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +yotta_targets/* +yotta_modules/* +build/* +*.hex +*.bin +*.DS_Store \ No newline at end of file diff --git a/.yotta.json b/.yotta.json new file mode 100644 index 0000000..06a98ac --- /dev/null +++ b/.yotta.json @@ -0,0 +1,5 @@ +{ + "build": { + "target": "bbc-microbit-classic-gcc,https://github.com/lancaster-university/yotta-target-bbc-microbit-classic-gcc" + } +} diff --git a/README.md b/README.md index 4a98ffc..7d7bbce 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,30 @@ -# incompatible-error-programme -A simple BLE-enabled CODAL programme that scrolls error 927 (programme not compatible) +# Incompatible V1 Error Programme + +A simple BLE-enabled DAL programme for micro:bit V1 that scrolls error code +927 on the display. + +This programme is meant to be used with the +[Universal Hex Creator Tool](https://tech.microbit.org/software/universal-hex-creator/) +to include a micro:bit V1 hex file that scrolls the "not compatible" error code +for V2-only programmes. + +## Dependencies + +- [GNU Arm Embedded Toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads) +- [Git](https://git-scm.com) +- [CMake](https://cmake.org/download/) +- [Python 3](https://www.python.org/downloads/) +- [Ninja](https://ninja-build.org/) +- [Yotta](https://yottabuild.org/) + +Or Docker. + +## Build Instructions + +``` +yotta build +``` + +``` +docker run -v $(pwd):/home --rm ghcr.io/carlosperate/microbit-toolchain:latest yotta build +``` diff --git a/config.json b/config.json new file mode 100644 index 0000000..854223c --- /dev/null +++ b/config.json @@ -0,0 +1,18 @@ +{ + "microbit-dal": { + "bluetooth": { + "enabled": 1, + "pairing_mode": 1, + "private_addressing": 0, + "open": 0, + "whitelist": 1, + "advertising_timeout": 0, + "tx_power": 6, + "security_level": "SECURITY_MODE_ENCRYPTION_NO_MITM", + "event_service": 0, + "dfu_service": 1, + "partial_flashing": 1, + "device_info_service": 1 + } + } +} diff --git a/module.json b/module.json new file mode 100644 index 0000000..3a7e405 --- /dev/null +++ b/module.json @@ -0,0 +1,11 @@ +{ + "name": "error-programme", + "version": "1.0.0", + "description": "The micro:bit runtime common abstraction with examples.", + "license": "MIT", + "dependencies": { + "microbit": "lancaster-university/microbit#v2.1.1" + }, + "targetDependencies": {}, + "bin": "./src" +} diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..c640e2e --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,22 @@ +#include "MicroBit.h" + +MicroBit uBit; + +const uint8_t error_face_[] { + 1, 1, 0, 1, 1, + 1, 1, 0, 1, 1, + 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, + 1, 0, 0, 0, 1, +}; +const MicroBitImage error_face(5, 5, error_face_); + +int main() { + uBit.init(); + + while (true) { + uBit.display.print(error_face); + uBit.sleep(1000); + uBit.display.print("927"); + } +}