Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
**/.vscode/launch.json
**/.vscode/settings.json
!**/.vscode/extensions.json

*.Identifier
.stm32env
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
[submodule "Lib/PCA9555"]
path = Lib/PCA9555
url = https://github.com/squadracorsepolito/PCA9555.git
Comment on lines 5 to 7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this lines

[submodule "Lib/LVGL/lvgl"]
path = Lib/LVGL/lvgl
url = https://github.com/lvgl/lvgl.git
[submodule "Drivers/ILI9488"]
path = Drivers/ILI9488
url = https://github.com/squadracorsepolito/ILI9488.git
20 changes: 20 additions & 0 deletions Core/Inc/bsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,24 @@ void MCB_send_msg(uint32_t id);

/* ---------- Private Macros -------------------------------------------------*/

/* LCD TFT SCREEN ILI9488 ####################################################*/
/* ---------- Includes -------------------------------------------------------*/
#include "spi.h"
#include "usart.h"
/* ---------- Exported types -------------------------------------------------*/

/* ---------- Exported constants ---------------------------------------------*/
#define LCD_TFT_SPI_Handle hspi3
#define LCD_TFT_USART_Handle huart1
/* ---------- Exported variables ---------------------------------------------*/

/* ---------- Exported macros ------------------------------------------------*/

/* ---------- Exported functions ---------------------------------------------*/

/* ---------- Private types --------------------------------------------------*/

/* ---------- Private variables ----------------------------------------------*/

/* ---------- Private constants ----------------------------------------------*/
#endif
19 changes: 11 additions & 8 deletions Core/Inc/dashboard.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
/*INCLUDES*/

#include "bsp.h"
#include "ili9488.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In future improvements of the code you should end up in a state where the file that contains the control code doesn't depend on level drivers, i.e. you will lose the #include "ili9488.h dependency in dashboard.c because all the code you will need is in either LVGL stuff or bsp.h.

You can close this comment, just keep in mind it.

#include "lvgl_callbacks.h"
#include "lvgl.h"
#include "main.h"
#include "screens.h"

#include <math.h>
#include <stdbool.h>
#include <string.h>
#include "bsp.h"

/*CUSTOM DEFINE*/

#define ON 1
#define ON 1
#define OFF 0
Comment on lines +16 to 17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do you use this defines?


typedef enum
{
ERROR_NONE = 0,
ERROR_CAN_WDG,
ERROR_INIT_BTN
} error_t;
// Commenta se non si sta usando lo schermo LCD ILI9488
#define USE_ILI9488

typedef enum { ERROR_NONE = 0, ERROR_CAN_WDG, ERROR_INIT_BTN } error_t;

/*CUSTOM FUNCTIONS PROTOTYPES*/

Expand Down
52 changes: 0 additions & 52 deletions Core/Inc/iwdg.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable the watchdog, otherwise you will forget it!

This file was deleted.

