circuitpython/tests/pyb/dac.py
Damien George b30e0d2f26 stm32/dac: Add buffering argument to constructor and init() method.
This can be used to select the output buffer behaviour of the DAC.  The
default values are chosen to retain backwards compatibility with existing
behaviour.

Thanks to @peterhinch for the initial idea to add this feature.
2018-04-11 14:22:21 +10:00

19 lines
306 B
Python

import pyb
if not hasattr(pyb, 'DAC'):
print('SKIP')
raise SystemExit
dac = pyb.DAC(1)
print(dac)
dac.noise(100)
dac.triangle(100)
dac.write(0)
dac.write_timed(bytearray(10), 100, mode=pyb.DAC.NORMAL)
pyb.delay(20)
dac.write(0)
# test buffering arg
dac = pyb.DAC(1, buffering=True)
dac.write(0)