PWM_Pin and PWM_Pin_STM32
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "ILI9341.hpp"
|
||||
|
||||
ILI9341::ILI9341(SPI_Peripheral* hSpi, GPIO_Pin* hNssPin) :
|
||||
hSpi(hSpi), hNssPin(hNssPin) {
|
||||
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) {
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,16 @@ 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);
|
||||
@@ -28,5 +37,15 @@ int32_t ILI9341::init() {
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user