Linting & bringing the config closer to the ST7365

This commit is contained in:
Clément Grennerat
2025-08-18 23:08:08 +02:00
parent 6e6abff60c
commit 3bd65d37a5
11 changed files with 671 additions and 765 deletions
+66 -18
View File
@@ -31,7 +31,6 @@
#define LCD_SCREEN_HEIGHT 320
#define LCD_SCREEN_WIDTH 480
//CHIP SELECT PIN AND PORT, STANDARD GPIO
#define LCD_CS_PIN (1<<8)
#define LCD_DC_PIN (1<<11)
@@ -45,7 +44,6 @@
//#define LCD_RST_PORT GPIOC
//#define LCD_RST_PIN RST_Pin
#define BURST_MAX_SIZE 100 //buffer burst stocké sur pile. Par défaut stackSiZE=256 dans FreeRTOS.
#define BLACK 0x0000
@@ -94,17 +92,29 @@ void LCD_Fill_Screen(uint16_t Colour);
void LCD_Draw_Colour(uint16_t Colour);
// @param Colour : voir #define de quelques couleurs 16 bits standard ci-dessus
void LCD_Draw_Pixel(uint16_t X,uint16_t Y,uint16_t Colour);
void LCD_Draw_Pixel(uint16_t X, uint16_t Y, uint16_t Colour);
//@param X : coordonnee x
//@param Y : coordonnee y
//@param Colour : voir #define de quelques couleurs 16 bits standard ci-dessus
void LCD_Draw_Horizontal_Line(uint16_t X, uint16_t Y, uint16_t Width, uint16_t Colour);
void LCD_Draw_Vertical_Line(uint16_t X, uint16_t Y, uint16_t Height, uint16_t Colour);
void LCD_Draw_Rectangle(uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height, uint16_t Colour);
void LCD_Draw_Horizontal_Line(
uint16_t X,
uint16_t Y,
uint16_t Width,
uint16_t Colour);
void LCD_Draw_Vertical_Line(
uint16_t X,
uint16_t Y,
uint16_t Height,
uint16_t Colour);
void LCD_Draw_Rectangle(
uint16_t X,
uint16_t Y,
uint16_t Width,
uint16_t Height,
uint16_t Colour);
void LCD_Draw_Colour_Burst(uint16_t Colour, uint32_t Size);
#endif
/*******************PARTIE ISSUE DE LA LIB ILI9193_GFX.h***************************/
@@ -115,22 +125,60 @@ void LCD_Draw_Colour_Burst(uint16_t Colour, uint32_t Size);
#define HORIZONTAL_IMAGE 0
#define VERTICAL_IMAGE 1
void LCD_Draw_Hollow_Circle(uint16_t X, uint16_t Y, uint16_t Radius, uint16_t Colour);
void LCD_Draw_Filled_Circle(uint16_t X, uint16_t Y, uint16_t Radius, uint16_t Colour);
void LCD_Draw_Hollow_Rectangle_Coord(uint16_t X0, uint16_t Y0, uint16_t X1, uint16_t Y1, uint16_t Colour);
void LCD_Draw_Filled_Rectangle_Coord(uint16_t X0, uint16_t Y0, uint16_t X1, uint16_t Y1, uint16_t Colour);
void LCD_Draw_Char(char Character, uint16_t X, uint16_t Y, uint16_t Colour, uint16_t Size, uint16_t Background_Colour);
void LCD_Draw_Hollow_Circle(
uint16_t X,
uint16_t Y,
uint16_t Radius,
uint16_t Colour);
void LCD_Draw_Filled_Circle(
uint16_t X,
uint16_t Y,
uint16_t Radius,
uint16_t Colour);
void LCD_Draw_Hollow_Rectangle_Coord(
uint16_t X0,
uint16_t Y0,
uint16_t X1,
uint16_t Y1,
uint16_t Colour);
void LCD_Draw_Filled_Rectangle_Coord(
uint16_t X0,
uint16_t Y0,
uint16_t X1,
uint16_t Y1,
uint16_t Colour);
void LCD_Draw_Char(
char Character,
uint16_t X,
uint16_t Y,
uint16_t Colour,
uint16_t Size,
uint16_t Background_Colour);
void LCD_Draw_Text(const char* Text, uint16_t X, uint16_t Y, uint16_t Colour, uint16_t Size, uint16_t Background_Colour);
void LCD_Draw_Text(
const char *Text,
uint16_t X,
uint16_t Y,
uint16_t Colour,
uint16_t Size,
uint16_t Background_Colour);
/*Draws a character (fonts imported from fonts.h) at X,Y location with specified font colour, size and Background colour*/
void LCD_Draw_Filled_Rectangle_Size_Text(uint16_t X0, uint16_t Y0, uint16_t Size_X, uint16_t Size_Y, uint16_t Colour);
void LCD_Draw_Filled_Rectangle_Size_Text(
uint16_t X0,
uint16_t Y0,
uint16_t Size_X,
uint16_t Size_Y,
uint16_t Colour);
void LCD_Draw_Image_XY(const char* Image_Array, uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height);
void LCD_Draw_Image_XY(
const char *Image_Array,
uint16_t X,
uint16_t Y,
uint16_t Width,
uint16_t Height);
/*Dessine une image 65K couleurs (2Bytes / Pixel) dans une zone de l'ecran, aux coordonnées X et Y*/
//CONVERTISSEUR: http://www.digole.com/tools/PicturetoC_Hex_converter.php
void LCD_Draw_Image_Full(const char* Image_Array, uint8_t Orientation);
void LCD_Draw_Image_Full(const char *Image_Array, uint8_t Orientation);
#endif
+29 -22
View File
@@ -1,21 +1,22 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
//@formatter:off
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
@@ -31,29 +32,34 @@ extern "C" {
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
//@formatter:on
//@formatter:off
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
//@formatter:on
//@formatter:off
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
//@formatter:on
//@formatter:off
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
//@formatter:on
//@formatter:off
/* USER CODE END EM */
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
/* USER CODE BEGIN EFP */
//@formatter:on
//@formatter:off
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
@@ -105,7 +111,8 @@ void Error_Handler(void);
#define DB12_GPIO_Port GPIOB
/* USER CODE BEGIN Private defines */
//@formatter:on
//@formatter:off
/* USER CODE END Private defines */
#ifdef __cplusplus
+505 -511
View File
File diff suppressed because it is too large Load Diff
+71 -71
View File
@@ -1,21 +1,21 @@
/* USER CODE BEGIN Header */
/* USER CODE BEGIN */
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "LCD_driver.h"
@@ -23,47 +23,47 @@
#include "LogoIUT.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE BEGIN */
/* USER CODE END Includes */
/* USER CODE END */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE BEGIN */
/* USER CODE END PTD */
/* USER CODE END */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE BEGIN */
/* USER CODE END PD */
/* USER CODE END */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE BEGIN */
/* USER CODE END PM */
/* USER CODE END */
/* Private variables ---------------------------------------------------------*/
SPI_HandleTypeDef hspi1;
UART_HandleTypeDef huart1;
/* USER CODE BEGIN PV */
/* USER CODE BEGIN */
/* USER CODE END PV */
/* USER CODE END */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_SPI1_Init(void);
static void MX_USART1_UART_Init(void);
/* USER CODE BEGIN PFP */
/* USER CODE BEGIN */
/* USER CODE END PFP */
/* USER CODE END */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE BEGIN */
/* USER CODE END 0 */
/* USER CODE END */
/**
* @brief The application entry point.
@@ -72,47 +72,48 @@ static void MX_USART1_UART_Init(void);
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE BEGIN */
/* USER CODE END 1 */
/* USER CODE END */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE BEGIN */
/* USER CODE END Init */
/* USER CODE END */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* USER CODE BEGIN */
/* USER CODE END */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
/* USER CODE BEGIN */
/* USER CODE END 2 */
LCD_Init();
LCD_Fill_Screen(PURPLE);
/* USER CODE END */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
/* USER CODE BEGIN */
while (1)
{
while (1) {
/* USER CODE END WHILE */
/* USER CODE END */
/* USER CODE BEGIN 3 */
/* USER CODE BEGIN */
}
/* USER CODE END 3 */
/* USER CODE END */
}
/**
@@ -161,13 +162,13 @@ void SystemClock_Config(void)
static void MX_SPI1_Init(void)
{
/* USER CODE BEGIN SPI1_Init 0 */
/* USER CODE BEGIN */
/* USER CODE END SPI1_Init 0 */
/* USER CODE END */
/* USER CODE BEGIN SPI1_Init 1 */
/* USER CODE BEGIN */
/* USER CODE END SPI1_Init 1 */
/* USER CODE END */
/* SPI1 parameter configuration*/
hspi1.Instance = SPI1;
hspi1.Init.Mode = SPI_MODE_MASTER;
@@ -185,9 +186,9 @@ static void MX_SPI1_Init(void)
{
Error_Handler();
}
/* USER CODE BEGIN SPI1_Init 2 */
/* USER CODE BEGIN */
/* USER CODE END SPI1_Init 2 */
/* USER CODE END */
}
@@ -199,13 +200,13 @@ static void MX_SPI1_Init(void)
static void MX_USART1_UART_Init(void)
{
/* USER CODE BEGIN USART1_Init 0 */
/* USER CODE BEGIN */
/* USER CODE END USART1_Init 0 */
/* USER CODE END */
/* USER CODE BEGIN USART1_Init 1 */
/* USER CODE BEGIN */
/* USER CODE END USART1_Init 1 */
/* USER CODE END */
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
@@ -218,9 +219,9 @@ static void MX_USART1_UART_Init(void)
{
Error_Handler();
}
/* USER CODE BEGIN USART1_Init 2 */
/* USER CODE BEGIN */
/* USER CODE END USART1_Init 2 */
/* USER CODE END */
}
@@ -232,9 +233,9 @@ static void MX_USART1_UART_Init(void)
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* USER CODE BEGIN MX_GPIO_Init_1 */
/* USER CODE BEGIN */
/* USER CODE END MX_GPIO_Init_1 */
/* USER CODE END */
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
@@ -319,14 +320,14 @@ static void MX_GPIO_Init(void)
/*Configure peripheral I/O remapping */
__HAL_AFIO_REMAP_PD01_ENABLE();
/* USER CODE BEGIN MX_GPIO_Init_2 */
/* USER CODE BEGIN */
/* USER CODE END MX_GPIO_Init_2 */
/* USER CODE END */
}
/* USER CODE BEGIN 4 */
/* USER CODE BEGIN */
/* USER CODE END 4 */
/* USER CODE END */
/**
* @brief This function is executed in case of error occurrence.
@@ -334,13 +335,12 @@ static void MX_GPIO_Init(void)
*/
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* USER CODE BEGIN */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
while (1)
{
while (1) {
}
/* USER CODE END Error_Handler_Debug */
/* USER CODE END */
}
#ifdef USE_FULL_ASSERT
/**
@@ -350,11 +350,11 @@ void Error_Handler(void)
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
void assert_failed( uint8_t * file , uint32_t line)
{
/* USER CODE BEGIN 6 */
/* USER CODE BEGIN */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
/* USER CODE END */
}
#endif /* USE_FULL_ASSERT */