From be5c990420fe88a4f7ac95e6c17d4c4f078d9454 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 27 Jul 2023 18:16:18 +0200 Subject: [PATCH 1/2] make changes in v0.2.43 --- inc/compat/MicroBitCompat.h | 16 +++++++++--- model/MicroBit.cpp | 2 +- model/MicroBitIO.cpp | 28 ++++++++++++++++----- model/MicroBitIO.h | 49 +++++++++++++++++++++++++++++++------ module.json | 2 +- 5 files changed, 79 insertions(+), 18 deletions(-) diff --git a/inc/compat/MicroBitCompat.h b/inc/compat/MicroBitCompat.h index 521e9354..411911c5 100644 --- a/inc/compat/MicroBitCompat.h +++ b/inc/compat/MicroBitCompat.h @@ -339,11 +339,21 @@ typedef codal::BitmapFont MicroBitFont; #define MICROBIT_ID_IO_P13 ID_PIN_P13 #define MICROBIT_ID_IO_P14 ID_PIN_P14 #define MICROBIT_ID_IO_P15 ID_PIN_P15 -#define MICROBIT_ID_IO_P16 ID_PIN_P16 -#define MICROBIT_ID_IO_P19 ID_PIN_P19 -#define MICROBIT_ID_IO_P20 ID_PIN_P20 +#define MICROBIT_ID_IO_A1_RX ID_PIN_P16 //#define MICROBIT_ID_IO_P16 +#define MICROBIT_ID_IO_A1_TX ID_PIN_P17 //#define MICROBIT_ID_IO_P17 +#define MICROBIT_ID_IO_P18 ID_PIN_P18 +#define MICROBIT_ID_IO_A0_SCL ID_PIN_P19 +#define MICROBIT_ID_IO_A0_SDA ID_PIN_P20 //#define MICROBIT_ID_IO_P20 #define MICROBIT_ID_LOGO ID_PIN_LOGO +// Calliope mini3 +#define MICROBIT_ID_IO_RGB ID_PIN_RGB +#define MICROBIT_ID_IO_M_A_IN1 ID_PIN_M_A_IN1 +#define MICROBIT_ID_IO_M_A_IN2 ID_PIN_M_A_IN2 +#define MICROBIT_ID_IO_M_B_IN1 ID_PIN_M_B_IN1 +#define MICROBIT_ID_IO_M_B_IN2 ID_PIN_M_B_IN2 +#define MICROBIT_ID_IO_M_MODE ID_PIN_M_MODE + // For MakeCode extension compat. Delete ASAP. #define MICROBIT_ID_FACE ID_PIN_FACE diff --git a/model/MicroBit.cpp b/model/MicroBit.cpp index 20d789a4..116436e4 100644 --- a/model/MicroBit.cpp +++ b/model/MicroBit.cpp @@ -67,7 +67,7 @@ MicroBit::MicroBit() : io(adc, touchSensor), serial(io.usbTx, io.usbRx, NRF_UARTE0), _i2c(io.sda, io.scl), - i2c(io.P20, io.P19), + i2c(io.A0SDA, io.A0SCL), power(_i2c, io, systemTimer), flash(_i2c, io, power), internalFlash(MICROBIT_STORAGE_PAGE, 1, MICROBIT_CODEPAGESIZE), diff --git a/model/MicroBitIO.cpp b/model/MicroBitIO.cpp index aa680dd9..90308f7e 100644 --- a/model/MicroBitIO.cpp +++ b/model/MicroBitIO.cpp @@ -47,7 +47,7 @@ MicroBitIO::MicroBitIO(NRF52ADC &a, TouchSensor &s) : P0(ID_PIN_P0, P0_02, PIN_CAPABILITY_AD), P1(ID_PIN_P1, P0_03, PIN_CAPABILITY_AD), P2(ID_PIN_P2, P0_04, PIN_CAPABILITY_AD), - P3(ID_PIN_P3, P0_31, PIN_CAPABILITY_AD), + P3(ID_PIN_P3, P1_03, PIN_CAPABILITY_AD), //[Calliope] connect PAD3 (P1_03) : DELETE P4(ID_PIN_P4, P0_28, PIN_CAPABILITY_AD), P5(ID_PIN_P5, P0_14, PIN_CAPABILITY_AD), P6(ID_PIN_P6, P1_5, PIN_CAPABILITY_AD), @@ -60,9 +60,25 @@ MicroBitIO::MicroBitIO(NRF52ADC &a, TouchSensor &s) : P13(ID_PIN_P13, P0_17, PIN_CAPABILITY_AD), P14(ID_PIN_P14, P0_01, PIN_CAPABILITY_AD), P15(ID_PIN_P15, P0_13, PIN_CAPABILITY_AD), - P16(ID_PIN_P16, P1_02, PIN_CAPABILITY_AD), - P19(ID_PIN_P19, P0_26, PIN_CAPABILITY_AD), - P20(ID_PIN_P20, P1_00, PIN_CAPABILITY_AD), + /// P16(ID_PIN_P16, P1_02, PIN_CAPABILITY_AD), + A1RX(ID_PIN_P16, P0_29, PIN_CAPABILITY_AD), //[Calliope] connect Grove Analog PIN (P0_29) : DELETE + /// P17(ID_PIN_P17, P1_02, PIN_CAPABILITY_AD), //[Calliope] P17 + A1TX(ID_PIN_P17, P1_02, PIN_CAPABILITY_AD), //[Calliope] P17 + P18(ID_PIN_P18, P0_31, PIN_CAPABILITY_AD), //[Calliope] P18 + /// P19(ID_PIN_P19, P0_26, PIN_CAPABILITY_AD), + A0SCL(ID_PIN_P19, P0_26, PIN_CAPABILITY_AD), + /// P20(ID_PIN_P20, P1_00, PIN_CAPABILITY_AD), + A0SDA(ID_PIN_P20, P1_00, PIN_CAPABILITY_AD), //[Calliope] Place holder for micro:bit pin P3 (P0_31) : DELETE + + // Calliope mini3 + RGB(ID_PIN_RGB, P0_07, PIN_CAPABILITY_AD),// RGBLED P0_07 + M_A_IN1(ID_PIN_M_A_IN1, P1_01, PIN_CAPABILITY_AD),// Motor A IN1 P1_01 + M_A_IN2(ID_PIN_M_A_IN2, P0_27, PIN_CAPABILITY_AD),// Motor A IN2 P0_27 + M_B_IN1(ID_PIN_M_B_IN1, P1_07, PIN_CAPABILITY_AD),// Motor B IN1 P1_07 + M_B_IN2(ID_PIN_M_B_IN2, P1_09, PIN_CAPABILITY_AD),// Motor B IN2 P1_09 + M_MODE(ID_PIN_M_MODE, P1_06, PIN_CAPABILITY_AD),// Motor Mode P1_06 + //PAD3(ID_PIN_PAD3, P1_03, PIN_CAPABILITY_AD),// PAD 3 P1_03 + //GA0(ID_PIN_GA0, P0_29, PIN_CAPABILITY_AD),// Grove Analog P0_29 // Other exposed pins logo(ID_PIN_LOGO, P1_04, PIN_CAPABILITY_AD), @@ -85,14 +101,14 @@ MicroBitIO::MicroBitIO(NRF52ADC &a, TouchSensor &s) : // Aliases col1(P4), col2(P7), - col3(P3), + col3(P18), col4(P6), col5(P10), buttonA(P5), buttonB(P11), face(logo) { - pins = 33; + pins = 41; NRF52Pin::adc = &a; NRF52Pin::touchSensor = &s; diff --git a/model/MicroBitIO.h b/model/MicroBitIO.h index a3cda84c..51ceb739 100644 --- a/model/MicroBitIO.h +++ b/model/MicroBitIO.h @@ -223,7 +223,7 @@ typedef enum { #define MICROBIT_PIN_P0 P0_02 #define MICROBIT_PIN_P1 P0_03 #define MICROBIT_PIN_P2 P0_04 -#define MICROBIT_PIN_P3 P0_31 +#define MICROBIT_PIN_P3 P1_03 //[Calliope] connect PAD3 P1_03 : DELETE #define MICROBIT_PIN_P4 P0_28 #define MICROBIT_PIN_P5 P0_14 #define MICROBIT_PIN_P6 P1_05 @@ -236,10 +236,18 @@ typedef enum { #define MICROBIT_PIN_P13 P0_17 #define MICROBIT_PIN_P14 P0_01 #define MICROBIT_PIN_P15 P0_13 -#define MICROBIT_PIN_P16 P1_02 -#define MICROBIT_PIN_P19 P0_26 +#define MICROBIT_PIN_P16 P0_29 //[Calliope] connect Grove Analog PIN (P0_29) : DELETE +#define MICROBIT_PIN_P17 P1_02 //[Calliope] +#define MICROBIT_PIN_P18 P0_31 //[Calliope]#define MICROBIT_PIN_P19 P0_26 #define MICROBIT_PIN_P20 P1_00 +#define MICROBIT_PIN_RGB P0_07 // RGB +#define MICROBIT_PIN_M_A_IN1 P1_01 // Motor A IN1 +#define MICROBIT_PIN_M_A_IN2 P0_27 // Motor A IN2 +#define MICROBIT_PIN_M_B_IN1 P1_07 // Motor B IN1 +#define MICROBIT_PIN_M_B_IN2 P1_09 // Motor B IN2 +#define MICROBIT_PIN_M_MODE P1_06 // Motor Mode + // User Input #define MICROBIT_PIN_BUTTON_A P0_14 #define MICROBIT_PIN_BUTTON_B P0_23 @@ -338,6 +346,16 @@ typedef enum { #define ID_PIN_P46 (DEVICE_ID_IO_P0 + 46) #define ID_PIN_P47 (DEVICE_ID_IO_P0 + 47) +//Calliope mini3 +#define ID_PIN_RGB (DEVICE_ID_IO_P0 + 51) // RGB +#define ID_PIN_M_A_IN1 (DEVICE_ID_IO_P0 + 52) // Motor A IN1 +#define ID_PIN_M_A_IN2 (DEVICE_ID_IO_P0 + 53) // Motor A IN2 +#define ID_PIN_M_B_IN1 (DEVICE_ID_IO_P0 + 54) // Motor B IN1 +#define ID_PIN_M_B_IN2 (DEVICE_ID_IO_P0 + 55) // Motor B IN2 +#define ID_PIN_M_MODE (DEVICE_ID_IO_P0 + 56) // Motor Mode +//#define ID_PIN_PAD3 (DEVICE_ID_IO_P0 + 57) // PAD3 +//#define ID_PIN_GA0 (DEVICE_ID_IO_P0 + 58) // Grove Analog + // For MakeCode extension compat. Delete ASAP. #define ID_PIN_FACE (ID_PIN_LOGO) @@ -370,7 +388,7 @@ namespace codal NRF52Pin P0; // P0_02 NRF52Pin P1; // P0_03 NRF52Pin P2; // P0_04 - NRF52Pin P3; // P0_31 + NRF52Pin P3; // P1_03 //[Calliope] connect PAD3 (P1_03) : DELETE COMMENT NRF52Pin P4; // P0_28 NRF52Pin P5; // P0_14 NRF52Pin P6; // P1_05 @@ -383,9 +401,16 @@ namespace codal NRF52Pin P13; // P0_17 NRF52Pin P14; // P0_01 NRF52Pin P15; // P0_13 - NRF52Pin P16; // P1_02 - NRF52Pin P19; // P0_26 - NRF52Pin P20; // P1_00 + ///NRF52Pin P16; // P1_02 //[Calliope] connect Grove Analog PIN (P0_29) : DELETE COMMENT + NRF52Pin A1RX; + ///NRF52Pin P17; // //[Calliope] P1_02 + NRF52Pin A1TX; + NRF52Pin P18; // P0_31 + ///NRF52Pin P19; // P0_26 + NRF52Pin A0SCL; + ///NRF52Pin P20; // P1_00 //[Calliope] Place holder for micro:bit pin P3 (P0_31) : DELETE COMMENT + NRF52Pin A0SDA; + // Other exposed pins NRF52Pin logo; // P1_04 @@ -405,6 +430,16 @@ namespace codal NRF52Pin usbRx; NRF52Pin irq1; // P0_25 + //Calliope mini3 + NRF52Pin RGB; // RGBLED P0_07 + NRF52Pin M_A_IN1; // Motor A IN1 P1_01 + NRF52Pin M_A_IN2; // Motor A IN2 P0_27 + NRF52Pin M_B_IN1; // Motor B IN1 P1_07 + NRF52Pin M_B_IN2; // Motor B IN2 P1_09 + NRF52Pin M_MODE; // Motor Mode P1_06 + //NRF52Pin PAD3; // PAD 3 P1_03 + //NRF52Pin GA0; // Grove Analog P0_29 + // Aliases NRF52Pin& col1; NRF52Pin& col2; diff --git a/module.json b/module.json index 5fae8422..1c8dd894 100644 --- a/module.json +++ b/module.json @@ -4,7 +4,7 @@ "description": "CODAL models for microbit", "license": "MIT", "dependencies": { - "codal-core": "git@github.com:lancaster-university/codal-core.git#master", + "codal-core": "git@github.com:calliope-edu/codal-core.git#mini3_proto2", "codal-nrf52": "git@github.com:lancaster-university/codal-nrf52.git#master", "codal-microbit-nrf5sdk": "git@github.com:microbit-foundation/codal-microbit-nrf5sdk.git#master" }, From 9befbbdf376634d483e7a9daaa4ddd931537beac Mon Sep 17 00:00:00 2001 From: fabianhugo Date: Wed, 13 Sep 2023 16:26:32 +0200 Subject: [PATCH 2/2] updates ble name/uuid --- source/bluetooth/MicroBitBLEManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/bluetooth/MicroBitBLEManager.cpp b/source/bluetooth/MicroBitBLEManager.cpp index aee7497b..628411b0 100644 --- a/source/bluetooth/MicroBitBLEManager.cpp +++ b/source/bluetooth/MicroBitBLEManager.cpp @@ -110,7 +110,7 @@ DEALINGS IN THE SOFTWARE. #endif const char *MICROBIT_BLE_MANUFACTURER = NULL; -const char *MICROBIT_BLE_MODEL = "BBC micro:bit"; +const char *MICROBIT_BLE_MODEL = "Calliope mini"; const char *MICROBIT_BLE_VERSION[2] = { "2.0", "2.X" }; const char *MICROBIT_BLE_HARDWARE_VERSION = NULL; const char *MICROBIT_BLE_FIRMWARE_VERSION = MICROBIT_DAL_VERSION;