From 5f6ad65e8c8bd51a2c1be17fe68ee162ce4e8c88 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 19 Dec 2023 17:39:15 +0000 Subject: [PATCH] docs --- libs/joltjs/jswrap_jolt.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/libs/joltjs/jswrap_jolt.c b/libs/joltjs/jswrap_jolt.c index 229081a3c7..654346be36 100644 --- a/libs/joltjs/jswrap_jolt.c +++ b/libs/joltjs/jswrap_jolt.c @@ -15,10 +15,7 @@ FIXME: -Should Q1/2/3/4 provide: - * setPower() function - * i2c property for pre-initialised soft I2C? - +See https://docs.google.com/document/d/1Tw7fUkpj9dwBYASBCX9TjPcpgdqEw_7VL6MSRqVUUXY */ @@ -89,6 +86,8 @@ void setJoltProperty(const char *name, JsVar* prop) { } `Q1` and `Q2` Qwiic connectors can have their power controlled by a 500mA FET connected to GND. +The `sda` and `scl` pins on this port are also analog inputs - use `analogRead(Jolt.Q1.sda)`/etc + To turn this connector on run `Jolt.Q1.setPower(1)` */ JsVar *jswrap_jolt_q1() { @@ -111,6 +110,8 @@ JsVar *jswrap_jolt_q1() { } `Q1` and `Q2` Qwiic connectors can have their power controlled by a 500mA FET connected to GND. +The `sda` and `scl` pins on this port are also analog inputs - use `analogRead(Jolt.Q2.sda)`/etc + To turn this connector on run `Jolt.Q2.setPower(1)` */ JsVar *jswrap_jolt_q2() { @@ -188,8 +189,28 @@ can be controlled independently. Mode can be: * `undefined` / `false` / `"off"` - the motor driver is off, all motor driver pins are open circuit -* `true` / `"output"` - driver is set to "Independent bridge" mode. All 4 outputs are enabled and are either -* `"motor"` +* `true` / `"output"` - **[recommended]** driver is set to "Independent bridge" mode. All 4 outputs are enabled and are either +* `"motor"` - driver is set to "4 pin interface" mode where pins are paired up (V0+V1, V2+V3, etc). If both +in a pair are 0 the output is open circuit (motor coast), if both are 1 both otputs are 0 (motor brake), and +if both are different, those values are on the output: + +`output` mode: + +| V0 | V1 | Out 0 | Out 1 | +|----|----|-------|-------| +| 0 | 0 | Low | Low | +| 0 | 1 | Low | High | +| 1 | 0 | High | Low | +| 1 | 1 | High | High | + +`motor` mode + +| V0 | V1 | Out 0 | Out 1 | +|----|----|-------|-------| +| 0 | 0 | Open | Open | +| 0 | 1 | Low | High | +| 1 | 0 | High | Low | +| 1 | 1 | Low | Low | */