fix touch pins, add test for buttons and pins, update dependency

This commit is contained in:
Matthias L. Jugel 2016-10-19 19:08:41 +02:00
parent 9b599b6242
commit fd14ba6ff1
6 changed files with 27 additions and 4 deletions

View File

@ -1,4 +1,4 @@
basic.showString("RGB") /*basic.showString("RGB")
basic.setLedColor(Colors.Blue) basic.setLedColor(Colors.Blue)
basic.pause(500) basic.pause(500)
basic.setLedColor(Colors.Red) basic.setLedColor(Colors.Red)
@ -39,4 +39,16 @@ input.onGesture(Gesture.ThreeG, () => {
input.onGesture(Gesture.SixG, () => { input.onGesture(Gesture.SixG, () => {
basic.showString("6") basic.showString("6")
}) })
*/
input.onPinPressed(TouchPin.P0, () => {
basic.showNumber(0)
})
input.onPinPressed(TouchPin.P1, () => {
basic.showNumber(1)
})
input.onPinPressed(TouchPin.P2, () => {
basic.showNumber(2)
})
input.onPinPressed(TouchPin.P3, () => {
basic.showNumber(3)
})

3
libs/core/dal.d.ts vendored
View File

@ -145,13 +145,14 @@ declare const enum DAL {
MICROBIT_ID_RADIO_DATA_READY = 30, MICROBIT_ID_RADIO_DATA_READY = 30,
MICROBIT_ID_MULTIBUTTON_ATTACH = 31, MICROBIT_ID_MULTIBUTTON_ATTACH = 31,
MICROBIT_ID_SERIAL = 32, MICROBIT_ID_SERIAL = 32,
CALLIOPE_ID_IO_P0 = 33, CALLIOPE_ID_IO_P3 = 33,
CALLIOPE_ID_IO_P7 = 34, CALLIOPE_ID_IO_P7 = 34,
CALLIOPE_ID_IO_P8 = 35, CALLIOPE_ID_IO_P8 = 35,
CALLIOPE_ID_IO_P9 = 36, CALLIOPE_ID_IO_P9 = 36,
CALLIOPE_ID_IO_P13 = 37, CALLIOPE_ID_IO_P13 = 37,
CALLIOPE_ID_IO_P14 = 38, CALLIOPE_ID_IO_P14 = 38,
CALLIOPE_ID_IO_P15 = 39, CALLIOPE_ID_IO_P15 = 39,
CALLIOPE_ID_IO_P22 = 40,
MICROBIT_ID_MESSAGE_BUS_LISTENER = 1021, MICROBIT_ID_MESSAGE_BUS_LISTENER = 1021,
MICROBIT_ID_NOTIFY_ONE = 1022, MICROBIT_ID_NOTIFY_ONE = 1022,
MICROBIT_ID_NOTIFY = 1023, MICROBIT_ID_NOTIFY = 1023,

View File

@ -37,6 +37,7 @@ declare namespace basic {
P0 = 7, // MICROBIT_ID_IO_P0 P0 = 7, // MICROBIT_ID_IO_P0
P1 = 8, // MICROBIT_ID_IO_P1 P1 = 8, // MICROBIT_ID_IO_P1
P2 = 9, // MICROBIT_ID_IO_P2 P2 = 9, // MICROBIT_ID_IO_P2
P3 = 33, // CALLIOPE_ID_IO_P3
} }

View File

@ -29,6 +29,7 @@ enum class TouchPin {
P0 = MICROBIT_ID_IO_P0, P0 = MICROBIT_ID_IO_P0,
P1 = MICROBIT_ID_IO_P1, P1 = MICROBIT_ID_IO_P1,
P2 = MICROBIT_ID_IO_P2, P2 = MICROBIT_ID_IO_P2,
P3 = CALLIOPE_ID_IO_P3
}; };
enum class AcceleratorRange { enum class AcceleratorRange {

View File

@ -66,6 +66,14 @@ MicroBitPin *getPin(int id) {
//case MICROBIT_ID_IO_P16: return &uBit.io.P16; //case MICROBIT_ID_IO_P16: return &uBit.io.P16;
case MICROBIT_ID_IO_P19: return &uBit.io.P19; case MICROBIT_ID_IO_P19: return &uBit.io.P19;
case MICROBIT_ID_IO_P20: return &uBit.io.P20; case MICROBIT_ID_IO_P20: return &uBit.io.P20;
case CALLIOPE_ID_IO_P3: return &uBit.io.CAL_P3;
case CALLIOPE_ID_IO_P7: return &uBit.io.CAL_P7;
case CALLIOPE_ID_IO_P8: return &uBit.io.CAL_P8;
case CALLIOPE_ID_IO_P9: return &uBit.io.CAL_P9;
case CALLIOPE_ID_IO_P13: return &uBit.io.CAL_P13;
case CALLIOPE_ID_IO_P14: return &uBit.io.CAL_P14;
case CALLIOPE_ID_IO_P15: return &uBit.io.CAL_P15;
case CALLIOPE_ID_IO_P22: return &uBit.io.CAL_P22;
default: return NULL; default: return NULL;
} }
} }

View File

@ -202,7 +202,7 @@
"yottaTarget": "bbc-microbit-classic-gcc", "yottaTarget": "bbc-microbit-classic-gcc",
"yottaCorePackage": "pxt-calliope-core", "yottaCorePackage": "pxt-calliope-core",
"githubCorePackage": "microsoft/pxt-calliope-core", "githubCorePackage": "microsoft/pxt-calliope-core",
"gittag": "v0.5.11", "gittag": "v0.5.12",
"serviceId": "calliope" "serviceId": "calliope"
}, },
"serial": { "serial": {