electro-smith / libDaisy

Hardware Library for the Daisy Audio Platform
https://www.electro-smith.com/daisy
MIT License
312 stars 131 forks source link

MAX11300: replace GPI mode with ADC mode and compare in software #482

Open TheSlowGrowth opened 2 years ago

TheSlowGrowth commented 2 years ago

Problem: When configuring a MAX11300 PIXI pin as a digital input, and then sending negative voltages to that pin, all ADC readings turn into garbage.

Solution: Inside of the MAX11300, GPI pins are really just ADC inputs with an internal comparison to a threshold value. We could configure a GPI pin as an ADC pin and do that comparison in our driver.

Edit: Check if the same is true for DAC pins - it would streamline the driver and generate less interrupts, if we could skip the GPO update step and handle GPO and DAC in one single DMA transmission.