H753_CPP_SPI_Resistive_Touch_Screen_Controller 1.0
STM32H753 SPI resistive touchscreen (Adafruit 333 overlay + 5767 TSC2046 controller) driver and tutorial
Loading...
Searching...
No Matches
STM32BusIORegister.hpp
1/*
2 * STM32BusIORegister.hpp
3 *
4 * A single addressable SPI "register" read, built on top of STM32SPIDevice.
5 *
6 * Adapted from Adafruit_BusIO's Adafruit_BusIO_Register
7 * (https://github.com/adafruit/Adafruit_BusIO, MIT License, Copyright (c)
8 * 2017 Adafruit Industries) as a design reference -- this is an independent
9 * STM32 HAL implementation, not a direct port. Only the SPI
10 * ADDRBIT8_HIGH_TOREAD addressing mode and the read path are ported: the
11 * I2C path, the other three SPI addressing modes
12 * (AD8_HIGH_TOREAD_AD7_HIGH_TOINC, ADDRBIT8_HIGH_TOWRITE,
13 * ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE), and the write path are all omitted --
14 * no driver on this site needs them yet; add them here if a future
15 * Adafruit-derived tutorial does. Byte order is always MSB-first: the
16 * reference library's LSBFIRST branch is not ported for the same reason.
17 *
18 * Created on: Sep 15, 2026
19 * Author: johng
20 */
21
22#ifndef STM32BUSIO_STM32BUSIOREGISTER_HPP_
23#define STM32BUSIO_STM32BUSIOREGISTER_HPP_
24
25#include "STM32SPIDevice.hpp"
26
48public:
62 STM32BusIORegister(STM32SPIDevice *spiDevice, uint32_t regAddr, size_t width = 1, size_t addressWidth = 1);
63
70 uint32_t read();
71
72private:
73 STM32SPIDevice *_spiDevice;
74 uint32_t _regAddr;
75 size_t _width;
76 size_t _addressWidth;
77};
78
79#endif /* STM32BUSIO_STM32BUSIOREGISTER_HPP_ */
Represents one addressable, read-only, MSB-first register accessed over an STM32SPIDevice,...
uint32_t read()
Sends the (address-bit-set) register address, then reads back width bytes MSB-first and returns them ...
STM32BusIORegister(STM32SPIDevice *spiDevice, uint32_t regAddr, size_t width=1, size_t addressWidth=1)
Constructs a view over one register.
Wraps one SPI peripheral + chip-select pin into read/write/transfer operations, mirroring the hardwar...