Browse Source

add the missing docs

Ondřej Hruška 1 year ago
parent
commit
b63ca927af
Signed by: Ondřej Hruška <ondra@ondrovo.com> GPG key ID: 2C5FD5035250423D
5 changed files with 165 additions and 10 deletions
  1. 3 3
      README.md
  2. 20 7
      UNIT_NEOPIXEL.md
  3. 35 0
      UNIT_PWMDIM.md
  4. 71 0
      UNIT_TOUCH.md
  5. 36 0
      UNIT_USART.md

+ 3 - 3
README.md View File

@@ -20,6 +20,6 @@ This repository specifies the control protocol implemented by [gex-core](https:/
20 20
 - [UNIT_1WIRE.md](UNIT_1WIRE.md) - 1-Wire master (thermometers, iButton...)
21 21
 - [UNIT_ADC.md](UNIT_ADC.md) - ADC with raw access, triggering, periodic capture
22 22
 - [UNIT_DAC.md](UNIT_DAC.md) - DAC with DDS
23
-- UNIT_PWMDIM.md - Simple PWM output
24
-- UNIT_TOUCH.md - Touch sense
25
-- UNIT_USART.md - UART/USART/RS485
23
+- [UNIT_PWMDIM.md](UNIT_PWMDIM.md) - Simple PWM output
24
+- [UNIT_TOUCH.md](UNIT_TOUCH.md) - Touch sense
25
+- [UNIT_USART.md](UNIT_USART.md) - UART/USART/RS485

+ 20 - 7
UNIT_NEOPIXEL.md View File

@@ -3,10 +3,12 @@
3 3
 Implements the NeoPixel protocol for driving addressable LED strips.
4 4
 The strip length is configured in the unit settings.
5 5
 
6
+Five color data encodings are available for user convenience.
7
+
6 8
 ## Commands
7 9
 
8 10
 ### CLEAR (0x00)
9
-Set all pixels to black. This is automatically executed on start-up to clear the strip.
11
+Set all pixels to black. This is also automatically executed on start-up to clear the strip.
10 12
 
11 13
 ### LOAD (0x01)
12 14
 Load packed RGB data to the strip.
@@ -15,22 +17,33 @@ Load packed RGB data to the strip.
15 17
 
16 18
 - a byte array `(R,G,B)` x length
17 19
 
18
-### LOAD_U32_LE (0x02)
19
-Load 32-bit `0x00BBGGRR` words encoded in little-endian as `(R,G,B,0)`.
20
-This is more convenient for the PC script, but wastes 1/4 of the payload by padding
21
-null bytes.
20
+### LOAD_U32_ZRGB (0x08)
21
+Load 32-bit `0x00RRGGBB` words encoded in big-endian as `(0,R,G,B)`.
22 22
 
23 23
 *Payload:*
24 24
 
25
-- a byte array `(R,G,B,0)` x length
25
+- a byte array `(0,R,G,B)` x length
26 26
 
27
-### LOAD_U32_BE (0x03)
27
+### LOAD_U32_ZBGR (0x09)
28 28
 Load 32-bit `0x00BBGGRR` words encoded in big-endian as `(0,B,G,R)`.
29 29
 
30 30
 *Payload:*
31 31
 
32 32
 - a byte array `(0,B,G,R)` x length
33 33
 
34
+### LOAD_U32_RGBZ (0x0A)
35
+Load 32-bit `0x00BBGGRR` words encoded in little-endian as `(R,G,B,0)`.
36
+
37
+*Payload:*
38
+
39
+- a byte array `(R,G,B,0)` x length
40
+
41
+### LOAD_U32_BGRZ (0x09)
42
+Load 32-bit `0x00RRGGBB` words encoded in little-endian as `(B,G,R,0)`.
43
+
44
+*Payload:*
45
+
46
+- a byte array `(B,G,R,0)` x length
34 47
 
35 48
 ### GET_LEN (0x04)
36 49
 Read the neopixel strip length as configured in the settings.

+ 35 - 0
UNIT_PWMDIM.md View File

@@ -0,0 +1,35 @@
1
+# PWMDIM
2
+
3
+This unit provides an up to 4-channel PWM output with shared frequency and independent duty cycles. Only one instance can be created due to using a 
4
+hardware timer.
5
+
6
+
7
+## Commands
8
+
9
+### SET_FREQUENCY (0x00)
10
+
11
+Set the PWM frequency
12
+
13
+*Request:*
14
+- u32 - frequency in Hz
15
+
16
+### SET_DUTY (0x01)
17
+
18
+Set the duty cycle of one or more channels
19
+
20
+*Request:*
21
+- repeat 1-4 times:
22
+  - u8 - channel number 0-3
23
+  - u16 - duty cycle 0-1000
24
+
25
+### STOP (0x02)
26
+
27
+Stop the hardware timer. Outputs enter low level. Has no effect if stopped.
28
+
29
+### START (0x03)
30
+
31
+Start the timer. Has no effect if running.
32
+
33
+## Events
34
+
35
+*This unit generates no events.*

+ 71 - 0
UNIT_TOUCH.md View File

@@ -0,0 +1,71 @@
1
+# TOUCH
2
+
3
+Access to the hardware touch sensing controller. 
4
+Can be used to create capacitive touch interfaces or for rough capacitance measurement (e.g. water level in a bottle, or proximity sensing).
5
+
6
+Button mode is implemented for simple threshold checking with hystheresis.
7
+
8
+
9
+## Commands
10
+
11
+### READ (0x00)
12
+
13
+Read the raw touch pad values (lower indicates higher capacitance).
14
+Values are ordered by group and channel.
15
+
16
+*Response:*
17
+- u16[] - values
18
+
19
+### SET_BIN_THR (0x01)
20
+
21
+Set button mode thresholds. Value 0 = button mode disabled fro the pad.
22
+
23
+*Request:*
24
+- u16[] - thresholds
25
+
26
+### DISABLE_ALL_REPORTS (0x02)
27
+
28
+Set thresholds to 0, disabling the button mode for all pads.
29
+
30
+
31
+### SET_DEBOUNCE_TIME (0x03)
32
+
33
+Set debounce time for the button mode (replaces the value from unit settings)
34
+
35
+*Request:*
36
+- u16 - debounce time milliseconds
37
+
38
+
39
+### SET_HYSTERESIS (0x04)
40
+
41
+Set hysteresis (replaces the default value from settings)
42
+
43
+Hysteresis is added to the threshold value for the switch-off level
44
+(switch-off happens when the measured value is exceeded - capacitance of the pad
45
+drops)
46
+
47
+*Request:*
48
+- u16 - hystheresis
49
+
50
+
51
+### GET_CH_COUNT (0x0A)
52
+
53
+Get the number of enabled channels
54
+
55
+*Response:*
56
+- u8 - channel count
57
+
58
+
59
+
60
+## Events
61
+
62
+### BUTTON_CHANGE (0x00)
63
+
64
+The binary state of some of the capacitive pads
65
+with button mode enabled changed.
66
+
67
+*Payload:*
68
+- u32 - binary state of all channels (packed)
69
+- u32 - changed / trigger-generating channels (packed)
70
+
71
+

+ 36 - 0
UNIT_USART.md View File

@@ -0,0 +1,36 @@
1
+# USART
2
+
3
+This unit provides access to the hardware USART peripheral. It is capable of
4
+driving RS485 transceivers.
5
+
6
+The unit uses asynchronous reception and transmission using DMA to support 
7
+low baud rates without lagging the whole platform. Reception is double-buffered 
8
+and sent in buffer-sized chunks. The remainder is sent when a timeout from 
9
+the last received byte is reached.
10
+
11
+
12
+## Commands
13
+
14
+### WRITE (0x00)
15
+
16
+Add data to the Tx buffer. Sending is asynchronous, but the command may wait
17
+for free space in the DMA buffer.
18
+
19
+*Request:*
20
+- u8[] - bytes to write
21
+
22
+### WRITE_SYNC (0x01)
23
+
24
+Add data to the Tx buffer and wait for the transmission to complete.
25
+
26
+*Request:*
27
+- u8[] - bytes to write
28
+
29
+## Events
30
+
31
+### DATA_RECEIVED (0x00)
32
+
33
+Data was received on the serial port.
34
+
35
+*Payload:*
36
+- u8[] - received bytes