rp2040js 0.17.16 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/clock/clock.d.ts +11 -11
- package/dist/cjs/clock/clock.js +2 -2
- package/dist/cjs/clock/mock-clock.d.ts +17 -17
- package/dist/cjs/clock/mock-clock.js +52 -52
- package/dist/cjs/clock/realtime-clock.d.ts +23 -23
- package/dist/cjs/clock/realtime-clock.js +73 -73
- package/dist/cjs/cortex-m0-core.d.ts +87 -87
- package/dist/cjs/cortex-m0-core.js +1251 -1251
- package/dist/cjs/gdb/gdb-connection.d.ts +11 -11
- package/dist/cjs/gdb/gdb-connection.js +57 -57
- package/dist/cjs/gdb/gdb-server.d.ts +23 -23
- package/dist/cjs/gdb/gdb-server.js +232 -232
- package/dist/cjs/gdb/gdb-tcp-server.d.ts +10 -10
- package/dist/cjs/gdb/gdb-tcp-server.js +34 -34
- package/dist/cjs/gdb/gdb-utils.d.ts +9 -9
- package/dist/cjs/gdb/gdb-utils.js +48 -48
- package/dist/cjs/gpio-pin.d.ts +56 -56
- package/dist/cjs/gpio-pin.js +216 -216
- package/dist/cjs/index.d.ts +11 -11
- package/dist/cjs/index.js +36 -36
- package/dist/cjs/interpolator.d.ts +36 -36
- package/dist/cjs/interpolator.js +150 -150
- package/dist/cjs/irq.d.ts +29 -29
- package/dist/cjs/irq.js +33 -33
- package/dist/cjs/peripherals/adc.d.ts +52 -52
- package/dist/cjs/peripherals/adc.js +261 -261
- package/dist/cjs/peripherals/busctrl.d.ts +10 -10
- package/dist/cjs/peripherals/busctrl.js +84 -84
- package/dist/cjs/peripherals/clocks.d.ts +9 -9
- package/dist/cjs/peripherals/clocks.js +42 -42
- package/dist/cjs/peripherals/dma.d.ts +109 -109
- package/dist/cjs/peripherals/dma.js +520 -520
- package/dist/cjs/peripherals/i2c.d.ts +54 -54
- package/dist/cjs/peripherals/i2c.js +458 -458
- package/dist/cjs/peripherals/io.d.ts +11 -11
- package/dist/cjs/peripherals/io.js +100 -100
- package/dist/cjs/peripherals/pads.d.ts +13 -13
- package/dist/cjs/peripherals/pads.js +58 -58
- package/dist/cjs/peripherals/peripheral.d.ts +22 -22
- package/dist/cjs/peripherals/peripheral.js +61 -61
- package/dist/cjs/peripherals/pio.d.ts +120 -120
- package/dist/cjs/peripherals/pio.js +1086 -1086
- package/dist/cjs/peripherals/ppb.d.ts +25 -25
- package/dist/cjs/peripherals/ppb.js +229 -229
- package/dist/cjs/peripherals/pwm.d.ts +65 -65
- package/dist/cjs/peripherals/pwm.js +372 -372
- package/dist/cjs/peripherals/reset.d.ts +8 -8
- package/dist/cjs/peripherals/reset.js +40 -40
- package/dist/cjs/peripherals/rtc.d.ts +10 -10
- package/dist/cjs/peripherals/rtc.js +74 -74
- package/dist/cjs/peripherals/spi.d.ts +38 -30
- package/dist/cjs/peripherals/spi.js +240 -218
- package/dist/cjs/peripherals/ssi.d.ts +6 -6
- package/dist/cjs/peripherals/ssi.js +43 -43
- package/dist/cjs/peripherals/syscfg.d.ts +5 -5
- package/dist/cjs/peripherals/syscfg.js +26 -26
- package/dist/cjs/peripherals/sysinfo.d.ts +4 -4
- package/dist/cjs/peripherals/sysinfo.js +22 -22
- package/dist/cjs/peripherals/tbman.d.ts +4 -4
- package/dist/cjs/peripherals/tbman.js +17 -17
- package/dist/cjs/peripherals/timer.d.ts +18 -18
- package/dist/cjs/peripherals/timer.js +156 -156
- package/dist/cjs/peripherals/uart.d.ts +31 -28
- package/dist/cjs/peripherals/uart.js +132 -135
- package/dist/cjs/peripherals/usb.d.ts +29 -29
- package/dist/cjs/peripherals/usb.js +309 -309
- package/dist/cjs/rp2040.d.ts +71 -71
- package/dist/cjs/rp2040.js +361 -346
- package/dist/cjs/sio.d.ts +21 -21
- package/dist/cjs/sio.js +425 -425
- package/dist/cjs/usb/cdc.d.ts +20 -20
- package/dist/cjs/usb/cdc.js +126 -126
- package/dist/cjs/usb/interfaces.d.ts +47 -47
- package/dist/cjs/usb/interfaces.js +46 -46
- package/dist/cjs/usb/setup.d.ts +5 -5
- package/dist/cjs/usb/setup.js +53 -53
- package/dist/cjs/utils/assembler.d.ts +79 -79
- package/dist/cjs/utils/assembler.js +328 -328
- package/dist/cjs/utils/bit.d.ts +3 -3
- package/dist/cjs/utils/bit.js +15 -15
- package/dist/cjs/utils/fifo.d.ts +15 -15
- package/dist/cjs/utils/fifo.js +56 -56
- package/dist/cjs/utils/logging.d.ts +23 -23
- package/dist/cjs/utils/logging.js +48 -48
- package/dist/cjs/utils/pio-assembler.d.ts +45 -45
- package/dist/cjs/utils/pio-assembler.js +87 -87
- package/dist/cjs/utils/time.d.ts +2 -2
- package/dist/cjs/utils/time.js +32 -32
- package/dist/cjs/utils/timer32.d.ts +57 -57
- package/dist/cjs/utils/timer32.js +208 -208
- package/dist/esm/clock/clock.d.ts +11 -11
- package/dist/esm/clock/clock.js +1 -1
- package/dist/esm/clock/mock-clock.d.ts +17 -17
- package/dist/esm/clock/mock-clock.js +47 -47
- package/dist/esm/clock/realtime-clock.d.ts +23 -23
- package/dist/esm/clock/realtime-clock.js +68 -68
- package/dist/esm/cortex-m0-core.d.ts +87 -87
- package/dist/esm/cortex-m0-core.js +1247 -1247
- package/dist/esm/gdb/gdb-connection.d.ts +11 -11
- package/dist/esm/gdb/gdb-connection.js +53 -53
- package/dist/esm/gdb/gdb-server.d.ts +23 -23
- package/dist/esm/gdb/gdb-server.js +228 -228
- package/dist/esm/gdb/gdb-tcp-server.d.ts +10 -10
- package/dist/esm/gdb/gdb-tcp-server.js +30 -30
- package/dist/esm/gdb/gdb-utils.d.ts +9 -9
- package/dist/esm/gdb/gdb-utils.js +36 -36
- package/dist/esm/gpio-pin.d.ts +56 -56
- package/dist/esm/gpio-pin.js +212 -212
- package/dist/esm/index.d.ts +11 -11
- package/dist/esm/index.js +11 -11
- package/dist/esm/interpolator.d.ts +36 -36
- package/dist/esm/interpolator.js +145 -145
- package/dist/esm/irq.d.ts +29 -29
- package/dist/esm/irq.js +30 -30
- package/dist/esm/peripherals/adc.d.ts +52 -52
- package/dist/esm/peripherals/adc.js +257 -257
- package/dist/esm/peripherals/busctrl.d.ts +10 -10
- package/dist/esm/peripherals/busctrl.js +80 -80
- package/dist/esm/peripherals/clocks.d.ts +9 -9
- package/dist/esm/peripherals/clocks.js +38 -38
- package/dist/esm/peripherals/dma.d.ts +109 -109
- package/dist/esm/peripherals/dma.js +515 -515
- package/dist/esm/peripherals/i2c.d.ts +54 -54
- package/dist/esm/peripherals/i2c.js +454 -454
- package/dist/esm/peripherals/io.d.ts +11 -11
- package/dist/esm/peripherals/io.js +96 -96
- package/dist/esm/peripherals/pads.d.ts +13 -13
- package/dist/esm/peripherals/pads.js +54 -54
- package/dist/esm/peripherals/peripheral.d.ts +22 -22
- package/dist/esm/peripherals/peripheral.js +55 -55
- package/dist/esm/peripherals/pio.d.ts +120 -120
- package/dist/esm/peripherals/pio.js +1081 -1081
- package/dist/esm/peripherals/ppb.d.ts +25 -25
- package/dist/esm/peripherals/ppb.js +225 -225
- package/dist/esm/peripherals/pwm.d.ts +65 -65
- package/dist/esm/peripherals/pwm.js +368 -368
- package/dist/esm/peripherals/reset.d.ts +8 -8
- package/dist/esm/peripherals/reset.js +36 -36
- package/dist/esm/peripherals/rtc.d.ts +10 -10
- package/dist/esm/peripherals/rtc.js +70 -70
- package/dist/esm/peripherals/spi.d.ts +38 -30
- package/dist/esm/peripherals/spi.js +236 -214
- package/dist/esm/peripherals/ssi.d.ts +6 -6
- package/dist/esm/peripherals/ssi.js +39 -39
- package/dist/esm/peripherals/syscfg.d.ts +5 -5
- package/dist/esm/peripherals/syscfg.js +22 -22
- package/dist/esm/peripherals/sysinfo.d.ts +4 -4
- package/dist/esm/peripherals/sysinfo.js +18 -18
- package/dist/esm/peripherals/tbman.d.ts +4 -4
- package/dist/esm/peripherals/tbman.js +13 -13
- package/dist/esm/peripherals/timer.d.ts +18 -18
- package/dist/esm/peripherals/timer.js +152 -152
- package/dist/esm/peripherals/uart.d.ts +31 -28
- package/dist/esm/peripherals/uart.js +128 -131
- package/dist/esm/peripherals/usb.d.ts +29 -29
- package/dist/esm/peripherals/usb.js +305 -305
- package/dist/esm/rp2040.d.ts +71 -71
- package/dist/esm/rp2040.js +357 -342
- package/dist/esm/sio.d.ts +21 -21
- package/dist/esm/sio.js +421 -421
- package/dist/esm/usb/cdc.d.ts +20 -20
- package/dist/esm/usb/cdc.js +121 -121
- package/dist/esm/usb/interfaces.d.ts +47 -47
- package/dist/esm/usb/interfaces.js +43 -43
- package/dist/esm/usb/setup.d.ts +5 -5
- package/dist/esm/usb/setup.js +46 -46
- package/dist/esm/utils/assembler.d.ts +79 -79
- package/dist/esm/utils/assembler.js +245 -245
- package/dist/esm/utils/bit.d.ts +3 -3
- package/dist/esm/utils/bit.js +9 -9
- package/dist/esm/utils/fifo.d.ts +15 -15
- package/dist/esm/utils/fifo.js +52 -52
- package/dist/esm/utils/logging.d.ts +23 -23
- package/dist/esm/utils/logging.js +44 -44
- package/dist/esm/utils/pio-assembler.d.ts +45 -45
- package/dist/esm/utils/pio-assembler.js +75 -75
- package/dist/esm/utils/time.d.ts +2 -2
- package/dist/esm/utils/time.js +27 -27
- package/dist/esm/utils/timer32.d.ts +57 -57
- package/dist/esm/utils/timer32.js +203 -203
- package/package.json +34 -22
- package/dist/esm/package.json +0 -1
package/dist/esm/utils/bit.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function bit(n: number): number;
|
|
2
|
-
export declare function s32(n: number): number;
|
|
3
|
-
export declare function u32(n: number): number;
|
|
1
|
+
export declare function bit(n: number): number;
|
|
2
|
+
export declare function s32(n: number): number;
|
|
3
|
+
export declare function u32(n: number): number;
|
package/dist/esm/utils/bit.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function bit(n) {
|
|
2
|
-
return 1 << n;
|
|
3
|
-
}
|
|
4
|
-
export function s32(n) {
|
|
5
|
-
return n | 0;
|
|
6
|
-
}
|
|
7
|
-
export function u32(n) {
|
|
8
|
-
return n >>> 0;
|
|
9
|
-
}
|
|
1
|
+
export function bit(n) {
|
|
2
|
+
return 1 << n;
|
|
3
|
+
}
|
|
4
|
+
export function s32(n) {
|
|
5
|
+
return n | 0;
|
|
6
|
+
}
|
|
7
|
+
export function u32(n) {
|
|
8
|
+
return n >>> 0;
|
|
9
|
+
}
|
package/dist/esm/utils/fifo.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare class FIFO {
|
|
2
|
-
readonly buffer: Uint32Array;
|
|
3
|
-
private start;
|
|
4
|
-
private used;
|
|
5
|
-
constructor(size: number);
|
|
6
|
-
get size(): number;
|
|
7
|
-
get itemCount(): number;
|
|
8
|
-
push(value: number): void;
|
|
9
|
-
pull(): number;
|
|
10
|
-
peek(): number;
|
|
11
|
-
reset(): void;
|
|
12
|
-
get empty(): boolean;
|
|
13
|
-
get full(): boolean;
|
|
14
|
-
get items(): number[];
|
|
15
|
-
}
|
|
1
|
+
export declare class FIFO {
|
|
2
|
+
readonly buffer: Uint32Array;
|
|
3
|
+
private start;
|
|
4
|
+
private used;
|
|
5
|
+
constructor(size: number);
|
|
6
|
+
get size(): number;
|
|
7
|
+
get itemCount(): number;
|
|
8
|
+
push(value: number): void;
|
|
9
|
+
pull(): number;
|
|
10
|
+
peek(): number;
|
|
11
|
+
reset(): void;
|
|
12
|
+
get empty(): boolean;
|
|
13
|
+
get full(): boolean;
|
|
14
|
+
get items(): number[];
|
|
15
|
+
}
|
package/dist/esm/utils/fifo.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
export class FIFO {
|
|
2
|
-
constructor(size) {
|
|
3
|
-
this.start = 0;
|
|
4
|
-
this.used = 0;
|
|
5
|
-
this.buffer = new Uint32Array(size);
|
|
6
|
-
}
|
|
7
|
-
get size() {
|
|
8
|
-
return this.buffer.length;
|
|
9
|
-
}
|
|
10
|
-
get itemCount() {
|
|
11
|
-
return this.used;
|
|
12
|
-
}
|
|
13
|
-
push(value) {
|
|
14
|
-
const { length } = this.buffer;
|
|
15
|
-
const { start, used } = this;
|
|
16
|
-
if (this.used < length) {
|
|
17
|
-
this.buffer[(start + used) % length] = value;
|
|
18
|
-
this.used++;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
pull() {
|
|
22
|
-
const { start, used } = this;
|
|
23
|
-
const { length } = this.buffer;
|
|
24
|
-
if (used) {
|
|
25
|
-
this.start = (start + 1) % length;
|
|
26
|
-
this.used--;
|
|
27
|
-
return this.buffer[start];
|
|
28
|
-
}
|
|
29
|
-
return 0;
|
|
30
|
-
}
|
|
31
|
-
peek() {
|
|
32
|
-
return this.used ? this.buffer[this.start] : 0;
|
|
33
|
-
}
|
|
34
|
-
reset() {
|
|
35
|
-
this.used = 0;
|
|
36
|
-
}
|
|
37
|
-
get empty() {
|
|
38
|
-
return this.used == 0;
|
|
39
|
-
}
|
|
40
|
-
get full() {
|
|
41
|
-
return this.used === this.buffer.length;
|
|
42
|
-
}
|
|
43
|
-
get items() {
|
|
44
|
-
const { start, used, buffer } = this;
|
|
45
|
-
const { length } = buffer;
|
|
46
|
-
const result = [];
|
|
47
|
-
for (let i = 0; i < used; i++) {
|
|
48
|
-
result[i] = buffer[(start + i) % length];
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
export class FIFO {
|
|
2
|
+
constructor(size) {
|
|
3
|
+
this.start = 0;
|
|
4
|
+
this.used = 0;
|
|
5
|
+
this.buffer = new Uint32Array(size);
|
|
6
|
+
}
|
|
7
|
+
get size() {
|
|
8
|
+
return this.buffer.length;
|
|
9
|
+
}
|
|
10
|
+
get itemCount() {
|
|
11
|
+
return this.used;
|
|
12
|
+
}
|
|
13
|
+
push(value) {
|
|
14
|
+
const { length } = this.buffer;
|
|
15
|
+
const { start, used } = this;
|
|
16
|
+
if (this.used < length) {
|
|
17
|
+
this.buffer[(start + used) % length] = value;
|
|
18
|
+
this.used++;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
pull() {
|
|
22
|
+
const { start, used } = this;
|
|
23
|
+
const { length } = this.buffer;
|
|
24
|
+
if (used) {
|
|
25
|
+
this.start = (start + 1) % length;
|
|
26
|
+
this.used--;
|
|
27
|
+
return this.buffer[start];
|
|
28
|
+
}
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
peek() {
|
|
32
|
+
return this.used ? this.buffer[this.start] : 0;
|
|
33
|
+
}
|
|
34
|
+
reset() {
|
|
35
|
+
this.used = 0;
|
|
36
|
+
}
|
|
37
|
+
get empty() {
|
|
38
|
+
return this.used == 0;
|
|
39
|
+
}
|
|
40
|
+
get full() {
|
|
41
|
+
return this.used === this.buffer.length;
|
|
42
|
+
}
|
|
43
|
+
get items() {
|
|
44
|
+
const { start, used, buffer } = this;
|
|
45
|
+
const { length } = buffer;
|
|
46
|
+
const result = [];
|
|
47
|
+
for (let i = 0; i < used; i++) {
|
|
48
|
+
result[i] = buffer[(start + i) % length];
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export interface Logger {
|
|
2
|
-
debug(componentName: string, message: string): void;
|
|
3
|
-
warn(componentName: string, message: string): void;
|
|
4
|
-
error(componentName: string, message: string): void;
|
|
5
|
-
info(componentName: string, message: string): void;
|
|
6
|
-
}
|
|
7
|
-
export declare enum LogLevel {
|
|
8
|
-
Debug = 0,
|
|
9
|
-
Info = 1,
|
|
10
|
-
Warn = 2,
|
|
11
|
-
Error = 3
|
|
12
|
-
}
|
|
13
|
-
export declare class ConsoleLogger implements Logger {
|
|
14
|
-
currentLogLevel: LogLevel;
|
|
15
|
-
private throwOnError;
|
|
16
|
-
constructor(currentLogLevel: LogLevel, throwOnError?: boolean);
|
|
17
|
-
private aboveLogLevel;
|
|
18
|
-
private formatMessage;
|
|
19
|
-
debug(componetName: string, message: string): void;
|
|
20
|
-
warn(componetName: string, message: string): void;
|
|
21
|
-
error(componentName: string, message: string): void;
|
|
22
|
-
info(componentName: string, message: string): void;
|
|
23
|
-
}
|
|
1
|
+
export interface Logger {
|
|
2
|
+
debug(componentName: string, message: string): void;
|
|
3
|
+
warn(componentName: string, message: string): void;
|
|
4
|
+
error(componentName: string, message: string): void;
|
|
5
|
+
info(componentName: string, message: string): void;
|
|
6
|
+
}
|
|
7
|
+
export declare enum LogLevel {
|
|
8
|
+
Debug = 0,
|
|
9
|
+
Info = 1,
|
|
10
|
+
Warn = 2,
|
|
11
|
+
Error = 3
|
|
12
|
+
}
|
|
13
|
+
export declare class ConsoleLogger implements Logger {
|
|
14
|
+
currentLogLevel: LogLevel;
|
|
15
|
+
private throwOnError;
|
|
16
|
+
constructor(currentLogLevel: LogLevel, throwOnError?: boolean);
|
|
17
|
+
private aboveLogLevel;
|
|
18
|
+
private formatMessage;
|
|
19
|
+
debug(componetName: string, message: string): void;
|
|
20
|
+
warn(componetName: string, message: string): void;
|
|
21
|
+
error(componentName: string, message: string): void;
|
|
22
|
+
info(componentName: string, message: string): void;
|
|
23
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { formatTime } from './time';
|
|
2
|
-
export var LogLevel;
|
|
3
|
-
(function (LogLevel) {
|
|
4
|
-
LogLevel[LogLevel["Debug"] = 0] = "Debug";
|
|
5
|
-
LogLevel[LogLevel["Info"] = 1] = "Info";
|
|
6
|
-
LogLevel[LogLevel["Warn"] = 2] = "Warn";
|
|
7
|
-
LogLevel[LogLevel["Error"] = 3] = "Error";
|
|
8
|
-
})(LogLevel || (LogLevel = {}));
|
|
9
|
-
export class ConsoleLogger {
|
|
10
|
-
constructor(currentLogLevel, throwOnError = true) {
|
|
11
|
-
this.currentLogLevel = currentLogLevel;
|
|
12
|
-
this.throwOnError = throwOnError;
|
|
13
|
-
}
|
|
14
|
-
aboveLogLevel(logLevel) {
|
|
15
|
-
return logLevel >= this.currentLogLevel ? true : false;
|
|
16
|
-
}
|
|
17
|
-
formatMessage(componentName, message) {
|
|
18
|
-
const currentTime = formatTime(new Date());
|
|
19
|
-
return `${currentTime} [${componentName}] ${message}`;
|
|
20
|
-
}
|
|
21
|
-
debug(componetName, message) {
|
|
22
|
-
if (this.aboveLogLevel(LogLevel.Debug)) {
|
|
23
|
-
console.debug(this.formatMessage(componetName, message));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
warn(componetName, message) {
|
|
27
|
-
if (this.aboveLogLevel(LogLevel.Warn)) {
|
|
28
|
-
console.warn(this.formatMessage(componetName, message));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
error(componentName, message) {
|
|
32
|
-
if (this.aboveLogLevel(LogLevel.Error)) {
|
|
33
|
-
console.error(this.formatMessage(componentName, message));
|
|
34
|
-
if (this.throwOnError) {
|
|
35
|
-
throw new Error(`[${componentName}] ${message}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
info(componentName, message) {
|
|
40
|
-
if (this.aboveLogLevel(LogLevel.Info)) {
|
|
41
|
-
console.info(this.formatMessage(componentName, message));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
import { formatTime } from './time.js';
|
|
2
|
+
export var LogLevel;
|
|
3
|
+
(function (LogLevel) {
|
|
4
|
+
LogLevel[LogLevel["Debug"] = 0] = "Debug";
|
|
5
|
+
LogLevel[LogLevel["Info"] = 1] = "Info";
|
|
6
|
+
LogLevel[LogLevel["Warn"] = 2] = "Warn";
|
|
7
|
+
LogLevel[LogLevel["Error"] = 3] = "Error";
|
|
8
|
+
})(LogLevel || (LogLevel = {}));
|
|
9
|
+
export class ConsoleLogger {
|
|
10
|
+
constructor(currentLogLevel, throwOnError = true) {
|
|
11
|
+
this.currentLogLevel = currentLogLevel;
|
|
12
|
+
this.throwOnError = throwOnError;
|
|
13
|
+
}
|
|
14
|
+
aboveLogLevel(logLevel) {
|
|
15
|
+
return logLevel >= this.currentLogLevel ? true : false;
|
|
16
|
+
}
|
|
17
|
+
formatMessage(componentName, message) {
|
|
18
|
+
const currentTime = formatTime(new Date());
|
|
19
|
+
return `${currentTime} [${componentName}] ${message}`;
|
|
20
|
+
}
|
|
21
|
+
debug(componetName, message) {
|
|
22
|
+
if (this.aboveLogLevel(LogLevel.Debug)) {
|
|
23
|
+
console.debug(this.formatMessage(componetName, message));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
warn(componetName, message) {
|
|
27
|
+
if (this.aboveLogLevel(LogLevel.Warn)) {
|
|
28
|
+
console.warn(this.formatMessage(componetName, message));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
error(componentName, message) {
|
|
32
|
+
if (this.aboveLogLevel(LogLevel.Error)) {
|
|
33
|
+
console.error(this.formatMessage(componentName, message));
|
|
34
|
+
if (this.throwOnError) {
|
|
35
|
+
throw new Error(`[${componentName}] ${message}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
info(componentName, message) {
|
|
40
|
+
if (this.aboveLogLevel(LogLevel.Info)) {
|
|
41
|
+
console.info(this.formatMessage(componentName, message));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
export declare const PIO_SRC_PINS = 0;
|
|
2
|
-
export declare const PIO_SRC_X = 1;
|
|
3
|
-
export declare const PIO_SRC_Y = 2;
|
|
4
|
-
export declare const PIO_SRC_NULL = 3;
|
|
5
|
-
export declare const PIO_SRC_STATUS = 5;
|
|
6
|
-
export declare const PIO_SRC_ISR = 6;
|
|
7
|
-
export declare const PIO_SRC_OSR = 7;
|
|
8
|
-
export declare const PIO_DEST_PINS = 0;
|
|
9
|
-
export declare const PIO_DEST_X = 1;
|
|
10
|
-
export declare const PIO_DEST_Y = 2;
|
|
11
|
-
export declare const PIO_DEST_NULL = 3;
|
|
12
|
-
export declare const PIO_DEST_PINDIRS = 4;
|
|
13
|
-
export declare const PIO_DEST_PC = 5;
|
|
14
|
-
export declare const PIO_DEST_ISR = 6;
|
|
15
|
-
export declare const PIO_DEST_EXEC = 7;
|
|
16
|
-
export declare const PIO_MOV_DEST_PINS = 0;
|
|
17
|
-
export declare const PIO_MOV_DEST_X = 1;
|
|
18
|
-
export declare const PIO_MOV_DEST_Y = 2;
|
|
19
|
-
export declare const PIO_MOV_DEST_EXEC = 4;
|
|
20
|
-
export declare const PIO_MOV_DEST_PC = 5;
|
|
21
|
-
export declare const PIO_MOV_DEST_ISR = 6;
|
|
22
|
-
export declare const PIO_MOV_DEST_OSR = 7;
|
|
23
|
-
export declare const PIO_OP_NONE = 0;
|
|
24
|
-
export declare const PIO_OP_INVERT = 1;
|
|
25
|
-
export declare const PIO_OP_BITREV = 2;
|
|
26
|
-
export declare const PIO_WAIT_SRC_GPIO = 0;
|
|
27
|
-
export declare const PIO_WAIT_SRC_PIN = 1;
|
|
28
|
-
export declare const PIO_WAIT_SRC_IRQ = 2;
|
|
29
|
-
export declare const PIO_COND_ALWAYS = 0;
|
|
30
|
-
export declare const PIO_COND_NOTX = 1;
|
|
31
|
-
export declare const PIO_COND_XDEC = 2;
|
|
32
|
-
export declare const PIO_COND_NOTY = 3;
|
|
33
|
-
export declare const PIO_COND_YDEC = 4;
|
|
34
|
-
export declare const PIO_COND_XNEY = 5;
|
|
35
|
-
export declare const PIO_COND_PIN = 6;
|
|
36
|
-
export declare const PIO_COND_NOTEMPTYOSR = 7;
|
|
37
|
-
export declare function pioJMP(cond: number | undefined, address: number, delay?: number): number;
|
|
38
|
-
export declare function pioWAIT(polarity: boolean, src: number, index: number, delay?: number): number;
|
|
39
|
-
export declare function pioIN(src: number, bitCount: number, delay?: number): number;
|
|
40
|
-
export declare function pioOUT(Dest: number, bitCount: number, delay?: number): number;
|
|
41
|
-
export declare function pioPUSH(ifFull: boolean, noBlock: boolean, delay?: number): number;
|
|
42
|
-
export declare function pioPULL(ifEmpty: boolean, noBlock: boolean, delay?: number): number;
|
|
43
|
-
export declare function pioMOV(dest: number, op: number | undefined, src: number, delay?: number): number;
|
|
44
|
-
export declare function pioIRQ(clear: boolean, wait: boolean, index: number, delay?: number): number;
|
|
45
|
-
export declare function pioSET(dest: number, data: number, delay?: number): number;
|
|
1
|
+
export declare const PIO_SRC_PINS = 0;
|
|
2
|
+
export declare const PIO_SRC_X = 1;
|
|
3
|
+
export declare const PIO_SRC_Y = 2;
|
|
4
|
+
export declare const PIO_SRC_NULL = 3;
|
|
5
|
+
export declare const PIO_SRC_STATUS = 5;
|
|
6
|
+
export declare const PIO_SRC_ISR = 6;
|
|
7
|
+
export declare const PIO_SRC_OSR = 7;
|
|
8
|
+
export declare const PIO_DEST_PINS = 0;
|
|
9
|
+
export declare const PIO_DEST_X = 1;
|
|
10
|
+
export declare const PIO_DEST_Y = 2;
|
|
11
|
+
export declare const PIO_DEST_NULL = 3;
|
|
12
|
+
export declare const PIO_DEST_PINDIRS = 4;
|
|
13
|
+
export declare const PIO_DEST_PC = 5;
|
|
14
|
+
export declare const PIO_DEST_ISR = 6;
|
|
15
|
+
export declare const PIO_DEST_EXEC = 7;
|
|
16
|
+
export declare const PIO_MOV_DEST_PINS = 0;
|
|
17
|
+
export declare const PIO_MOV_DEST_X = 1;
|
|
18
|
+
export declare const PIO_MOV_DEST_Y = 2;
|
|
19
|
+
export declare const PIO_MOV_DEST_EXEC = 4;
|
|
20
|
+
export declare const PIO_MOV_DEST_PC = 5;
|
|
21
|
+
export declare const PIO_MOV_DEST_ISR = 6;
|
|
22
|
+
export declare const PIO_MOV_DEST_OSR = 7;
|
|
23
|
+
export declare const PIO_OP_NONE = 0;
|
|
24
|
+
export declare const PIO_OP_INVERT = 1;
|
|
25
|
+
export declare const PIO_OP_BITREV = 2;
|
|
26
|
+
export declare const PIO_WAIT_SRC_GPIO = 0;
|
|
27
|
+
export declare const PIO_WAIT_SRC_PIN = 1;
|
|
28
|
+
export declare const PIO_WAIT_SRC_IRQ = 2;
|
|
29
|
+
export declare const PIO_COND_ALWAYS = 0;
|
|
30
|
+
export declare const PIO_COND_NOTX = 1;
|
|
31
|
+
export declare const PIO_COND_XDEC = 2;
|
|
32
|
+
export declare const PIO_COND_NOTY = 3;
|
|
33
|
+
export declare const PIO_COND_YDEC = 4;
|
|
34
|
+
export declare const PIO_COND_XNEY = 5;
|
|
35
|
+
export declare const PIO_COND_PIN = 6;
|
|
36
|
+
export declare const PIO_COND_NOTEMPTYOSR = 7;
|
|
37
|
+
export declare function pioJMP(cond: number | undefined, address: number, delay?: number): number;
|
|
38
|
+
export declare function pioWAIT(polarity: boolean, src: number, index: number, delay?: number): number;
|
|
39
|
+
export declare function pioIN(src: number, bitCount: number, delay?: number): number;
|
|
40
|
+
export declare function pioOUT(Dest: number, bitCount: number, delay?: number): number;
|
|
41
|
+
export declare function pioPUSH(ifFull: boolean, noBlock: boolean, delay?: number): number;
|
|
42
|
+
export declare function pioPULL(ifEmpty: boolean, noBlock: boolean, delay?: number): number;
|
|
43
|
+
export declare function pioMOV(dest: number, op: number | undefined, src: number, delay?: number): number;
|
|
44
|
+
export declare function pioIRQ(clear: boolean, wait: boolean, index: number, delay?: number): number;
|
|
45
|
+
export declare function pioSET(dest: number, data: number, delay?: number): number;
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
export const PIO_SRC_PINS = 0;
|
|
2
|
-
export const PIO_SRC_X = 1;
|
|
3
|
-
export const PIO_SRC_Y = 2;
|
|
4
|
-
export const PIO_SRC_NULL = 3;
|
|
5
|
-
export const PIO_SRC_STATUS = 5;
|
|
6
|
-
export const PIO_SRC_ISR = 6;
|
|
7
|
-
export const PIO_SRC_OSR = 7;
|
|
8
|
-
export const PIO_DEST_PINS = 0;
|
|
9
|
-
export const PIO_DEST_X = 1;
|
|
10
|
-
export const PIO_DEST_Y = 2;
|
|
11
|
-
export const PIO_DEST_NULL = 3;
|
|
12
|
-
export const PIO_DEST_PINDIRS = 4;
|
|
13
|
-
export const PIO_DEST_PC = 5;
|
|
14
|
-
export const PIO_DEST_ISR = 6;
|
|
15
|
-
export const PIO_DEST_EXEC = 7;
|
|
16
|
-
export const PIO_MOV_DEST_PINS = 0;
|
|
17
|
-
export const PIO_MOV_DEST_X = 1;
|
|
18
|
-
export const PIO_MOV_DEST_Y = 2;
|
|
19
|
-
export const PIO_MOV_DEST_EXEC = 4;
|
|
20
|
-
export const PIO_MOV_DEST_PC = 5;
|
|
21
|
-
export const PIO_MOV_DEST_ISR = 6;
|
|
22
|
-
export const PIO_MOV_DEST_OSR = 7;
|
|
23
|
-
export const PIO_OP_NONE = 0;
|
|
24
|
-
export const PIO_OP_INVERT = 1;
|
|
25
|
-
export const PIO_OP_BITREV = 2;
|
|
26
|
-
export const PIO_WAIT_SRC_GPIO = 0;
|
|
27
|
-
export const PIO_WAIT_SRC_PIN = 1;
|
|
28
|
-
export const PIO_WAIT_SRC_IRQ = 2;
|
|
29
|
-
export const PIO_COND_ALWAYS = 0;
|
|
30
|
-
export const PIO_COND_NOTX = 1;
|
|
31
|
-
export const PIO_COND_XDEC = 2;
|
|
32
|
-
export const PIO_COND_NOTY = 3;
|
|
33
|
-
export const PIO_COND_YDEC = 4;
|
|
34
|
-
export const PIO_COND_XNEY = 5;
|
|
35
|
-
export const PIO_COND_PIN = 6;
|
|
36
|
-
export const PIO_COND_NOTEMPTYOSR = 7;
|
|
37
|
-
export function pioJMP(cond = 0, address, delay = 0) {
|
|
38
|
-
return ((delay & 0x1f) << 8) | ((cond & 0x7) << 5) | (address & 0x1f);
|
|
39
|
-
}
|
|
40
|
-
export function pioWAIT(polarity, src, index, delay = 0) {
|
|
41
|
-
return ((1 << 13) |
|
|
42
|
-
((delay & 0x1f) << 8) |
|
|
43
|
-
((polarity ? 1 : 0) << 7) |
|
|
44
|
-
((src & 0x3) << 5) |
|
|
45
|
-
(index & 0x1f));
|
|
46
|
-
}
|
|
47
|
-
export function pioIN(src, bitCount, delay = 0) {
|
|
48
|
-
return (2 << 13) | ((delay & 0x1f) << 8) | ((src & 0x7) << 5) | (bitCount & 0x1f);
|
|
49
|
-
}
|
|
50
|
-
export function pioOUT(Dest, bitCount, delay = 0) {
|
|
51
|
-
return (3 << 13) | ((delay & 0x1f) << 8) | ((Dest & 0x7) << 5) | (bitCount & 0x1f);
|
|
52
|
-
}
|
|
53
|
-
export function pioPUSH(ifFull, noBlock, delay = 0) {
|
|
54
|
-
return (4 << 13) | ((delay & 0x1f) << 8) | ((ifFull ? 1 : 0) << 6) | ((noBlock ? 1 : 0) << 5);
|
|
55
|
-
}
|
|
56
|
-
export function pioPULL(ifEmpty, noBlock, delay = 0) {
|
|
57
|
-
return ((4 << 13) |
|
|
58
|
-
((delay & 0x1f) << 8) |
|
|
59
|
-
(1 << 7) |
|
|
60
|
-
((ifEmpty ? 1 : 0) << 6) |
|
|
61
|
-
((noBlock ? 1 : 0) << 5));
|
|
62
|
-
}
|
|
63
|
-
export function pioMOV(dest, op = 0, src, delay = 0) {
|
|
64
|
-
return (5 << 13) | ((delay & 0x1f) << 8) | ((dest & 0x7) << 5) | ((op & 0x3) << 3) | (src & 0x7);
|
|
65
|
-
}
|
|
66
|
-
export function pioIRQ(clear, wait, index, delay = 0) {
|
|
67
|
-
return ((6 << 13) |
|
|
68
|
-
((delay & 0x1f) << 8) |
|
|
69
|
-
((clear ? 1 : 0) << 6) |
|
|
70
|
-
((wait ? 1 : 0) << 5) |
|
|
71
|
-
(index & 0x1f));
|
|
72
|
-
}
|
|
73
|
-
export function pioSET(dest, data, delay = 0) {
|
|
74
|
-
return (7 << 13) | ((delay & 0x1f) << 8) | ((dest & 0x7) << 5) | (data & 0x1f);
|
|
75
|
-
}
|
|
1
|
+
export const PIO_SRC_PINS = 0;
|
|
2
|
+
export const PIO_SRC_X = 1;
|
|
3
|
+
export const PIO_SRC_Y = 2;
|
|
4
|
+
export const PIO_SRC_NULL = 3;
|
|
5
|
+
export const PIO_SRC_STATUS = 5;
|
|
6
|
+
export const PIO_SRC_ISR = 6;
|
|
7
|
+
export const PIO_SRC_OSR = 7;
|
|
8
|
+
export const PIO_DEST_PINS = 0;
|
|
9
|
+
export const PIO_DEST_X = 1;
|
|
10
|
+
export const PIO_DEST_Y = 2;
|
|
11
|
+
export const PIO_DEST_NULL = 3;
|
|
12
|
+
export const PIO_DEST_PINDIRS = 4;
|
|
13
|
+
export const PIO_DEST_PC = 5;
|
|
14
|
+
export const PIO_DEST_ISR = 6;
|
|
15
|
+
export const PIO_DEST_EXEC = 7;
|
|
16
|
+
export const PIO_MOV_DEST_PINS = 0;
|
|
17
|
+
export const PIO_MOV_DEST_X = 1;
|
|
18
|
+
export const PIO_MOV_DEST_Y = 2;
|
|
19
|
+
export const PIO_MOV_DEST_EXEC = 4;
|
|
20
|
+
export const PIO_MOV_DEST_PC = 5;
|
|
21
|
+
export const PIO_MOV_DEST_ISR = 6;
|
|
22
|
+
export const PIO_MOV_DEST_OSR = 7;
|
|
23
|
+
export const PIO_OP_NONE = 0;
|
|
24
|
+
export const PIO_OP_INVERT = 1;
|
|
25
|
+
export const PIO_OP_BITREV = 2;
|
|
26
|
+
export const PIO_WAIT_SRC_GPIO = 0;
|
|
27
|
+
export const PIO_WAIT_SRC_PIN = 1;
|
|
28
|
+
export const PIO_WAIT_SRC_IRQ = 2;
|
|
29
|
+
export const PIO_COND_ALWAYS = 0;
|
|
30
|
+
export const PIO_COND_NOTX = 1;
|
|
31
|
+
export const PIO_COND_XDEC = 2;
|
|
32
|
+
export const PIO_COND_NOTY = 3;
|
|
33
|
+
export const PIO_COND_YDEC = 4;
|
|
34
|
+
export const PIO_COND_XNEY = 5;
|
|
35
|
+
export const PIO_COND_PIN = 6;
|
|
36
|
+
export const PIO_COND_NOTEMPTYOSR = 7;
|
|
37
|
+
export function pioJMP(cond = 0, address, delay = 0) {
|
|
38
|
+
return ((delay & 0x1f) << 8) | ((cond & 0x7) << 5) | (address & 0x1f);
|
|
39
|
+
}
|
|
40
|
+
export function pioWAIT(polarity, src, index, delay = 0) {
|
|
41
|
+
return ((1 << 13) |
|
|
42
|
+
((delay & 0x1f) << 8) |
|
|
43
|
+
((polarity ? 1 : 0) << 7) |
|
|
44
|
+
((src & 0x3) << 5) |
|
|
45
|
+
(index & 0x1f));
|
|
46
|
+
}
|
|
47
|
+
export function pioIN(src, bitCount, delay = 0) {
|
|
48
|
+
return (2 << 13) | ((delay & 0x1f) << 8) | ((src & 0x7) << 5) | (bitCount & 0x1f);
|
|
49
|
+
}
|
|
50
|
+
export function pioOUT(Dest, bitCount, delay = 0) {
|
|
51
|
+
return (3 << 13) | ((delay & 0x1f) << 8) | ((Dest & 0x7) << 5) | (bitCount & 0x1f);
|
|
52
|
+
}
|
|
53
|
+
export function pioPUSH(ifFull, noBlock, delay = 0) {
|
|
54
|
+
return (4 << 13) | ((delay & 0x1f) << 8) | ((ifFull ? 1 : 0) << 6) | ((noBlock ? 1 : 0) << 5);
|
|
55
|
+
}
|
|
56
|
+
export function pioPULL(ifEmpty, noBlock, delay = 0) {
|
|
57
|
+
return ((4 << 13) |
|
|
58
|
+
((delay & 0x1f) << 8) |
|
|
59
|
+
(1 << 7) |
|
|
60
|
+
((ifEmpty ? 1 : 0) << 6) |
|
|
61
|
+
((noBlock ? 1 : 0) << 5));
|
|
62
|
+
}
|
|
63
|
+
export function pioMOV(dest, op = 0, src, delay = 0) {
|
|
64
|
+
return (5 << 13) | ((delay & 0x1f) << 8) | ((dest & 0x7) << 5) | ((op & 0x3) << 3) | (src & 0x7);
|
|
65
|
+
}
|
|
66
|
+
export function pioIRQ(clear, wait, index, delay = 0) {
|
|
67
|
+
return ((6 << 13) |
|
|
68
|
+
((delay & 0x1f) << 8) |
|
|
69
|
+
((clear ? 1 : 0) << 6) |
|
|
70
|
+
((wait ? 1 : 0) << 5) |
|
|
71
|
+
(index & 0x1f));
|
|
72
|
+
}
|
|
73
|
+
export function pioSET(dest, data, delay = 0) {
|
|
74
|
+
return (7 << 13) | ((delay & 0x1f) << 8) | ((dest & 0x7) << 5) | (data & 0x1f);
|
|
75
|
+
}
|
package/dist/esm/utils/time.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getCurrentMicroseconds(): number;
|
|
2
|
-
export declare function formatTime(date: Date): string;
|
|
1
|
+
export declare function getCurrentMicroseconds(): number;
|
|
2
|
+
export declare function formatTime(date: Date): string;
|
package/dist/esm/utils/time.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export function getCurrentMicroseconds() {
|
|
2
|
-
if (typeof performance != 'undefined') {
|
|
3
|
-
return Math.floor(performance.now() * 1000);
|
|
4
|
-
}
|
|
5
|
-
else {
|
|
6
|
-
return Math.floor(eval('require')('perf_hooks').performance.now() * 1000);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
function leftPad(value, minLength, padChar = ' ') {
|
|
10
|
-
if (value.length < minLength) {
|
|
11
|
-
value = padChar + value;
|
|
12
|
-
}
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
function rightPad(value, minLength, padChar = ' ') {
|
|
16
|
-
if (value.length < minLength) {
|
|
17
|
-
value += padChar;
|
|
18
|
-
}
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
export function formatTime(date) {
|
|
22
|
-
const hours = leftPad(date.getHours().toString(), 2, '0');
|
|
23
|
-
const minutes = leftPad(date.getMinutes().toString(), 2, '0');
|
|
24
|
-
const seconds = leftPad(date.getSeconds().toString(), 2, '0');
|
|
25
|
-
const milliseconds = rightPad(date.getMilliseconds().toString(), 3);
|
|
26
|
-
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
|
|
27
|
-
}
|
|
1
|
+
export function getCurrentMicroseconds() {
|
|
2
|
+
if (typeof performance != 'undefined') {
|
|
3
|
+
return Math.floor(performance.now() * 1000);
|
|
4
|
+
}
|
|
5
|
+
else {
|
|
6
|
+
return Math.floor(eval('require')('perf_hooks').performance.now() * 1000);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function leftPad(value, minLength, padChar = ' ') {
|
|
10
|
+
if (value.length < minLength) {
|
|
11
|
+
value = padChar + value;
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function rightPad(value, minLength, padChar = ' ') {
|
|
16
|
+
if (value.length < minLength) {
|
|
17
|
+
value += padChar;
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
export function formatTime(date) {
|
|
22
|
+
const hours = leftPad(date.getHours().toString(), 2, '0');
|
|
23
|
+
const minutes = leftPad(date.getMinutes().toString(), 2, '0');
|
|
24
|
+
const seconds = leftPad(date.getSeconds().toString(), 2, '0');
|
|
25
|
+
const milliseconds = rightPad(date.getMilliseconds().toString(), 3);
|
|
26
|
+
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
|
|
27
|
+
}
|