Generate enums from C++
This commit is contained in:
101
libs/microbit/input.cpp
Normal file
101
libs/microbit/input.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
#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 {
|
||||
//% enumval=uBit.io.P0
|
||||
P0,
|
||||
//% enumval=uBit.io.P1
|
||||
P1,
|
||||
//% enumval=uBit.io.P2
|
||||
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
|
||||
};
|
Reference in New Issue
Block a user