parent
c4fc1a792a
commit
b63ca927af
@ -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…
Reference in new issue