Walk through the process of writing a custom device driver for an SPI-based sensor from scratch.
Implement the core read path as a function that consumes recorded SPI transfers. Validate each four-byte frame, retry failed frames, decode the signed 16-bit sample, and apply scaling. Return None when a sample cannot be read within its retry limit.
transfers is a list of [status, high_byte, low_byte, crc] frames. Return one decoded value per requested sample.
def read_sensor_samples(transfers, sample_count, retries, scale_num, scale_den):