add the missing docs

master
Ondřej Hruška 7 years ago
parent c4fc1a792a
commit b63ca927af
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 6
      README.md
  2. 27
      UNIT_NEOPIXEL.md
  3. 35
      UNIT_PWMDIM.md
  4. 71
      UNIT_TOUCH.md
  5. 36
      UNIT_USART.md

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

@ -3,10 +3,12 @@
Implements the NeoPixel protocol for driving addressable LED strips. Implements the NeoPixel protocol for driving addressable LED strips.
The strip length is configured in the unit settings. The strip length is configured in the unit settings.
Five color data encodings are available for user convenience.
## Commands ## Commands
### CLEAR (0x00) ### CLEAR (0x00)
Set all pixels to black. This is automatically executed on start-up to clear the strip. Set all pixels to black. This is also automatically executed on start-up to clear the strip.
### LOAD (0x01) ### LOAD (0x01)
Load packed RGB data to the strip. Load packed RGB data to the strip.
@ -15,22 +17,33 @@ Load packed RGB data to the strip.
- a byte array `(R,G,B)` x length - a byte array `(R,G,B)` x length
### LOAD_U32_LE (0x02) ### LOAD_U32_ZRGB (0x08)
Load 32-bit `0x00BBGGRR` words encoded in little-endian as `(R,G,B,0)`. Load 32-bit `0x00RRGGBB` words encoded in big-endian as `(0,R,G,B)`.
This is more convenient for the PC script, but wastes 1/4 of the payload by padding
null bytes.
*Payload:* *Payload:*
- a byte array `(R,G,B,0)` x length - a byte array `(0,R,G,B)` x length
### LOAD_U32_BE (0x03) ### LOAD_U32_ZBGR (0x09)
Load 32-bit `0x00BBGGRR` words encoded in big-endian as `(0,B,G,R)`. Load 32-bit `0x00BBGGRR` words encoded in big-endian as `(0,B,G,R)`.
*Payload:* *Payload:*
- a byte array `(0,B,G,R)` x length - a byte array `(0,B,G,R)` x length
### LOAD_U32_RGBZ (0x0A)
Load 32-bit `0x00BBGGRR` words encoded in little-endian as `(R,G,B,0)`.
*Payload:*
- a byte array `(R,G,B,0)` x length
### LOAD_U32_BGRZ (0x09)
Load 32-bit `0x00RRGGBB` words encoded in little-endian as `(B,G,R,0)`.
*Payload:*
- a byte array `(B,G,R,0)` x length
### GET_LEN (0x04) ### GET_LEN (0x04)
Read the neopixel strip length as configured in the settings. Read the neopixel strip length as configured in the settings.

@ -0,0 +1,35 @@
# PWMDIM
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
hardware timer.
## Commands
### SET_FREQUENCY (0x00)
Set the PWM frequency
*Request:*
- u32 - frequency in Hz
### SET_DUTY (0x01)
Set the duty cycle of one or more channels
*Request:*
- repeat 1-4 times:
- u8 - channel number 0-3
- u16 - duty cycle 0-1000
### STOP (0x02)
Stop the hardware timer. Outputs enter low level. Has no effect if stopped.
### START (0x03)
Start the timer. Has no effect if running.
## Events
*This unit generates no events.*

@ -0,0 +1,71 @@
# TOUCH
Access to the hardware touch sensing controller.
Can be used to create capacitive touch interfaces or for rough capacitance measurement (e.g. water level in a bottle, or proximity sensing).
Button mode is implemented for simple threshold checking with hystheresis.
## Commands
### READ (0x00)
Read the raw touch pad values (lower indicates higher capacitance).
Values are ordered by group and channel.
*Response:*
- u16[] - values
### SET_BIN_THR (0x01)
Set button mode thresholds. Value 0 = button mode disabled fro the pad.
*Request:*
- u16[] - thresholds
### DISABLE_ALL_REPORTS (0x02)
Set thresholds to 0, disabling the button mode for all pads.
### SET_DEBOUNCE_TIME (0x03)
Set debounce time for the button mode (replaces the value from unit settings)
*Request:*
- u16 - debounce time milliseconds
### SET_HYSTERESIS (0x04)
Set hysteresis (replaces the default value from settings)
Hysteresis is added to the threshold value for the switch-off level
(switch-off happens when the measured value is exceeded - capacitance of the pad
drops)
*Request:*
- u16 - hystheresis
### GET_CH_COUNT (0x0A)
Get the number of enabled channels
*Response:*
- u8 - channel count
## Events
### BUTTON_CHANGE (0x00)
The binary state of some of the capacitive pads
with button mode enabled changed.
*Payload:*
- u32 - binary state of all channels (packed)
- u32 - changed / trigger-generating channels (packed)

@ -0,0 +1,36 @@
# USART
This unit provides access to the hardware USART peripheral. It is capable of
driving RS485 transceivers.
The unit uses asynchronous reception and transmission using DMA to support
low baud rates without lagging the whole platform. Reception is double-buffered
and sent in buffer-sized chunks. The remainder is sent when a timeout from
the last received byte is reached.
## Commands
### WRITE (0x00)
Add data to the Tx buffer. Sending is asynchronous, but the command may wait
for free space in the DMA buffer.
*Request:*
- u8[] - bytes to write
### WRITE_SYNC (0x01)
Add data to the Tx buffer and wait for the transmission to complete.
*Request:*
- u8[] - bytes to write
## Events
### DATA_RECEIVED (0x00)
Data was received on the serial port.
*Payload:*
- u8[] - received bytes
Loading…
Cancel
Save