1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
19318: efm32/dac: Shift instead of masking r=chrysn a=chrysn

The documented behavior is:

> The value is always given as 16-bit value and is internally scaled to the actual resolution that the DAC unit provides (e.g. 12-bit). So to get the maximum output voltage, this function has to be called with value set to 65535 (UINT16_MAX).

The previous behavior was masking, now it's shifting.

### Testing procedure

* Run tests/periph_dac interactively and look at the voltage with an oscilloscope.

  Before, the period was 100ms/16, now it's 100ms as advertised.

*Note: I couldn't do that yet, the above is just what I expect.*

### Issues/PRs references

Closes: https://github.com/RIOT-OS/RIOT/issues/19317

Co-authored-by: chrysn <chrysn@fsfe.org>
This commit is contained in:
bors[bot] 2023-02-25 13:08:32 +00:00 committed by GitHub
commit ae32ce7fda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,7 @@ void dac_set(dac_t line, uint16_t value)
DAC_ChannelOutputSet(dac_config[dev].dev,
dac_channel_config[line].index,
value & 0xfff);
value >> 4);
}
void dac_poweron(dac_t line)