merging microbit

This commit is contained in:
Peli de Halleux
2016-11-09 13:29:34 -08:00
392 changed files with 1730 additions and 1231 deletions

View File

@ -72,12 +72,12 @@ namespace pxsim.pins {
}
export function servoWritePin(pinId: number, value: number) {
let pin = getPin(pinId);
if (!pin) return;
analogSetPeriod(pinId, 20000);
// TODO: per pin state
if (board().microServoState.angle != value) {
board().microServoState.angle = value;
runtime.queueDisplayUpdate();
}
const state = board().servosState.servoState(pinId);
state.setAngle(value);
}
export function servoSetPulse(pinId: number, micros: number) {

18
sim/state/filesystem.ts Normal file
View File

@ -0,0 +1,18 @@
namespace pxsim.files {
export function appendLine(filename: string, text: string) {
const b = board();
b.fileSystem.append(filename, text + "\r\n");
}
export function appendString(filename: string, text: string) {
const b = board();
b.fileSystem.append(filename, text);
}
export function appendNumber(filename: string, value: number) {
const b = board();
b.fileSystem.append(filename, value.toString());
}
export function remove(filename: string) {
const b = board();
b.fileSystem.remove(filename);
}
}