Postcard
A register-based SPI sensor is connected to SPI1. Your job: bring up the SPI peripheral, write a configuration value to one register, then read back data from another register.
The sensor uses standard SPI register conventions:
- To write register 0xRR with value 0xVV: send two bytes [0xRR, 0xVV] (bit 7 clear = write).
- To read register 0xRR: send [0xRR | 0x80, 0x00] and capture the second byte returned.
The sensor's chip-select (CS) is wired to PA4 (active-low). Each transaction (write or read) must be framed by asserting and deasserting CS.
Your task: write 0x42 to register 0x20, then read register 0x28. Print the value read as a hex byte via UART in the form "READ:0x<value>" (the value is whatever the sensor returns). End the line with a newline character (\n); output is matched exactly.
The starter code provides register definitions and a UART helper. You need to enable clocks, configure SPI1 and PA4, and implement the write and read transactions.