Files
F411VE-ILI9341/Core/Src/Components/ILI9341.hpp
2024-02-11 23:10:02 -03:00

41 lines
1.1 KiB
C++

/*
* ILI9341.hpp
*
* Created on: Feb 11, 2024
* Author: Gabriel
*/
#ifndef SRC_COMPONENTS_ILI9341_HPP_
#define SRC_COMPONENTS_ILI9341_HPP_
#include <inttypes.h>
#include <FreeRTOS.h>
#include <task.h>
#include "SPI_Peripheral.hpp"
#include "GPIO_Pin.hpp"
#include "PWM_Pin.hpp"
class ILI9341 {
public:
ILI9341(SPI_Peripheral* hSpi, GPIO_Pin* nssPin, GPIO_Pin* hResetPin, GPIO_Pin* hDcrsPin, PWM_Pin* hLedPwm);
virtual ~ILI9341();
int32_t init();
int32_t setPosition(uint16_t xPosition, uint16_t yPosition, uint16_t xSize, uint16_t ySize);
int32_t write(uint8_t* buffer, uint32_t length);
int32_t setBacklight(float backlight);
private:
int32_t readReg8(uint8_t command, uint8_t* reg);
int32_t readReg24(uint8_t command, uint32_t* reg);
int32_t readReg32(uint8_t command, uint32_t* reg);
int32_t writeBuffer(uint8_t command, uint8_t* buffer, uint32_t length);
SPI_Peripheral* hSpi;
GPIO_Pin* hNssPin;
GPIO_Pin* hResetPin;
GPIO_Pin* hDcrsPin;
PWM_Pin* hLedPwm;
uint8_t txBuffer[16];
uint8_t rxBuffer[16];
};
#endif /* SRC_COMPONENTS_ILI9341_HPP_ */