50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
/*
|
|
* Start.cpp
|
|
*
|
|
* Created on: Feb 10, 2024
|
|
* Author: Gabriel
|
|
*/
|
|
|
|
#include "start.hpp"
|
|
#include "GPIO_Pin_STM32.hpp"
|
|
#include "SPI_Peripheral_STM32.hpp"
|
|
#include "PWM_Pin_STM32.hpp"
|
|
#include "BinLeds.hpp"
|
|
#include "ILI9341.hpp"
|
|
|
|
extern SPI_HandleTypeDef hspi5;
|
|
extern TIM_HandleTypeDef htim10;
|
|
|
|
GPIO_Pin_STM32 ledOrange(LD3_GPIO_Port, LD3_Pin);
|
|
GPIO_Pin_STM32 ledGreen(LD4_GPIO_Port, LD4_Pin);
|
|
GPIO_Pin_STM32 ledRed(LD5_GPIO_Port, LD5_Pin);
|
|
GPIO_Pin_STM32 ledBlue(LD6_GPIO_Port, LD6_Pin);
|
|
//GPIO_Pin_STM32* discoveryLedArray[4] = {&ledOrange, &ledGreen, &ledRed, &ledBlue};
|
|
BinLeds discoveryLeds((GPIO_Pin*[]){&ledOrange, &ledGreen, &ledRed, &ledBlue}, 4);
|
|
|
|
SPI_Peripheral_STM32 spi_a(&hspi5, 1000);
|
|
GPIO_Pin_STM32 displayNss(DISPLAY_NSS_GPIO_Port, DISPLAY_NSS_Pin);
|
|
GPIO_Pin_STM32 displayReset(DISPLAY_RESET_GPIO_Port, DISPLAY_RESET_Pin);
|
|
GPIO_Pin_STM32 displayDcrs(DISPLAY_DCRS_GPIO_Port, DISPLAY_DCRS_Pin);
|
|
PWM_Pin_STM32 displayLed(&htim10, TIM_CHANNEL_1);
|
|
ILI9341 display(&spi_a, &displayNss, &displayReset, &displayDcrs, &displayLed);
|
|
|
|
uint8_t buffer[19200];
|
|
|
|
void start(){
|
|
spi_a.init();
|
|
display.init();
|
|
display.setBacklight(1);
|
|
for(uint32_t i = 0; i<19200; i++){
|
|
buffer[i] = 32<<2;
|
|
}
|
|
display.setPosition(0, 0, 80, 80);
|
|
display.write(buffer, 19200);
|
|
display.setPosition(0, 80, 80, 80);
|
|
display.write(buffer, 19200);
|
|
for(uint32_t i=0; i<16; i++){
|
|
discoveryLeds.set(i);
|
|
vTaskDelay(1000);
|
|
}
|
|
}
|