summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.html100
1 files changed, 3 insertions, 97 deletions
diff --git a/index.html b/index.html
index 41e9ffe..277098d 100644
--- a/index.html
+++ b/index.html
@@ -21,29 +21,12 @@
<button id="usb-close">Close</button>
<button id="usb-reset">Reset</button>
-<h1>CP201</h1>
-<button id="usb-conf">Config serial</button>
-<button id="usb-get-line">Get line request</button>
-<button id="vendor-write">Write</button>
- <input style="display:inline;" id="inw-idx" size=1 type="text" value="0">
- <input style="display:inline;" id="inw-val" size=2 type="text" value="0">
-
-<button id="vendor-read">Read</button>
- <input id="inr-idx" size=1 type="text" value="0">
- <input id="outr-val" size=2 type="text" value="0">
-
<h1>CH341</h1>
-<button id="ch341-configure">Configure</button>
-<button id="ch341-configure2">Cfg2</button>
-<button id="ch341-get-status2">Get status</button>
+<button id="ch341-configure2">Config</button>
<button id="ch341-set-baudrate">Set baudrate</button>
-<button id="ch341-ep0">EP0 In 32</button>
<button id="ch341-ep1">EP1 Out 32</button><input style="display:inline;" id="ch341-ep1-in" size=32 type="text" value="0">
-<button id="ch341-ep2">EP2 In 8</button>
<input style="display:inline;" id="ch341-ep2-out" size=32 type="text">
<button id="ch341-bulkout">BulkOut</button>
-<button id="ch341-break-ctl">Break Ctrl</button>
-<button id="ch341-set-handshake">Set handshake</button>
<script>
@@ -94,74 +77,17 @@ document.querySelector("#usb-claim").onclick = function(){
console.log("Claim Interface usb + "+ port.device.productName);
};
-document.querySelector("#vendor-write").onclick = function(){
- var i = document.getElementById("inw-idx").value;
- var v = document.getElementById("inw-val").value;
- port.vendorWrite(i,v);
- setStatus("Write data");
- console.log("Write idx "+i+" val "+v );
-};
-
-document.querySelector("#vendor-read").onclick = function(){
- port.vendorRead(0,0);
- setStatus("Read data");
- console.log("Close usb + "+ port.device.productName);
-};
-
document.querySelector("#usb-reset").onclick = function(){
port.reset();
setStatus("Reset port");
console.log("Reset port");
};
-document.querySelector("#usb-conf").onclick = function(){
- port.reset();
- setStatus("USB configure");
- console.log("USB configure");
-};
-
-document.querySelector("#usb-get-line").onclick = function(){
- port.getLineRequest();
- setStatus("Get line");
- console.log("Get line");
-};
-
-document.querySelector("#ch341-configure").onclick = function(){
- r = port.CH341configure();
- setStatus("Configure");
- console.log("Configure");
-};
-
document.querySelector("#ch341-configure2").onclick = function(){
r = port.CH341configure2();
setStatus("Configure2");
console.log("Configure2");
};
-/*
-document.querySelector("#ch341-get-status").onclick = function(){
- var r = port.CH341getStatus();
- console.log(r);
- setStatus("Get status");
- console.log("Get status");
-};*/
-
-document.querySelector("#ch341-get-status2").onclick = async() => {
- let r = await port.CH341getStatus2();
- console.log(r);
- var u8 = new Uint8Array(r.data.buffer)
- console.log(u8);
- setStatus("Get status2");
- console.log("Get status2");
-};
-
-document.querySelector("#ch341-ep0").onclick = async() =>{
- let r = port.CH341readEP0();
- //var u8 = new Uint8Array(r.data.buffer)
- //console.log(u8);
- console.log(r);
- setStatus("Endpoint 0");
- console.log("Endpoint 0");
-};
function str2ab(str) {
var buf = new ArrayBuffer(str.length); // 2 bytes for each char
@@ -180,19 +106,11 @@ document.querySelector("#ch341-ep1").onclick = async() =>{
console.log("Endpoint 1");
};
-document.querySelector("#ch341-ep2").onclick = async() =>{
- let r = await port.CH341readEP2();
- //var u8 = new Uint8Array(r.data.buffer)
- document.getElementById("ch341-ep2-out").value = document.getElementById("ch341-ep2-out").value + r;
- console.log(r);
- setStatus("Endpoint 2");
- console.log("Endpoint 2");
-};
-
document.querySelector("#ch341-bulkout").onclick = async() =>{
//let r = await port.bulkOut(2);
let r = await port.bulkIn(2,1);
- //var u8 = new Uint8Array(r.data.buffer)
+ var u8 = new Uint8Array(r.data.buffer)
+ document.getElementById("ch341-ep2-out").value = document.getElementById("ch341-ep2-out").value + String.fromCharCode(u8);
console.log(r);
setStatus("Bulkout");
console.log("Bulkout");
@@ -204,18 +122,6 @@ document.querySelector("#ch341-set-baudrate").onclick = async() => {
console.log("Set baudrate");
};
-document.querySelector("#ch341-break-ctl").onclick = async() => {
- port.CH341breakReg();
- setStatus("Set break reg");
- console.log("Set break reg");
-};
-
-document.querySelector("#ch341-set-handshake").onclick = async() => {
- port.CH341setHandshake();
- setStatus("Set handshake");
- console.log("Set handshake");
-};
-
</script>
</body>