moving gyro into separate project

This commit is contained in:
Peli de Halleux
2017-11-30 10:34:34 -08:00
parent 3d29c5e323
commit 3c675892aa
9 changed files with 23 additions and 14 deletions

View File

@ -70,8 +70,6 @@
"screen.clear": "Clear screen and reset font to normal.",
"screen.imageOf": "Makes an image bound to a buffer.",
"screen.unpackPNG": "Decompresses a 1-bit gray scale PNG image to image format.",
"sensors.GyroSensor.angle": "Get the current angle from the gyroscope.",
"sensors.GyroSensor.rate": "Get the current rotation rate from the gyroscope.",
"serial": "Reading and writing data over a serial connection.",
"serial.writeDmesg": "Send DMESG debug buffer over serial."
}

View File

@ -55,12 +55,6 @@
"motors|block": "motors",
"output|block": "output",
"screen|block": "screen",
"sensors.GyroSensor.angle|block": "`icons.gyroSensor` %sensor|angle",
"sensors.GyroSensor.rate|block": "`icons.gyroSensor` %sensor|rotation rate",
"sensors.gyro1|block": "1",
"sensors.gyro2|block": "2",
"sensors.gyro3|block": "3",
"sensors.gyro4|block": "4",
"serial|block": "serial",
"{id:category}Brick": "Brick",
"{id:category}Control": "Control",
@ -70,10 +64,8 @@
"{id:category}Motors": "Motors",
"{id:category}Output": "Output",
"{id:category}Screen": "Screen",
"{id:category}Sensors": "Sensors",
"{id:category}Serial": "Serial",
"{id:group}Buttons": "Buttons",
"{id:group}Gyro Sensor": "Gyro Sensor",
"{id:group}Light": "Light",
"{id:group}Motors": "Motors",
"{id:group}Screen": "Screen"

View File

@ -1,66 +0,0 @@
const enum GyroSensorMode {
None = -1,
Angle = 0,
Rate = 1,
}
namespace sensors {
//% fixedInstances
export class GyroSensor extends internal.UartSensor {
constructor(port: number) {
super(port)
}
_deviceType() {
return DAL.DEVICE_TYPE_GYRO
}
setMode(m: GyroSensorMode) {
this._setMode(m)
}
/**
* Get the current angle from the gyroscope.
* @param sensor the gyroscope to query the request
*/
//% help=input/gyro/angle
//% block="`icons.gyroSensor` %sensor|angle"
//% blockId=gyroGetAngle
//% parts="gyroscope"
//% blockNamespace=sensors
//% weight=65 blockGap=8
//% group="Gyro Sensor"
angle() {
this.setMode(GyroSensorMode.Angle)
return this.getNumber(NumberFormat.Int16LE, 0)
}
/**
* Get the current rotation rate from the gyroscope.
* @param sensor the gyroscope to query the request
*/
//% help=input/gyro/rate
//% block="`icons.gyroSensor` %sensor|rotation rate"
//% blockId=gyroGetRate
//% parts="gyroscope"
//% blockNamespace=sensors
//% weight=65 blockGap=8
//% group="Gyro Sensor"
rate() {
this.setMode(GyroSensorMode.Rate)
return this.getNumber(NumberFormat.Int16LE, 0)
}
}
//% fixedInstance whenUsed block="1"
export const gyro1: GyroSensor = new GyroSensor(1)
//% fixedInstance whenUsed block="2" weight=95
export const gyro2: GyroSensor = new GyroSensor(2)
//% fixedInstance whenUsed block="3"
export const gyro3: GyroSensor = new GyroSensor(3)
//% fixedInstance whenUsed block="4"
export const gyro4: GyroSensor = new GyroSensor(4)
}

View File

@ -18,7 +18,6 @@
"output.ts",
"core.ts",
"input.ts",
"gyro.ts",
"shims.d.ts",
"enums.d.ts",
"dal.d.ts",