set_decoder

Configure decoder on the given channel

Parameters

integer required
Id of channel to configure decoder on
allowed values:1 to 2
string required
Type of protocol to configure
allowed values:UART, SPI, I2C
number required
Pin number to configure as a data pin
allowed values:1 to 16
boolean
Bit order for UART/SPI. When undefined, sets LSB for UART and MSB for SPI
default: undefined
number
Number of data bits. Cannot be more than 8 if parity bit is enabled
default: 8
allowed values:5 to 9
Number of stop bits.
default: 1
allowed values:1 to 2
string
Parity for UART.
default: None
allowed values:None, Even, Odd
UART baud rate.
default: 9600
allowed values:1 to 2e6
units: baud
number
Pin number to send clock signal. Only for SPI/I2C
default: undefined
allowed values:1 to 16
number
Chip select for SPI protocol
default: undefined
allowed values:1 to 16
number
Clock Polarity (1 for High and 0 for Low) for SPI protocol
default: 0
allowed values:0 to 1
number
Clock Phase (1 for trailing edge and 0 for leading edge) for SPI protocol
default: 0
allowed values:0 to 1
boolean
Disable all implicit conversions and coercions.
default: true

# Examples

# Sample response,

{
  "data_pin":"pin2",
  "data_width":8,
  "lsb_first":true,
  "protocol":"UART",
  "uart_baud_rate":9600,
  "uart_parity":"None",
  "uart_stop_width":1
}
1
2
3
4
5
6
7
8
9