How do Signed 24 bit values work
Hi. I'm having trouble with integer interpretation for DFSDM. From the RM:
> The offset correction allows to calibrate the external sigma-delta modulator offset error. The user configures the offset register with a signed 24-bit correction, and this register is automatically added to the output result. The offset correction value is usually the result of a calibration routine embedded within the microcontroller software that performs the offset calibration calculation and stores the correction into the offset register. All operations in the DFSDM peripheral are in signed format (filtering, integration, offset correction, right bit shift).
This would be fine if it used 16 or 32 bit registers, but I'm not sure how to make my language (Rust) do signed 24 bit integers.
1: Does it expect bit 24 to be the sign bit, or bit 32?
2: How do you handle this properly?
If you ask Rust, and presumably C or C++ as well, to interpret the register as an i32, it will probably use the left most bit as a sign bit, when perhaps DFSDM expects it to use the 24th bit?
Observations: Bit 0 from the output is always 1. Bits 1 - 8 are always 0. The eight most bits on the left are always 0. The "right bit shift" field makes more of these 0.
My intuition here says to use unsigned u32, and do manual bit manipluation to convert to i32s, by explicitly looking for bit 24 for the sin? Also, not sure what to make of the left 8 bits being all 1s all the time. Using DMA.

