52 lines
1017 B
C++
52 lines
1017 B
C++
/*
|
|
* ILI9341.cpp
|
|
*
|
|
* Created on: Feb 11, 2024
|
|
* Author: Gabriel
|
|
*/
|
|
|
|
#include "ILI9341.hpp"
|
|
|
|
ILI9341::ILI9341(SPI_Peripheral* hSpi, GPIO_Pin* hNssPin, GPIO_Pin* hResetPin, GPIO_Pin* hDcrsPin, PWM_Pin* hLedPwm) :
|
|
hSpi(hSpi), hNssPin(hNssPin), hResetPin(hResetPin), hDcrsPin(hDcrsPin), hLedPwm(hLedPwm) {
|
|
|
|
}
|
|
|
|
ILI9341::~ILI9341() {
|
|
|
|
}
|
|
|
|
int32_t ILI9341::init() {
|
|
// Init pins
|
|
hNssPin->init();
|
|
hResetPin->init();
|
|
hDcrsPin->init();
|
|
hLedPwm->init();
|
|
// Reset LCD
|
|
hResetPin->reset();
|
|
vTaskDelay(1);
|
|
hResetPin->set();
|
|
|
|
hSpi->take(100);
|
|
hNssPin->reset();
|
|
hSpi->transmit((uint8_t*)"Hello World", 11);
|
|
hNssPin->set();
|
|
hSpi->give();
|
|
hSpi->take(100);
|
|
hNssPin->reset();
|
|
hSpi->transmit((uint8_t*)"Hello World", 11);
|
|
hNssPin->set();
|
|
hSpi->give();
|
|
while(true){
|
|
hLedPwm->setDuty(0.5);
|
|
vTaskDelay(1000);
|
|
hLedPwm->setDuty(1);
|
|
vTaskDelay(1000);
|
|
hLedPwm->setDuty(0.5);
|
|
vTaskDelay(1000);
|
|
hLedPwm->setDuty(0);
|
|
vTaskDelay(1000);
|
|
}
|
|
return 0;
|
|
}
|