• Damien George's avatar
    stmhal: Allow to set bits resolution for DAC; 8 is default, can have 12. · b5c43be1
    Damien George authored
    This patch allows to configure the DAC resolution in the constructor and
    in the init function, eg:
    
    dac = DAC(1, bits=12).
    
    The default resolution is 8 bits for backwards compatibility.  The bits
    sets the maximum value accepted by write and write_timed methods, being
    2**bits - 1.
    
    When using write_timed with 12-bit resolution, the input buffer is
    treated as an unsigned half-word array, typecode 'H'.
    
    See PR #1130 for discussion.
    b5c43be1
dac.c 16.9 KB