From c4e427c090a5b75ef4ecb84b888a6af31e52e0fd Mon Sep 17 00:00:00 2001 From: "Matthias L. Jugel" Date: Thu, 10 Nov 2016 15:11:12 +0100 Subject: [PATCH] fix pins to be in sync with the naming in the simulator and on the board --- libs/core/_locales/core-jsdoc-strings.json | 7 ++- libs/core/enums.d.ts | 42 ++++++++--------- libs/core/pins.cpp | 54 ++++++++++------------ 3 files changed, 47 insertions(+), 56 deletions(-) diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index 55d6c3e1..fd0619b0 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -169,9 +169,9 @@ "led.unplot|param|x": "TODO", "led.unplot|param|y": "TODO", "motors": "Blocks to control the onboard motors", - "motors.dualMotorPower": "Controls two motors attached to the board.", - "motors.motorCommand": "Send break, coast or sleep commands to the motor", - "motors.motorPower": "Turns on the motor at a certain percent of power.", + "motors.dualMotorPower": "Controls two motors attached to the board. Switches to dual-motor mode!", + "motors.motorCommand": "Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode.", + "motors.motorPower": "Turns on the motor at a certain percent of power. Switches to single motor mode!", "motors.motorPower|param|power": "%percent of power sent to the motor. Negative power goes backward. eg: 50", "music": "Generation of music tones through pin ``P0``.", "music.beat": "Returns the duration of a beat in milli-seconds", @@ -180,7 +180,6 @@ "music.noteFrequency": "Gets the frequency of a note.", "music.noteFrequency|param|name": "the note name", "music.playTone": "Plays a tone through ``speaker`` for the given duration.", - "music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)", "music.playTone|param|ms": "tone duration in milliseconds (ms)", "music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.", "music.rest|param|ms": "rest duration in milliseconds (ms)", diff --git a/libs/core/enums.d.ts b/libs/core/enums.d.ts index 8def741a..c2e16d10 100644 --- a/libs/core/enums.d.ts +++ b/libs/core/enums.d.ts @@ -266,37 +266,33 @@ declare namespace motors { P0 = 7, // MICROBIT_ID_IO_P0 P1 = 8, // MICROBIT_ID_IO_P1 P2 = 9, // MICROBIT_ID_IO_P2 - P3 = 10, // MICROBIT_ID_IO_P3 - P4 = 11, // MICROBIT_ID_IO_P4 - P5 = 12, // MICROBIT_ID_IO_P5 - P6 = 13, // MICROBIT_ID_IO_P6 - P7 = 14, // MICROBIT_ID_IO_P7 - //P8 = MICROBIT_ID_IO_P8, - P9 = 16, // MICROBIT_ID_IO_P9 - P10 = 17, // MICROBIT_ID_IO_P10 - P11 = 18, // MICROBIT_ID_IO_P11 - //P12 = MICROBIT_ID_IO_P12, - //P13 = MICROBIT_ID_IO_P13, - //P14 = MICROBIT_ID_IO_P14, - //P15 = MICROBIT_ID_IO_P15, + P3 = 40, // CALLIOPE_ID_IO_P22 + C4 = 10, // MICROBIT_ID_IO_P3 + C5 = 11, // MICROBIT_ID_IO_P4 + C6 = 17, // MICROBIT_ID_IO_P10 + C7 = 34, // CALLIOPE_ID_IO_P7 + C8 = 35, // CALLIOPE_ID_IO_P8 + C9 = 36, // CALLIOPE_ID_IO_P9 + C10 = 16, // MICROBIT_ID_IO_P9 + C11 = 14, // MICROBIT_ID_IO_P7 + C12 = 13, // MICROBIT_ID_IO_P6 + C13 = 37, // CALLIOPE_ID_IO_P13 + C14 = 38, // CALLIOPE_ID_IO_P14 + C15 = 39, // CALLIOPE_ID_IO_P15 //P16 = MICROBIT_ID_IO_P16, - P19 = 24, // MICROBIT_ID_IO_P19 + C19 = 24, // MICROBIT_ID_IO_P19 P20 = 25, // MICROBIT_ID_IO_P20 - P28 = 41, // CALLIOPE_ID_IO_P28 - P29 = 42, // CALLIOPE_ID_IO_P29 - P30 = 43, // CALLIOPE_ID_IO_P30 } declare enum AnalogPin { - P0 = 7, // MICROBIT_ID_IO_P0 + //P0 = MICROBIT_ID_IO_P0, -- does not work analogue P1 = 8, // MICROBIT_ID_IO_P1 P2 = 9, // MICROBIT_ID_IO_P2 - P3 = 10, // MICROBIT_ID_IO_P3 - P4 = 11, // MICROBIT_ID_IO_P4 - P10 = 17, // MICROBIT_ID_IO_P10 - P29 = 42, // CALLIOPE_ID_IO_P29 - P30 = 43, // CALLIOPE_ID_IO_P30 + //P3 = CALLIOPE_ID_IO_P22, -- does not work analogue + C4 = 10, // MICROBIT_ID_IO_P3 + C5 = 11, // MICROBIT_ID_IO_P4 + C6 = 17, // MICROBIT_ID_IO_P10 } diff --git a/libs/core/pins.cpp b/libs/core/pins.cpp index ed867511..47f4c9d2 100644 --- a/libs/core/pins.cpp +++ b/libs/core/pins.cpp @@ -1,39 +1,35 @@ #include "ksbit.h" enum class DigitalPin { - P0 = MICROBIT_ID_IO_P0, - P1 = MICROBIT_ID_IO_P1, - P2 = MICROBIT_ID_IO_P2, - P3 = MICROBIT_ID_IO_P3, - P4 = MICROBIT_ID_IO_P4, - P5 = MICROBIT_ID_IO_P5, - P6 = MICROBIT_ID_IO_P6, - P7 = MICROBIT_ID_IO_P7, - //P8 = MICROBIT_ID_IO_P8, - P9 = MICROBIT_ID_IO_P9, - P10 = MICROBIT_ID_IO_P10, - P11 = MICROBIT_ID_IO_P11, - //P12 = MICROBIT_ID_IO_P12, - //P13 = MICROBIT_ID_IO_P13, - //P14 = MICROBIT_ID_IO_P14, - //P15 = MICROBIT_ID_IO_P15, + P0 = MICROBIT_ID_IO_P0, // edge connector 0 + P1 = MICROBIT_ID_IO_P1, // edge connector 1 + P2 = MICROBIT_ID_IO_P2, // edge connector 2 + P3 = CALLIOPE_ID_IO_P22, // edge connector 3 + C4 = MICROBIT_ID_IO_P3, // LED matrix C1 + C5 = MICROBIT_ID_IO_P4, // LED matrix C2 + C6 = MICROBIT_ID_IO_P10, // LED matrix C3 + C7 = CALLIOPE_ID_IO_P7, // LED matrix C4 + C8 = CALLIOPE_ID_IO_P8, // LED matrix C5 + C9 = CALLIOPE_ID_IO_P9, // LED matrix C6 + C10 = MICROBIT_ID_IO_P9, // LED matrix C7 + C11 = MICROBIT_ID_IO_P7, // LED matrix C8 + C12 = MICROBIT_ID_IO_P6, // LED matrix C9 + C13 = CALLIOPE_ID_IO_P13, // LED matrix R1 + C14 = CALLIOPE_ID_IO_P14, // LED matrix R2 + C15 = CALLIOPE_ID_IO_P15, // LED matrix R3 //P16 = MICROBIT_ID_IO_P16, - P19 = MICROBIT_ID_IO_P19, - P20 = MICROBIT_ID_IO_P20, - P28 = CALLIOPE_ID_IO_P28, - P29 = CALLIOPE_ID_IO_P29, - P30 = CALLIOPE_ID_IO_P30 + C19 = MICROBIT_ID_IO_P19, // SCL + P20 = MICROBIT_ID_IO_P20, // SDA }; enum class AnalogPin { - P0 = MICROBIT_ID_IO_P0, - P1 = MICROBIT_ID_IO_P1, - P2 = MICROBIT_ID_IO_P2, - P3 = MICROBIT_ID_IO_P3, - P4 = MICROBIT_ID_IO_P4, - P10 = MICROBIT_ID_IO_P10, - P29 = CALLIOPE_ID_IO_P29, - P30 = CALLIOPE_ID_IO_P30 + //P0 = MICROBIT_ID_IO_P0, -- does not work analogue + P1 = MICROBIT_ID_IO_P1, // edge connector 1 + P2 = MICROBIT_ID_IO_P2, // edge connector 2 + //P3 = CALLIOPE_ID_IO_P22, -- does not work analogue + C4 = MICROBIT_ID_IO_P3, + C5 = MICROBIT_ID_IO_P4, + C6 = MICROBIT_ID_IO_P10, }; enum class PulseValue {