rp2040js 0.19.2 → 0.19.3

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.
@@ -28,6 +28,10 @@ export declare class RPI2C extends BasePeripheral implements Peripheral {
28
28
  rxThreshold: number;
29
29
  txThreshold: number;
30
30
  control: number;
31
+ ssClockHighPeriod: number;
32
+ ssClockLowPeriod: number;
33
+ fsClockHighPeriod: number;
34
+ fsClockLowPeriod: number;
31
35
  targetAddress: number;
32
36
  slaveAddress: number;
33
37
  abortSource: number;
@@ -35,6 +39,8 @@ export declare class RPI2C extends BasePeripheral implements Peripheral {
35
39
  intEnable: number;
36
40
  get intStatus(): number;
37
41
  get speed(): I2CSpeed;
42
+ get sclLowPeriod(): number;
43
+ get sclHighPeriod(): number;
38
44
  get masterBits(): 7 | 10;
39
45
  constructor(rp2040: RP2040, name: string, irq: number);
40
46
  checkInterrupts(): void;
@@ -142,6 +142,12 @@ class RPI2C extends peripheral_js_1.BasePeripheral {
142
142
  get speed() {
143
143
  return ((this.control >> SPEED_SHIFT) & SPEED_MASK);
144
144
  }
145
+ get sclLowPeriod() {
146
+ return this.speed === I2CSpeed.Standard ? this.ssClockLowPeriod : this.fsClockLowPeriod;
147
+ }
148
+ get sclHighPeriod() {
149
+ return this.speed === I2CSpeed.Standard ? this.ssClockHighPeriod : this.fsClockHighPeriod;
150
+ }
145
151
  get masterBits() {
146
152
  return this.control & IC_10BITADDR_MASTER ? 10 : 7;
147
153
  }
@@ -165,6 +171,10 @@ class RPI2C extends peripheral_js_1.BasePeripheral {
165
171
  this.rxThreshold = 0;
166
172
  this.txThreshold = 0;
167
173
  this.control = IC_SLAVE_DISABLE | IC_RESTART_EN | (I2CSpeed.FastMode << SPEED_SHIFT) | MASTER_MODE;
174
+ this.ssClockHighPeriod = 0x0028;
175
+ this.ssClockLowPeriod = 0x002f;
176
+ this.fsClockHighPeriod = 0x0006;
177
+ this.fsClockLowPeriod = 0x000d;
168
178
  this.targetAddress = 0x55;
169
179
  this.slaveAddress = 0x55;
170
180
  this.abortSource = 0;
@@ -323,6 +333,14 @@ class RPI2C extends peripheral_js_1.BasePeripheral {
323
333
  }
324
334
  this.clearInterrupts(R_RX_FULL);
325
335
  return this.rxFIFO.pull();
336
+ case IC_SS_SCL_HCNT:
337
+ return this.ssClockHighPeriod;
338
+ case IC_SS_SCL_LCNT:
339
+ return this.ssClockLowPeriod;
340
+ case IC_FS_SCL_HCNT:
341
+ return this.fsClockHighPeriod;
342
+ case IC_FS_SCL_LCNT:
343
+ return this.fsClockLowPeriod;
326
344
  case IC_INTR_STAT:
327
345
  return this.intStatus;
328
346
  case IC_INTR_MASK:
@@ -419,6 +437,18 @@ class RPI2C extends peripheral_js_1.BasePeripheral {
419
437
  this.nextCommand();
420
438
  }
421
439
  return;
440
+ case IC_SS_SCL_HCNT:
441
+ this.ssClockHighPeriod = value & 0xffff;
442
+ return;
443
+ case IC_SS_SCL_LCNT:
444
+ this.ssClockLowPeriod = value & 0xffff;
445
+ return;
446
+ case IC_FS_SCL_HCNT:
447
+ this.fsClockHighPeriod = value & 0xffff;
448
+ return;
449
+ case IC_FS_SCL_LCNT:
450
+ this.fsClockLowPeriod = value & 0xffff;
451
+ return;
422
452
  case IC_RX_TL:
423
453
  this.rxThreshold = value & 0xff;
424
454
  if (this.rxThreshold > this.rxFIFO.size) {
@@ -2,8 +2,6 @@ import { BasePeripheral, Peripheral } from './peripheral.js';
2
2
  export declare class RP2040RTC extends BasePeripheral implements Peripheral {
3
3
  setup0: number;
4
4
  setup1: number;
5
- rtc1: number;
6
- rtc0: number;
7
5
  ctrl: number;
8
6
  baseline: Date;
9
7
  baselineMicros: number;
@@ -44,8 +44,6 @@ class RP2040RTC extends peripheral_js_1.BasePeripheral {
44
44
  super(...arguments);
45
45
  this.setup0 = 0;
46
46
  this.setup1 = 0;
47
- this.rtc1 = 0;
48
- this.rtc0 = 0;
49
47
  this.ctrl = 0;
50
48
  this.baseline = new Date(2021, 0, 1);
51
49
  this.baselineMicros = 0;
@@ -28,6 +28,10 @@ export declare class RPI2C extends BasePeripheral implements Peripheral {
28
28
  rxThreshold: number;
29
29
  txThreshold: number;
30
30
  control: number;
31
+ ssClockHighPeriod: number;
32
+ ssClockLowPeriod: number;
33
+ fsClockHighPeriod: number;
34
+ fsClockLowPeriod: number;
31
35
  targetAddress: number;
32
36
  slaveAddress: number;
33
37
  abortSource: number;
@@ -35,6 +39,8 @@ export declare class RPI2C extends BasePeripheral implements Peripheral {
35
39
  intEnable: number;
36
40
  get intStatus(): number;
37
41
  get speed(): I2CSpeed;
42
+ get sclLowPeriod(): number;
43
+ get sclHighPeriod(): number;
38
44
  get masterBits(): 7 | 10;
39
45
  constructor(rp2040: RP2040, name: string, irq: number);
40
46
  checkInterrupts(): void;
@@ -139,6 +139,12 @@ export class RPI2C extends BasePeripheral {
139
139
  get speed() {
140
140
  return ((this.control >> SPEED_SHIFT) & SPEED_MASK);
141
141
  }
142
+ get sclLowPeriod() {
143
+ return this.speed === I2CSpeed.Standard ? this.ssClockLowPeriod : this.fsClockLowPeriod;
144
+ }
145
+ get sclHighPeriod() {
146
+ return this.speed === I2CSpeed.Standard ? this.ssClockHighPeriod : this.fsClockHighPeriod;
147
+ }
142
148
  get masterBits() {
143
149
  return this.control & IC_10BITADDR_MASTER ? 10 : 7;
144
150
  }
@@ -162,6 +168,10 @@ export class RPI2C extends BasePeripheral {
162
168
  this.rxThreshold = 0;
163
169
  this.txThreshold = 0;
164
170
  this.control = IC_SLAVE_DISABLE | IC_RESTART_EN | (I2CSpeed.FastMode << SPEED_SHIFT) | MASTER_MODE;
171
+ this.ssClockHighPeriod = 0x0028;
172
+ this.ssClockLowPeriod = 0x002f;
173
+ this.fsClockHighPeriod = 0x0006;
174
+ this.fsClockLowPeriod = 0x000d;
165
175
  this.targetAddress = 0x55;
166
176
  this.slaveAddress = 0x55;
167
177
  this.abortSource = 0;
@@ -320,6 +330,14 @@ export class RPI2C extends BasePeripheral {
320
330
  }
321
331
  this.clearInterrupts(R_RX_FULL);
322
332
  return this.rxFIFO.pull();
333
+ case IC_SS_SCL_HCNT:
334
+ return this.ssClockHighPeriod;
335
+ case IC_SS_SCL_LCNT:
336
+ return this.ssClockLowPeriod;
337
+ case IC_FS_SCL_HCNT:
338
+ return this.fsClockHighPeriod;
339
+ case IC_FS_SCL_LCNT:
340
+ return this.fsClockLowPeriod;
323
341
  case IC_INTR_STAT:
324
342
  return this.intStatus;
325
343
  case IC_INTR_MASK:
@@ -416,6 +434,18 @@ export class RPI2C extends BasePeripheral {
416
434
  this.nextCommand();
417
435
  }
418
436
  return;
437
+ case IC_SS_SCL_HCNT:
438
+ this.ssClockHighPeriod = value & 0xffff;
439
+ return;
440
+ case IC_SS_SCL_LCNT:
441
+ this.ssClockLowPeriod = value & 0xffff;
442
+ return;
443
+ case IC_FS_SCL_HCNT:
444
+ this.fsClockHighPeriod = value & 0xffff;
445
+ return;
446
+ case IC_FS_SCL_LCNT:
447
+ this.fsClockLowPeriod = value & 0xffff;
448
+ return;
419
449
  case IC_RX_TL:
420
450
  this.rxThreshold = value & 0xff;
421
451
  if (this.rxThreshold > this.rxFIFO.size) {
@@ -2,8 +2,6 @@ import { BasePeripheral, Peripheral } from './peripheral.js';
2
2
  export declare class RP2040RTC extends BasePeripheral implements Peripheral {
3
3
  setup0: number;
4
4
  setup1: number;
5
- rtc1: number;
6
- rtc0: number;
7
5
  ctrl: number;
8
6
  baseline: Date;
9
7
  baselineMicros: number;
@@ -41,8 +41,6 @@ export class RP2040RTC extends BasePeripheral {
41
41
  super(...arguments);
42
42
  this.setup0 = 0;
43
43
  this.setup1 = 0;
44
- this.rtc1 = 0;
45
- this.rtc0 = 0;
46
44
  this.ctrl = 0;
47
45
  this.baseline = new Date(2021, 0, 1);
48
46
  this.baselineMicros = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rp2040js",
3
- "version": "0.19.2",
3
+ "version": "0.19.3",
4
4
  "description": "Raspberry Pi Pico (RP2040) Emulator",
5
5
  "repository": "https://github.com/wokwi/rp2040js",
6
6
  "keywords": [