S0
api.S0readCounter(channel)
- Overview
- Arguments
- Return
- Example
Reports current value of S0 channel counter (specified in channel input argument).
By calling this function, an internal shadow variable for the channel counter is updated, so that the counter for onThreshold() event is reset.
- channel (integer) - Number of the S0 channel, 1 to 4.
- value (integer) - Value of the S0 counter
--Read the value of S0 channel 3 and stores to given variable (val)
val = api.S0readCounter(3)
api.S0initializeCounter(channel, value)
- Overview
- Arguments
- Example
Used to set the value of S0 counter in a non-volatile memory. Typicaly used on startup to restore current value.
- channel (integer) - Number of the S0 channel, 1 to 4.
- value (integer) - Value of the S0 counter
--Set counter value for channel 0 to the value of 100
api.S0initializeCounter(0, 100)
api.S0setThreshold(channel, value)
- Overview
- Arguments
- Example
Defines a threshold between current value of S0 channel counter and last reported value. When difference of these last two reaches the value, the onThreshold() event is called.
- channel (integer) - Number of the S0 channel, 1 to 4.
- value (integer) - Threshold value, 0 disables the threshold, 0x1-0xFFFFFFFF sets the threshold.
--Set threshold for channel 2 to the value of 10000
api.S0setThreshold(2, 10000)