analogdevicesinc / no-OS

Software drivers in C for systems without an operating system
http://analogdevicesinc.github.io/no-OS/
Other
971 stars 1.67k forks source link

ad7606 adc data sign correction for bipolar input #2324

Closed mi-zeng closed 1 month ago

mi-zeng commented 1 month ago

Pull Request Description

this PR add sign correction feature for bipolar input, serial read based on previous program, read data is stored in uint32_t data type and

  1. for 26 bits version, bit31-bit26 is set to 0, bit25-bit8 is 18bits read data, and bit7-bit0 is status information, this pr sets seperated adc data and status info to 2 different array by input pointered, and set upper bits to 1 for negative bipolar input converted data

  2. for 18 bits version bit32-bit18 are 0, bit17-bit0 are data, upper bits are set to 1 for negative bipolar input converted data

so user can simply change array type to int32_t to get correctted adc data.

PR Type

PR Checklist