Generate enums from C++

This commit is contained in:
Michal Moskal
2016-04-01 17:45:18 -07:00
parent 400b9269ee
commit 70bd81d9c2
7 changed files with 585 additions and 241 deletions

View File

@ -1,121 +1,3 @@
enum Button {
A = DAL.MICROBIT_ID_BUTTON_A as number,
B = DAL.MICROBIT_ID_BUTTON_B as number,
//% block="A+B"
AB = DAL.MICROBIT_ID_BUTTON_AB as number,
}
enum Dimension {
//% block=x
X = 0,
//% block=y
Y = 1,
//% block=z
Z = 2,
//% block=strength
Strength = 3,
}
enum Rotation {
//% block=pitch
Pitch = 0,
//% block=roll
Roll = 1,
}
enum TouchPin {
//% enumval=uBit.io.P0
P0,
//% enumval=uBit.io.P1
P1,
//% enumval=uBit.io.P2
P2,
}
enum 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 BasicGesture
{
GESTURE_NONE,
GESTURE_UP,
GESTURE_DOWN,
GESTURE_LEFT,
GESTURE_RIGHT,
GESTURE_FACE_UP,
GESTURE_FACE_DOWN,
GESTURE_FREEFALL,
GESTURE_3G,
GESTURE_6G,
GESTURE_8G,
GESTURE_SHAKE
};
*/
enum Gesture {
/**
* Raised when shaken
*/
//% block=shake
Shake = 11,
/**
* Raised when the logo is upward and the screen is vertical
*/
//% block="logo up"
LogoUp = 1,
/**
* Raised when the logo is downward and the screen is vertical
*/
//% block="logo down"
LogoDown = 2,
/**
* Raised when the screen is pointing down and the board is horizontal
*/
//% block="screen up"
ScreenUp = 5,
/**
* Raised when the screen is pointing up and the board is horizontal
*/
//% block="screen down"
ScreenDown = 6,
/**
* Raised when the screen is pointing left
*/
//% block="tilt left"
TiltLeft = 3,
/**
* Raised when the screen is pointing right
*/
//% block="tilt right"
TiltRight = 4,
/**
* Raised when the board is falling!
*/
//% block="free fall"
FreeFall = 7
}
//% color=300 weight=99
namespace input {
/**