Hello,
I am very lucky to meet your code. I am also using this chip in my little project now. It is coming soon. Your code is absolutely good. However I still need some new features. So I modified your code. I think these features are important so I'd like to share with you.
I added these things:
Add REF mode configuration to support internal reference. It's internal reference is really good and will make project cost less.
Add AIN-BUFFER mode configuration. I find you didn't enable the internal input buffer. I add this feature though it will make the input range smaller(AVDD1-1.1V to AVSS).
Add set REF source. If use internal reference, we need to set the setup register to use internal REF. This is not default.
A new example running on STM. It is useful when we need to read multiple channels(up to 16 Single-ended inputs).
I also find a problem:
This read data function doesn't support to read STATE register. I just add a bool input to select reading data for three times or four times.
I have no experience on pulling request. Hope this will not disturb you. Thank you very much.