rp2040js 0.19.0 → 0.19.1

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.
@@ -32,6 +32,7 @@ const RXE = 1 << 9;
32
32
  const TXE = 1 << 8;
33
33
  const UARTEN = 1 << 0;
34
34
  // Interrupt bits
35
+ const UARTTXINTR = 1 << 5;
35
36
  const UARTRXINTR = 1 << 4;
36
37
  class RPUART extends peripheral_js_1.BasePeripheral {
37
38
  constructor(rp2040, name, irq, dreq) {
@@ -83,6 +84,8 @@ class RPUART extends peripheral_js_1.BasePeripheral {
83
84
  return (this.rxFIFO.full ? RXFF : 0) | (this.rxFIFO.empty ? RXFE : 0) | TXFE;
84
85
  }
85
86
  checkInterrupts() {
87
+ // TODO We should actually implement a proper FIFO for TX
88
+ this.interruptStatus |= UARTTXINTR;
86
89
  this.rp2040.setInterrupt(this.irq, !!(this.interruptStatus & this.interruptMask));
87
90
  }
88
91
  feedByte(value) {
@@ -97,8 +100,11 @@ class RPUART extends peripheral_js_1.BasePeripheral {
97
100
  const value = this.rxFIFO.pull();
98
101
  if (!this.rxFIFO.empty) {
99
102
  this.interruptStatus |= UARTRXINTR;
100
- this.checkInterrupts();
101
103
  }
104
+ else {
105
+ this.interruptStatus &= ~UARTRXINTR;
106
+ }
107
+ this.checkInterrupts();
102
108
  return value;
103
109
  }
104
110
  case UARTFR:
@@ -29,6 +29,7 @@ const RXE = 1 << 9;
29
29
  const TXE = 1 << 8;
30
30
  const UARTEN = 1 << 0;
31
31
  // Interrupt bits
32
+ const UARTTXINTR = 1 << 5;
32
33
  const UARTRXINTR = 1 << 4;
33
34
  export class RPUART extends BasePeripheral {
34
35
  constructor(rp2040, name, irq, dreq) {
@@ -80,6 +81,8 @@ export class RPUART extends BasePeripheral {
80
81
  return (this.rxFIFO.full ? RXFF : 0) | (this.rxFIFO.empty ? RXFE : 0) | TXFE;
81
82
  }
82
83
  checkInterrupts() {
84
+ // TODO We should actually implement a proper FIFO for TX
85
+ this.interruptStatus |= UARTTXINTR;
83
86
  this.rp2040.setInterrupt(this.irq, !!(this.interruptStatus & this.interruptMask));
84
87
  }
85
88
  feedByte(value) {
@@ -94,8 +97,11 @@ export class RPUART extends BasePeripheral {
94
97
  const value = this.rxFIFO.pull();
95
98
  if (!this.rxFIFO.empty) {
96
99
  this.interruptStatus |= UARTRXINTR;
97
- this.checkInterrupts();
98
100
  }
101
+ else {
102
+ this.interruptStatus &= ~UARTRXINTR;
103
+ }
104
+ this.checkInterrupts();
99
105
  return value;
100
106
  }
101
107
  case UARTFR:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rp2040js",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "Raspberry Pi Pico (RP2040) Emulator",
5
5
  "repository": "https://github.com/wokwi/rp2040js",
6
6
  "keywords": [