Specifications
For example, invoking readAdc(0x08) would give a comparision between ADC 0 (code 0x0) and
GND (code 0x8). Invoking readAdc(0x80) would compare the same two voltages, but the sign of the
result would be negated, since the voltage comparison itself would be reversed in polarity.
To give another example, invoking readAdc(0x12) would return a reading of the differential voltage
between the ADC1 and ADC2 pins.
For a call to readAdc(0x23), the internal divide-by-4 “buffer” would not be switched inline. This
would increase the resolution, but the voltage being presented to the analog input might be out of
range.
When the input voltages are out of range, the ADC channel will return a full scale value (either
-4096 or +4095, depending on the actual voltage polarity).
A call to readAdc(0xCD) would be taking a differential reading between the same two pins, but with
the internal divide-by-4-buffer switched in. This would scale the value down by a factor of 4.
Since not all 256 possible combinations (16 possible upper nibbles x 16 possible lower nibbles) are
equally useful, a few special code combinations were re-assigned to make it possible to access some
hardware combinations referenced in the STM32W108 datasheets.
Special Value What it does…
0xAA Read VREF relative to VREF_DIV_2 but
with the “divide by 4” buffer switched in
0xBB Read VREG relative to VREF_DIV_2 but
with the “divide by 4” buffer switched in
0xCC Read VREF_DIV_2 relative to VREF_DIV_2 but
with the “divide by 4” buffer switched in
Refer to the manufacturer datasheets for more information on the ADC subsystem.
Built-in function setPinPullup():
The setPinPullup() function enables internal pullup resistors as expected. However, on this
hardware you actually have the hardware capability to have a pull up or
pull DOWN resistor. The “up
or down-ness” is controlled by the pin’s data output register.
This means for example that the following sequence will result in IO 0 being an input pin with an
internal pull-DOWN resistor enabled.
setPinDir(0, False) # NOT an output, so it becomes an input
setPinPullup(0, True) # We DO want it “pulled”, the default direction is pull-UP
writePin(0, False) # The pin is still an input, but now it is pulled DOWN instead of up
Built-in function setPinSlew():
There is no slew rate control capability in this hardware. Built-in setPinSlew() configures the pin
as an open drain output (rather than having it do nothing at all).
SNAP Reference Manual Document Number 600-0007K Page 195 of 202