update motor support and add demo
This commit is contained in:
parent
51e64bd82d
commit
9c3236de80
143
libs/core/dal.d.ts
vendored
143
libs/core/dal.d.ts
vendored
@ -1,11 +1,11 @@
|
||||
// Auto-generated. Do not edit.
|
||||
declare const enum DAL {
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\ExternalEvents.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/ExternalEvents.h
|
||||
MICROBIT_ID_BLE = 1000,
|
||||
MICROBIT_ID_BLE_UART = 1200,
|
||||
MICROBIT_BLE_EVT_CONNECTED = 1,
|
||||
MICROBIT_BLE_EVT_DISCONNECTED = 2,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MESEvents.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MESEvents.h
|
||||
MES_REMOTE_CONTROL_ID = 1001,
|
||||
MES_REMOTE_CONTROL_EVT_PLAY = 1,
|
||||
MES_REMOTE_CONTROL_EVT_PAUSE = 2,
|
||||
@ -70,8 +70,8 @@ declare const enum DAL {
|
||||
MES_DPAD_BUTTON_4_DOWN = 15,
|
||||
MES_DPAD_BUTTON_4_UP = 16,
|
||||
MES_BROADCAST_GENERAL_ID = 2000,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MicroBitAccelerometerService.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MicroBitBLEManager.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitAccelerometerService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitBLEManager.h
|
||||
MICROBIT_BLE_PAIR_REQUEST = 0x01,
|
||||
MICROBIT_BLE_PAIR_COMPLETE = 0x02,
|
||||
MICROBIT_BLE_PAIR_PASSCODE = 0x04,
|
||||
@ -80,26 +80,26 @@ declare const enum DAL {
|
||||
MICROBIT_BLE_POWER_LEVELS = 8,
|
||||
MICROBIT_BLE_MAXIMUM_BONDS = 4,
|
||||
MICROBIT_BLE_EDDYSTONE_URL_ADV_INTERVAL = 400,
|
||||
// built/yt/yotta_modules/microbit-dal/inc//bluetooth/MicroBitButtonService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc//bluetooth/MicroBitDFUService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitButtonService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitDFUService.h
|
||||
MICROBIT_DFU_OPCODE_START_DFU = 1,
|
||||
MICROBIT_DFU_HISTOGRAM_WIDTH = 5,
|
||||
MICROBIT_DFU_HISTOGRAM_HEIGHT = 5,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MicroBitEventService.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MicroBitIOPinService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitEventService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitIOPinService.h
|
||||
MICROBIT_IO_PIN_SERVICE_PINCOUNT = 19,
|
||||
MICROBIT_IO_PIN_SERVICE_DATA_SIZE = 10,
|
||||
MICROBIT_PWM_PIN_SERVICE_DATA_SIZE = 2,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MicroBitLEDService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitLEDService.h
|
||||
MICROBIT_BLE_MAXIMUM_SCROLLTEXT = 20,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MicroBitMagnetometerService.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MicroBitTemperatureService.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\bluetooth\MicroBitUARTService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitMagnetometerService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitTemperatureService.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/bluetooth/MicroBitUARTService.h
|
||||
MICROBIT_UART_S_DEFAULT_BUF_SIZE = 20,
|
||||
MICROBIT_UART_S_EVT_DELIM_MATCH = 1,
|
||||
MICROBIT_UART_S_EVT_HEAD_MATCH = 2,
|
||||
MICROBIT_UART_S_EVT_RX_FULL = 3,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\ErrorNo.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/ErrorNo.h
|
||||
MICROBIT_OK = 0,
|
||||
MICROBIT_INVALID_PARAMETER = -1001,
|
||||
MICROBIT_NOT_SUPPORTED = -1002,
|
||||
@ -114,10 +114,10 @@ declare const enum DAL {
|
||||
MICROBIT_OOM = 20,
|
||||
MICROBIT_HEAP_ERROR = 30,
|
||||
MICROBIT_NULL_DEREFERENCE = 40,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\EventModel.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MemberFunctionCallback.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MicroBitCompat.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MicroBitComponent.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/EventModel.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MemberFunctionCallback.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MicroBitCompat.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MicroBitComponent.h
|
||||
MICROBIT_ID_BUTTON_A = 1,
|
||||
MICROBIT_ID_BUTTON_B = 2,
|
||||
MICROBIT_ID_BUTTON_RESET = 3,
|
||||
@ -160,25 +160,25 @@ declare const enum DAL {
|
||||
MICROBIT_ID_NOTIFY_ONE = 1022,
|
||||
MICROBIT_ID_NOTIFY = 1023,
|
||||
MICROBIT_COMPONENT_RUNNING = 0x01,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MicroBitDevice.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MicroBitDevice.h
|
||||
MICROBIT_NAME_LENGTH = 5,
|
||||
MICROBIT_NAME_CODE_LETTERS = 5,
|
||||
MICROBIT_PANIC_ERROR_CHARS = 4,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MicroBitFiber.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MicroBitFiber.h
|
||||
MICROBIT_SCHEDULER_RUNNING = 0x01,
|
||||
MICROBIT_FIBER_FLAG_FOB = 0x01,
|
||||
MICROBIT_FIBER_FLAG_PARENT = 0x02,
|
||||
MICROBIT_FIBER_FLAG_CHILD = 0x04,
|
||||
MICROBIT_FIBER_FLAG_DO_NOT_PAGE = 0x08,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MicroBitFont.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MicroBitFont.h
|
||||
MICROBIT_FONT_WIDTH = 5,
|
||||
MICROBIT_FONT_HEIGHT = 5,
|
||||
MICROBIT_FONT_ASCII_START = 32,
|
||||
MICROBIT_FONT_ASCII_END = 126,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MicroBitHeapAllocator.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MicroBitHeapAllocator.h
|
||||
MICROBIT_MAXIMUM_HEAPS = 2,
|
||||
MICROBIT_HEAP_BLOCK_FREE = 0x80000000,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MicroBitListener.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MicroBitListener.h
|
||||
MESSAGE_BUS_LISTENER_PARAMETERISED = 0x0001,
|
||||
MESSAGE_BUS_LISTENER_METHOD = 0x0002,
|
||||
MESSAGE_BUS_LISTENER_BUSY = 0x0004,
|
||||
@ -188,16 +188,31 @@ declare const enum DAL {
|
||||
MESSAGE_BUS_LISTENER_NONBLOCKING = 0x0040,
|
||||
MESSAGE_BUS_LISTENER_URGENT = 0x0080,
|
||||
MESSAGE_BUS_LISTENER_DELETING = 0x8000,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\MicroBitSystemTimer.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\core\NotifyEvents.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/MicroBitSystemTimer.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/core/NotifyEvents.h
|
||||
MICROBIT_DISPLAY_EVT_FREE = 1,
|
||||
MICROBIT_SERIAL_EVT_TX_EMPTY = 2,
|
||||
MICROBIT_UART_S_EVT_TX_EMPTY = 3,
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeRGB.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeSoundMotor.h
|
||||
CALLIOPE_SM_DEFAULT_DUTY_M = 50,
|
||||
CALLIOPE_SM_DEFAULT_DUTY_S = 100,
|
||||
CALLIOPE_SM_DEFAULT_FREQUENCY_S = 4000,
|
||||
CALLIOPE_SM_DEFAULT_SILENT_MODE = 1,
|
||||
CALLIOPE_SM_PRESCALER_M = 2,
|
||||
CALLIOPE_SM_PRESCALER_S = 0,
|
||||
CALLIOPE_SM_PRESCALER_S_LF = 4,
|
||||
CALLIOPE_SM_PERIOD_M = 100,
|
||||
CALLIOPE_MIN_FREQUENCY_HZ_S_NP = 245,
|
||||
CALLIOPE_MIN_FREQUENCY_HZ_S = 20,
|
||||
CALLIOPE_MAX_FREQUENCY_HZ_S = 20000,
|
||||
CALLIOPE_BOARD_FREQUENCY = 16000000,
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/DynamicPwm.h
|
||||
NO_PWMS = 3,
|
||||
MICROBIT_DEFAULT_PWM_PERIOD = 20000,
|
||||
PWM_PERSISTENCE_TRANSIENT = 1,
|
||||
PWM_PERSISTENCE_PERSISTENT = 2,
|
||||
// built/yt/yotta_modules/microbit-dal/inc//drivers/MicroBitAccelerometer-bmx.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitAccelerometer-bmx.h
|
||||
BMX055_ACC_WHOAMI = 0x00,
|
||||
BMX055_ACC_D_X_LSB = 0x02,
|
||||
BMX055_ACC_D_X_MSB = 0x03,
|
||||
@ -416,13 +431,14 @@ declare const enum DAL {
|
||||
MICROBIT_ACCELEROMETER_FREEFALL_TOLERANCE = 400,
|
||||
MICROBIT_ACCELEROMETER_SHAKE_TOLERANCE = 400,
|
||||
MICROBIT_ACCELEROMETER_2G_TOLERANCE = 2048,
|
||||
MICROBIT_ACCELEROMETER_3G_TOLERANCE = 3072,
|
||||
MICROBIT_ACCELEROMETER_6G_TOLERANCE = 6144,
|
||||
MICROBIT_ACCELEROMETER_8G_TOLERANCE = 8192,
|
||||
MICROBIT_ACCELEROMETER_GESTURE_DAMPING = 5,
|
||||
MICROBIT_ACCELEROMETER_SHAKE_DAMPING = 10,
|
||||
MICROBIT_ACCELEROMETER_SHAKE_RTX = 30,
|
||||
MICROBIT_ACCELEROMETER_SHAKE_COUNT_THRESHOLD = 4,
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitAccelerometer.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitButton.h
|
||||
MICROBIT_BUTTON_EVT_DOWN = 1,
|
||||
MICROBIT_BUTTON_EVT_UP = 2,
|
||||
MICROBIT_BUTTON_EVT_CLICK = 3,
|
||||
@ -442,7 +458,7 @@ declare const enum DAL {
|
||||
MICROBIT_BUTTON_DOUBLE_CLICK_THRESH = 50,
|
||||
MICROBIT_BUTTON_SIMPLE_EVENTS = 0,
|
||||
MICROBIT_BUTTON_ALL_EVENTS = 1,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitCompass.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitCompass.h
|
||||
MAG3110_DEFAULT_ADDR = 0x1D,
|
||||
MAG_DR_STATUS = 0x00,
|
||||
MAG_OUT_X_MSB = 0x01,
|
||||
@ -473,8 +489,8 @@ declare const enum DAL {
|
||||
MICROBIT_COMPASS_STATUS_CALIBRATING = 4,
|
||||
MICROBIT_COMPASS_STATUS_ADDED_TO_IDLE = 8,
|
||||
MAG3110_WHOAMI_VAL = 0xC4,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitCompassCalibrator.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitDisplay.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitCompassCalibrator.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitDisplay.h
|
||||
MICROBIT_DISPLAY_EVT_ANIMATION_COMPLETE = 1,
|
||||
MICROBIT_DISPLAY_EVT_LIGHT_SENSE = 2,
|
||||
MICROBIT_DISPLAY_DEFAULT_AUTOCLEAR = 1,
|
||||
@ -496,45 +512,21 @@ declare const enum DAL {
|
||||
MICROBIT_DISPLAY_ROTATION_90 = 1,
|
||||
MICROBIT_DISPLAY_ROTATION_180 = 2,
|
||||
MICROBIT_DISPLAY_ROTATION_270 = 3,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitFile.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitFileSystem.h
|
||||
MBFS_FILENAME_LENGTH = 16,
|
||||
MB_READ = 0x01,
|
||||
MB_WRITE = 0x02,
|
||||
MB_CREAT = 0x04,
|
||||
MB_APPEND = 0x08,
|
||||
MB_SEEK_SET = 0x01,
|
||||
MB_SEEK_END = 0x02,
|
||||
MB_SEEK_CUR = 0x04,
|
||||
MBFS_STATUS_INITIALISED = 0x01,
|
||||
MBFS_UNUSED = 0xFFFF,
|
||||
MBFS_EOF = 0xEFFF,
|
||||
MBFS_DELETED = 0x0000,
|
||||
MBFS_DIRECTORY_ENTRY_FREE = 0x8000,
|
||||
MBFS_DIRECTORY_ENTRY_VALID = 0x4000,
|
||||
MBFS_DIRECTORY_ENTRY_DIRECTORY = 0x2000,
|
||||
MBFS_DIRECTORY_ENTRY_NEW = 0xffff,
|
||||
MBFS_DIRECTORY_ENTRY_DELETED = 0x0000,
|
||||
MBFS_BLOCK_TYPE_FILE = 1,
|
||||
MBFS_BLOCK_TYPE_DIRECTORY = 2,
|
||||
MBFS_BLOCK_TYPE_FILETABLE = 3,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitFlash.h
|
||||
PAGE_SIZE = 1024,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitI2C.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitI2C.h
|
||||
MICROBIT_I2C_MAX_RETRIES = 9,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitIO.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitLightSensor.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitIO.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitLightSensor.h
|
||||
MICROBIT_LIGHT_SENSOR_CHAN_NUM = 3,
|
||||
MICROBIT_LIGHT_SENSOR_AN_SET_TIME = 4000,
|
||||
MICROBIT_LIGHT_SENSOR_TICK_PERIOD = 5,
|
||||
MICROBIT_LIGHT_SENSOR_MAX_VALUE = 338,
|
||||
MICROBIT_LIGHT_SENSOR_MIN_VALUE = 75,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitMatrixMaps.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitMatrixMaps.h
|
||||
NO_CONN = 0,
|
||||
MICROBIT_DISPLAY_WIDTH = 5,
|
||||
MICROBIT_DISPLAY_HEIGHT = 5,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitMessageBus.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitMultiButton.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitMessageBus.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitMultiButton.h
|
||||
MICROBIT_MULTI_BUTTON_STATE_1 = 0x01,
|
||||
MICROBIT_MULTI_BUTTON_STATE_2 = 0x02,
|
||||
MICROBIT_MULTI_BUTTON_HOLD_TRIGGERED_1 = 0x04,
|
||||
@ -542,7 +534,7 @@ declare const enum DAL {
|
||||
MICROBIT_MULTI_BUTTON_SUPRESSED_1 = 0X10,
|
||||
MICROBIT_MULTI_BUTTON_SUPRESSED_2 = 0x20,
|
||||
MICROBIT_MULTI_BUTTON_ATTACHED = 0x40,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitPin.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitPin.h
|
||||
IO_STATUS_DIGITAL_IN = 0x01,
|
||||
IO_STATUS_DIGITAL_OUT = 0x02,
|
||||
IO_STATUS_ANALOG_IN = 0x04,
|
||||
@ -566,6 +558,7 @@ declare const enum DAL {
|
||||
PIN_CAPABILITY_DIGITAL = 0x01,
|
||||
PIN_CAPABILITY_ANALOG = 0x02,
|
||||
PIN_CAPABILITY_TOUCH = 0x04,
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitRadio.h
|
||||
MICROBIT_RADIO_STATUS_INITIALISED = 0x0001,
|
||||
MICROBIT_RADIO_BASE_ADDRESS = 0x75626974,
|
||||
MICROBIT_RADIO_DEFAULT_GROUP = 0,
|
||||
@ -577,9 +570,9 @@ declare const enum DAL {
|
||||
MICROBIT_RADIO_PROTOCOL_DATAGRAM = 1,
|
||||
MICROBIT_RADIO_PROTOCOL_EVENTBUS = 2,
|
||||
MICROBIT_RADIO_EVT_DATAGRAM = 1,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitRadioDatagram.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitRadioEvent.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitSerial.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitRadioDatagram.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitRadioEvent.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitSerial.h
|
||||
MICROBIT_SERIAL_DEFAULT_BAUD_RATE = 115200,
|
||||
MICROBIT_SERIAL_DEFAULT_BUFFER_SIZE = 20,
|
||||
MICROBIT_SERIAL_EVT_DELIM_MATCH = 1,
|
||||
@ -592,31 +585,31 @@ declare const enum DAL {
|
||||
ASYNC = 0,
|
||||
SYNC_SPINWAIT = 1,
|
||||
SYNC_SLEEP = 2,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitStorage.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitStorage.h
|
||||
MICROBIT_STORAGE_MAGIC = 0xCAFE,
|
||||
MICROBIT_STORAGE_BLOCK_SIZE = 48,
|
||||
MICROBIT_STORAGE_KEY_SIZE = 16,
|
||||
MICROBIT_STORAGE_STORE_PAGE_OFFSET = 17,
|
||||
MICROBIT_STORAGE_SCRATCH_PAGE_OFFSET = 19,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\MicroBitThermometer.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/MicroBitThermometer.h
|
||||
MICROBIT_THERMOMETER_PERIOD = 1000,
|
||||
MICROBIT_THERMOMETER_EVT_UPDATE = 1,
|
||||
MICROBIT_THERMOMETER_ADDED_TO_IDLE = 2,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\drivers\TimedInterruptIn.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\platform\yotta_cfg_mappings.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\types\ManagedString.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\types\ManagedType.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\types\Matrix4.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\types\MicroBitCoordinateSystem.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/TimedInterruptIn.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/platform/yotta_cfg_mappings.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/types/ManagedString.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/types/ManagedType.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/types/Matrix4.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/types/MicroBitCoordinateSystem.h
|
||||
RAW = 0,
|
||||
SIMPLE_CARTESIAN = 1,
|
||||
NORTH_EAST_DOWN = 2,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\types\MicroBitEvent.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/types/MicroBitEvent.h
|
||||
MICROBIT_ID_ANY = 0,
|
||||
MICROBIT_EVT_ANY = 0,
|
||||
CREATE_ONLY = 0,
|
||||
CREATE_AND_FIRE = 1,
|
||||
// built\yt\yotta_modules\microbit-dal\inc\types\MicroBitImage.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\types\PacketBuffer.h
|
||||
// built\yt\yotta_modules\microbit-dal\inc\types\RefCounted.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/types/MicroBitImage.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/types/PacketBuffer.h
|
||||
// built/yt/yotta_modules/microbit-dal/inc/types/RefCounted.h
|
||||
}
|
||||
|
@ -22,45 +22,45 @@ enum Motor {
|
||||
//% color=#008272 weight=30
|
||||
namespace motors {
|
||||
/**
|
||||
* Turns on the motor at a certain percent of power.
|
||||
* Turns on the motor at a certain percent of power. Switches to single motor mode!
|
||||
* @param power %percent of power sent to the motor. Negative power goes backward. eg: 50
|
||||
*/
|
||||
//% blockId=motor_on block="motor on at %percent"
|
||||
//% parts=dcmotor weight=90 blockGap=8
|
||||
void motorPower(int power) {
|
||||
uBit.soundmotor.Motor_On(power);
|
||||
uBit.soundmotor.motorOn(power);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send break, coast or sleep commands to the motor
|
||||
* Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode.
|
||||
*/
|
||||
//% blockId=motor_command block="motor %command"
|
||||
//% parts=dcmotor weight=85
|
||||
void motorCommand(MotorCommand command) {
|
||||
switch(command) {
|
||||
case MotorCommand::Coast: uBit.soundmotor.Motor_Coast();break;
|
||||
case MotorCommand::Break: uBit.soundmotor.Motor_Break();break;
|
||||
case MotorCommand::Sleep: uBit.soundmotor.Motor_Sleep();break;
|
||||
case MotorCommand::Coast: uBit.soundmotor.motorCoast();break;
|
||||
case MotorCommand::Break: uBit.soundmotor.motorBreak();break;
|
||||
case MotorCommand::Sleep: uBit.soundmotor.motorSleep();break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls two motors attached to the board.
|
||||
* Controls two motors attached to the board. Switches to dual-motor mode!
|
||||
*/
|
||||
//% blockId=block_dual_motor block="motor %motor|at %percent"
|
||||
//% weight=80
|
||||
void dualMotorPower(Motor motor, int duty_percent) {
|
||||
switch(motor) {
|
||||
case Motor::A: if (duty_percent <= 0) uBit.soundmotor.MotorA_Off();
|
||||
else uBit.soundmotor.MotorA_On(duty_percent); break;
|
||||
case Motor::B: if (duty_percent <= 0) uBit.soundmotor.MotorB_Off();
|
||||
else uBit.soundmotor.MotorB_On(duty_percent); break;
|
||||
case Motor::A: if (duty_percent <= 0) uBit.soundmotor.motorAOff();
|
||||
else uBit.soundmotor.motorAOn(duty_percent); break;
|
||||
case Motor::B: if (duty_percent <= 0) uBit.soundmotor.motorBOff();
|
||||
else uBit.soundmotor.motorBOn(duty_percent); break;
|
||||
case Motor::AB: if (duty_percent <= 0) {
|
||||
uBit.soundmotor.MotorA_Off();
|
||||
uBit.soundmotor.MotorB_Off();
|
||||
uBit.soundmotor.motorAOff();
|
||||
uBit.soundmotor.motorBOff();
|
||||
} else {
|
||||
uBit.soundmotor.MotorA_On(duty_percent);
|
||||
uBit.soundmotor.MotorB_On(duty_percent);
|
||||
uBit.soundmotor.motorAOn(duty_percent);
|
||||
uBit.soundmotor.motorBOn(duty_percent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
22
libs/core/shims.d.ts
vendored
22
libs/core/shims.d.ts
vendored
@ -524,7 +524,7 @@ declare namespace led {
|
||||
declare namespace motors {
|
||||
|
||||
/**
|
||||
* Turns on the motor at a certain percent of power.
|
||||
* Turns on the motor at a certain percent of power. Switches to single motor mode!
|
||||
* @param power %percent of power sent to the motor. Negative power goes backward. eg: 50
|
||||
*/
|
||||
//% blockId=motor_on block="motor on at %percent"
|
||||
@ -532,14 +532,14 @@ declare namespace motors {
|
||||
function motorPower(power: number): void;
|
||||
|
||||
/**
|
||||
* Send break, coast or sleep commands to the motor
|
||||
* Send break, coast or sleep commands to the motor. Has no effect in dual-motor mode.
|
||||
*/
|
||||
//% blockId=motor_command block="motor %command"
|
||||
//% parts=dcmotor weight=85 shim=motors::motorCommand
|
||||
function motorCommand(command: MotorCommand): void;
|
||||
|
||||
/**
|
||||
* Controls two motors attached to the board.
|
||||
* Controls two motors attached to the board. Switches to dual-motor mode!
|
||||
*/
|
||||
//% blockId=block_dual_motor block="motor %motor|at %percent"
|
||||
//% weight=80 shim=motors::dualMotorPower
|
||||
@ -554,8 +554,8 @@ declare namespace music {
|
||||
*/
|
||||
//% help=music/play-tone weight=90
|
||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||
//% parts="speaker" async shim=music::playTone
|
||||
function playTone(frequency: number, ms: number): void;
|
||||
//% parts="speaker" shim=music::playTone
|
||||
function playTone(freqency: number, ms: number): void;
|
||||
|
||||
/**
|
||||
* Plays a tone through ``speaker``.
|
||||
@ -566,18 +566,6 @@ declare namespace music {
|
||||
//% parts="speaker" shim=music::ringTone
|
||||
function ringTone(frequency: number): void;
|
||||
}
|
||||
declare namespace music {
|
||||
|
||||
/**
|
||||
* Plays a tone through ``speaker`` for the given duration.
|
||||
* @param frequency pitch of the tone to play in Hertz (Hz)
|
||||
* @param ms tone duration in milliseconds (ms)
|
||||
*/
|
||||
//% help=music/play-tone weight=90
|
||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||
//% parts="speaker" shim=music::playTone
|
||||
function playTone(freqency: number, ms: number): void;
|
||||
}
|
||||
declare namespace pins {
|
||||
|
||||
/**
|
||||
|
36
libs/motor/motor.ts
Normal file
36
libs/motor/motor.ts
Normal file
@ -0,0 +1,36 @@
|
||||
basic.showString("A");
|
||||
motors.dualMotorPower(Motor.A, 100);
|
||||
basic.pause(2000);
|
||||
basic.showString("B");
|
||||
motors.dualMotorPower(Motor.B, 100);
|
||||
basic.pause(2000);
|
||||
basic.showString("X");
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
||||
basic.pause(2000);
|
||||
basic.showString("A");
|
||||
for (var power = 0; power <= 100; power += 10) {
|
||||
basic.showNumber(power/10);
|
||||
motors.dualMotorPower(Motor.A, power);
|
||||
basic.pause(1000);
|
||||
}
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
||||
basic.pause(2000);
|
||||
basic.showString("B");
|
||||
for (power = 0; power <= 100; power += 10) {
|
||||
basic.showNumber(power/10);
|
||||
motors.dualMotorPower(Motor.B, power);
|
||||
basic.pause(1000);
|
||||
}
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
||||
basic.pause(2000);
|
||||
basic.showString("+");
|
||||
motors.dualMotorPower(Motor.AB, 100);
|
||||
basic.pause(2000);
|
||||
basic.showString("#");
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
||||
for (power = 0; power <= 100; power += 10) {
|
||||
basic.showNumber(power/10);
|
||||
motors.dualMotorPower(Motor.AB, power);
|
||||
basic.pause(1000);
|
||||
}
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
11
libs/motor/pxt.json
Normal file
11
libs/motor/pxt.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "calliope",
|
||||
"description": "Motors Example",
|
||||
"files": [
|
||||
"motor.ts"
|
||||
],
|
||||
"public": true,
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
}
|
||||
}
|
@ -169,7 +169,7 @@
|
||||
"yottaTarget": "bbc-microbit-classic-gcc",
|
||||
"yottaCorePackage": "pxt-calliope-core",
|
||||
"githubCorePackage": "microsoft/pxt-calliope-core",
|
||||
"gittag": "v0.5.12",
|
||||
"gittag": "v0.5.13",
|
||||
"serviceId": "calliope"
|
||||
},
|
||||
"serial": {
|
||||
|
Loading…
Reference in New Issue
Block a user