6 changes: 6 additions & 0 deletions Core/Inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/
#define BUZZER_CMD_GPIO_OUT_Pin GPIO_PIN_13
#define BUZZER_CMD_GPIO_OUT_GPIO_Port GPIOC
#define LCD_TFT_RST_GPIO_OUT_Pin GPIO_PIN_0
#define LCD_TFT_RST_GPIO_OUT_GPIO_Port GPIOC
#define M95256_D_SPI_MOSI_Pin GPIO_PIN_1
#define M95256_D_SPI_MOSI_GPIO_Port GPIOC
#define TS_OFF_LED_CMD_GPIO_OUT_Pin GPIO_PIN_2
Expand Down Expand Up @@ -87,6 +89,8 @@ void Error_Handler(void);
#define nPUSH_BTN4_IN_GPIO_IN_GPIO_Port GPIOB
#define nRTD_BTN_IN_GPIO_IN_Pin GPIO_PIN_2
#define nRTD_BTN_IN_GPIO_IN_GPIO_Port GPIOB
#define LCD_TFT_DC_GPIO_OUT_Pin GPIO_PIN_10
#define LCD_TFT_DC_GPIO_OUT_GPIO_Port GPIOB
#define SN65HVD23x_R_CAN2_RX_Pin GPIO_PIN_12
#define SN65HVD23x_R_CAN2_RX_GPIO_Port GPIOB
#define SN65HVD23x_D_CAN2_TX_Pin GPIO_PIN_13
Expand Down Expand Up @@ -121,6 +125,8 @@ void Error_Handler(void);
#define SDC_RLY_CMD_GPIO_OUT_GPIO_Port GPIOC
#define NHD_C0220BIZx_nRST_GPIO_OUT_Pin GPIO_PIN_2
#define NHD_C0220BIZx_nRST_GPIO_OUT_GPIO_Port GPIOD
#define LCD_TFT_CS_GPIO_OUT_Pin GPIO_PIN_4
#define LCD_TFT_CS_GPIO_OUT_GPIO_Port GPIOB
#define PCA9555_nINT_GPIO_IN_Pin GPIO_PIN_5
#define PCA9555_nINT_GPIO_IN_GPIO_Port GPIOB
#define I2C_SCL_Pin GPIO_PIN_6
Expand Down
2 changes: 1 addition & 1 deletion Core/Inc/stm32f4xx_hal_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/* #define HAL_HASH_MODULE_ENABLED */
#define HAL_I2C_MODULE_ENABLED
/* #define HAL_I2S_MODULE_ENABLED */
#define HAL_IWDG_MODULE_ENABLED
/* #define HAL_IWDG_MODULE_ENABLED */
/* #define HAL_LTDC_MODULE_ENABLED */
/* #define HAL_RNG_MODULE_ENABLED */
/* #define HAL_RTC_MODULE_ENABLED */
Expand Down
2 changes: 2 additions & 0 deletions Core/Inc/stm32f4xx_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void DMA1_Stream5_IRQHandler(void);
void ADC_IRQHandler(void);
void CAN1_TX_IRQHandler(void);
void CAN1_RX0_IRQHandler(void);
void CAN1_RX1_IRQHandler(void);
void CAN1_SCE_IRQHandler(void);
void TIM2_IRQHandler(void);
void USART1_IRQHandler(void);
void SPI3_IRQHandler(void);
void TIM6_DAC_IRQHandler(void);
void TIM7_IRQHandler(void);
void DMA2_Stream0_IRQHandler(void);
Expand Down
22 changes: 22 additions & 0 deletions Core/Src/bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,3 +477,25 @@ void MCB_send_msg(uint32_t id) {
}

/*---------- Private Functions -----------------------------------------------*/

/* LCD TFT SCREEN ILI9488 ####################################################*/

/*---------- Private define -----------------.--------------------------------*/

/*---------- Private macro ------------------.--------------------------------*/

/*---------- Private variables --------------.--------------------------------*/
enum LCD_TFT_Device{CS, RST, DC, LCD_TFT_Device_NUM};
static const struct GPIO_Tuple LCD_TFT_Device_to_GPIO_Tuple_map[LCD_TFT_Device_NUM] = {
[CS] = {.GPIO_Port = LCD_TFT_CS_GPIO_OUT_GPIO_Port, .GPIO_Pin = LCD_TFT_CS_GPIO_OUT_Pin},
[DC] = {.GPIO_Port = LCD_TFT_DC_GPIO_OUT_GPIO_Port, .GPIO_Pin = LCD_TFT_DC_GPIO_OUT_Pin},
[RST] = {.GPIO_Port = LCD_TFT_RST_GPIO_OUT_GPIO_Port, .GPIO_Pin = LCD_TFT_RST_GPIO_OUT_Pin},
};
Comment on lines +488 to +493
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This construct here is used improperly: the array-map construct is used to make dictionaries/maps of similar things (for example LED_MONO). These GPIOs are related to one another because they are necessary to drive the LCD_TFT display but they have different functions hence they are not a LCD_TFT device. In this case I suggest you to use a struct (a handle) to group everything since it betters conveys the fact that you are making a sort of "class" for the LCD_TFT. If you will end up using the code I pushed on ili9488 this is already available with the struct ILI9488_Handle.


/*---------- Private function prototypes ----.--------------------------------*/

/*---------- Exported Variables -------------.--------------------------------*/

/*---------- Exported Functions ----------------------------------------------*/

/*---------- Private Functions -----------------------------------------------*/
Loading