()
| 103 | _setArea = new Uint16Array(this._updateArea.buffer, 0, 5); |
| 104 | |
| 105 | constructor() { |
| 106 | const Digital = device.io.Digital; |
| 107 | const SPI = device.io.SPI; |
| 108 | |
| 109 | this.select = new Digital({ |
| 110 | pin: device.pin.epdSelect, |
| 111 | mode: Digital.Output, |
| 112 | initialValue: 1 |
| 113 | }); |
| 114 | |
| 115 | this.busy = new Digital({ |
| 116 | pin: device.pin.epdBusy, |
| 117 | mode: Digital.Input, |
| 118 | }); |
| 119 | |
| 120 | this.spi = new SPI({ |
| 121 | ...device.SPI.default, |
| 122 | hz: 10_000_000 |
| 123 | }); |
| 124 | this.spi.buffer16 = new Uint8Array(2); |
| 125 | this.spi.write16 = function(value) { |
| 126 | const buffer = this.buffer16; |
| 127 | buffer[0] = value >> 8; |
| 128 | buffer[1] = value; |
| 129 | this.write(buffer); |
| 130 | }; |
| 131 | this.spi.transfer16 = function(value) { |
| 132 | const buffer = this.buffer16; |
| 133 | buffer[0] = value >> 8; |
| 134 | buffer[1] = value; |
| 135 | this.transfer(buffer); |
| 136 | return (buffer[0] << 8) | buffer[1]; |
| 137 | }; |
| 138 | |
| 139 | this.getSysInfo(); |
| 140 | |
| 141 | this.writeCommand(IT8951_TCON_SYS_RUN); |
| 142 | this.writeRegister(IT8951_I80CPCR, 0x0001); // enable pack write |
| 143 | |
| 144 | //set vcom to -2.30v |
| 145 | this.writeCommand(IT8951_I80_CMD_VCOM); |
| 146 | this.writeWord(0x0001); |
| 147 | this.writeWord(2300); |
| 148 | |
| 149 | Timer.delay(1000); |
| 150 | } |
| 151 | close() { |
| 152 | this.spi?.close(); |
| 153 | this.select?.close(); |
nothing calls this directly
no test coverage detected