support for filesystem in simulator
This commit is contained in:
parent
90e191c4ca
commit
0269ffa5ae
@ -15,11 +15,13 @@ namespace pxsim {
|
|||||||
// TODO: not singletons
|
// TODO: not singletons
|
||||||
neopixelState: NeoPixelState;
|
neopixelState: NeoPixelState;
|
||||||
microServoState: MicroServoState;
|
microServoState: MicroServoState;
|
||||||
|
fileSystem: FileSystemState;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
// components
|
// components
|
||||||
|
this.fileSystem = new FileSystemState();
|
||||||
this.builtinParts["ledmatrix"] = this.ledMatrixState = new LedMatrixState(runtime);
|
this.builtinParts["ledmatrix"] = this.ledMatrixState = new LedMatrixState(runtime);
|
||||||
this.builtinParts["buttonpair"] = this.buttonPairState = new ButtonPairState({
|
this.builtinParts["buttonpair"] = this.buttonPairState = new ButtonPairState({
|
||||||
ID_BUTTON_A: DAL.MICROBIT_ID_BUTTON_A,
|
ID_BUTTON_A: DAL.MICROBIT_ID_BUTTON_A,
|
||||||
|
18
sim/state/filesystem.ts
Normal file
18
sim/state/filesystem.ts
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user