pxt-calliope/libs/microbit/input.cpp

102 lines
2.0 KiB
C++
Raw Normal View History

2016-04-02 02:45:18 +02:00
#include "BitVM.h"
enum class Button {
A = MICROBIT_ID_BUTTON_A,
B = MICROBIT_ID_BUTTON_B,
//% block="A+B"
AB = MICROBIT_ID_BUTTON_AB,
};
enum class Dimension {
//% block=x
X = 0,
//% block=y
Y = 1,
//% block=z
Z = 2,
//% block=strength
Strength = 3,
};
enum class Rotation {
//% block=pitch
Pitch = 0,
//% block=roll
Roll = 1,
};
enum class TouchPin {
2016-04-02 03:29:39 +02:00
//% enumval=micro_bit::ioP0
2016-04-02 02:45:18 +02:00
P0,
2016-04-02 03:29:39 +02:00
//% enumval=micro_bit::ioP1
2016-04-02 02:45:18 +02:00
P1,
2016-04-02 03:29:39 +02:00
//% enumval=micro_bit::ioP2
2016-04-02 02:45:18 +02:00
P2,
};
enum class AcceleratorRange {
/**
* The accelerator measures forces up to 1 gravity
*/
//% block="1g"
OneG = 1,
/**
* The accelerator measures forces up to 2 gravity
*/
//% block="2g"
TwoG = 2,
/**
* The accelerator measures forces up to 4 gravity
*/
//% block="4g"
FourG = 4,
/**
* The accelerator measures forces up to 8 gravity
*/
//% block="8g"
EightG = 8
};
enum class Gesture {
/**
* Raised when shaken
*/
//% block=shake
Shake = GESTURE_SHAKE,
/**
* Raised when the logo is upward and the screen is vertical
*/
//% block="logo up"
LogoUp = GESTURE_UP,
/**
* Raised when the logo is downward and the screen is vertical
*/
//% block="logo down"
LogoDown = GESTURE_DOWN,
/**
* Raised when the screen is pointing down and the board is horizontal
*/
//% block="screen up"
ScreenUp = GESTURE_FACE_UP,
/**
* Raised when the screen is pointing up and the board is horizontal
*/
//% block="screen down"
ScreenDown = GESTURE_FACE_DOWN,
/**
* Raised when the screen is pointing left
*/
//% block="tilt left"
TiltLeft = GESTURE_LEFT,
/**
* Raised when the screen is pointing right
*/
//% block="tilt right"
TiltRight = GESTURE_RIGHT,
/**
* Raised when the board is falling!
*/
//% block="free fall"
FreeFall = GESTURE_FREEFALL
};