|
H753_CPP_SPI_Resistive_Touch_Screen_Controller 1.0
STM32H753 SPI resistive touchscreen (Adafruit 333 overlay + 5767 TSC2046 controller) driver and tutorial
|
Represents one addressable, read-only, MSB-first register accessed over an STM32SPIDevice, using the "set the top address bit to read" convention (Adafruit_BusIO's ADDRBIT8_HIGH_TOREAD) – e.g. the TSC2046's control byte, whose own START bit already occupies that same top bit, so the OR this class performs is a documented no-op for that specific chip, but is kept for fidelity with the reference API and in case a future chip using this same addressing convention needs the OR to actually do something. More...
#include <STM32BusIORegister.hpp>
Public Member Functions | |
| STM32BusIORegister (STM32SPIDevice *spiDevice, uint32_t regAddr, size_t width=1, size_t addressWidth=1) | |
| Constructs a view over one register. | |
| uint32_t | read () |
| Sends the (address-bit-set) register address, then reads back width bytes MSB-first and returns them as a single value. | |
Represents one addressable, read-only, MSB-first register accessed over an STM32SPIDevice, using the "set the top address bit to read" convention (Adafruit_BusIO's ADDRBIT8_HIGH_TOREAD) – e.g. the TSC2046's control byte, whose own START bit already occupies that same top bit, so the OR this class performs is a documented no-op for that specific chip, but is kept for fidelity with the reference API and in case a future chip using this same addressing convention needs the OR to actually do something.
A new instance is meant to be constructed on the stack for each register access (matching the reference library's own usage pattern) – it is a thin, stateless-between-calls view over an existing STM32SPIDevice, not a long-lived owned resource.
Definition at line 47 of file STM32BusIORegister.hpp.
| STM32BusIORegister::STM32BusIORegister | ( | STM32SPIDevice * | spiDevice, |
| uint32_t | regAddr, | ||
| size_t | width = 1, | ||
| size_t | addressWidth = 1 ) |
Constructs a view over one register.
| spiDevice | The bus to read this register over. Must outlive this object. |
| regAddr | The register address/command byte. Only the low addressWidth bytes are used. |
| width | Number of data bytes to read back, MSB-first. Currently only width == 2 is exercised (by TSC2046), but any width up to 4 is supported since read() accumulates into a uint32_t exactly like the reference library. |
| addressWidth | Number of address bytes to send. TSC2046 (and every other user of this addressing mode so far) uses 1. |
Definition at line 14 of file STM32BusIORegister.cpp.
| uint32_t STM32BusIORegister::read | ( | ) |
Sends the (address-bit-set) register address, then reads back width bytes MSB-first and returns them as a single value.
| The | register value, or 0xFFFFFFFF if the underlying SPI transaction failed. |
Definition at line 18 of file STM32BusIORegister.cpp.
References STM32SPIDevice::writeThenRead().