Skip to content

Commit

Permalink
cleanup on .c dependencies. used direct dependencies in .c files inst…
Browse files Browse the repository at this point in the history
…ead of indirect dependencies in .h
  • Loading branch information
digant73 committed Jul 29, 2021
1 parent b5fe44f commit 6e7fd9e
Show file tree
Hide file tree
Showing 65 changed files with 137 additions and 129 deletions.
2 changes: 1 addition & 1 deletion TFT/src/User/API/LCD_Dimming.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "LCD_Dimming.h"
#include "GPIO_Init.h"
#include "includes.h"
#include "GPIO_Init.h"

#ifdef LCD_LED_PWM_CHANNEL

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/UI/CharIcon.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "CharIcon.h"
#include <stdint.h>
#include "LCD_Colors.h"
#include <stdint.h>

const uint16_t charIconColor[CHARICON_NUM] =
{
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/UI/GUI.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "GUI.h"
#include "includes.h"
#include "math.h"
#include <math.h>

uint16_t foreGroundColor = WHITE;
uint16_t backGroundColor = BLACK;
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/UI/Numpad.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Numpad.h"
#include "CharIcon.h"
#include "includes.h"
#include "CharIcon.h"

#define SKEYHEIGHT (LCD_HEIGHT - ICON_START_Y) / 4
#define SKEYWIDTH LCD_WIDTH / 4
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/UI/TouchProcess.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "TouchProcess.h"
#include "GPIO_Init.h"
#include "includes.h"
#include "GPIO_Init.h"

#define XL1 LCD_X[0]
#define XL2 LCD_X[1]
Expand Down
4 changes: 2 additions & 2 deletions TFT/src/User/API/UI/ui_draw.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <malloc.h>

#include "ui_draw.h"
#include "includes.h"
#include <stdio.h>
#include <malloc.h>

#if (THUMBNAIL_PARSER == PARSER_BASE64PNG)
#include "pngle.h"
Expand Down
5 changes: 2 additions & 3 deletions TFT/src/User/API/printf/printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@
//
///////////////////////////////////////////////////////////////////////////////

#include <stdbool.h>
#include <stdint.h>

#include "printf.h"
#include "includes.h"
#include <stdbool.h>
#include <stdint.h>

// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the
// printf_config.h header file
Expand Down
6 changes: 3 additions & 3 deletions TFT/src/User/Fatfs/diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
/* storage control modules to the FatFs module with a defined API. */
/*-----------------------------------------------------------------------*/

#include "ff.h" // Obtains integer types
#include "diskio.h" // Declarations of disk functions
#include "ff.h" // Obtains integer types
#include "variants.h" // for SD_SPI_SUPPORT etc...
#include "diskio.h" // Declarations of disk functions
#include "usb_conf.h"
#include "usbh_msc_core.h"
#include "usbh_usr.h"
#include "variants.h"

#ifdef SD_SPI_SUPPORT
#include "sd.h"
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Fatfs/ffsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


#include "ff.h"
#include "stdlib.h"
#include <stdlib.h>


#if FF_USE_LFN == 3 /* Dynamic memory allocation */
Expand Down
1 change: 0 additions & 1 deletion TFT/src/User/Fatfs/ffunicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
/ by use of this software.
*/


#include "ff.h"

#if FF_USE_LFN /* This module will be blanked if non-LFN configuration */
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Fatfs/myfatfs.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "myfatfs.h"
#include "includes.h" // for infoSettings etc...
#include "diskio.h"
#include "includes.h"

FATFS fatfs[FF_VOLUMES]; // FATFS work area

Expand Down
5 changes: 2 additions & 3 deletions TFT/src/User/Hal/HD44780.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "HD44780.h"
#include "variants.h" // for LCD2004_EMULATOR etc...
#include "GPIO_Init.h"
#include "stdlib.h"
#include "variants.h"
#include "Settings.h"
#include <stdlib.h>

#ifdef LCD2004_EMULATOR

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Hal/Knob_LED.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Knob_LED.h"
#include "includes.h" // for mcuClocks, LED_COLOR_PIN etc...
#include "GPIO_Init.h"
#include "includes.h"

#ifdef LED_COLOR_PIN

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Hal/LCD_Init.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "LCD_Init.h"
#include "includes.h" // for RM68042..., lcd.h, lcd_dma.h, timer_pwm.h etc...
#include "GPIO_Init.h"
#include "includes.h"

// LCD driver sequential
#if LCD_DRIVER_HAS(RM68042)
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Hal/LCD_Init.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern "C" {
#endif

#include "variants.h" // for LCD_DATA_16BIT, LCD_LED_PWM_CHANNEL
#include "variants.h" // for LCD_DATA_16BIT, LCD_LED_PWM_CHANNEL etc...

#if LCD_DATA_16BIT == 1
#define LCD_WR_16BITS_DATA(c) do{ LCD_WR_DATA(c); }while(0)
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Hal/buzzer.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "buzzer.h"
#include "includes.h" // for mcuClocks, infoSettings etc...
#include "GPIO_Init.h"
#include "includes.h"

#ifdef BUZZER_PIN

Expand Down
1 change: 1 addition & 0 deletions TFT/src/User/Hal/buzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern "C" {
#include <stdint.h>

#define BUZZER_CACHE_SIZE 5

typedef struct
{
uint32_t frequency[BUZZER_CACHE_SIZE];
Expand Down
3 changes: 2 additions & 1 deletion TFT/src/User/Hal/sd.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "variants.h"
#include "variants.h" // for SD_SPI_SUPPORT etc...

#ifdef SD_SPI_SUPPORT
#include "sd.h"
#include "GPIO_Init.h"
#include "spi.h"

u8 SD_Type = 0; //SDCard type

Expand Down
18 changes: 9 additions & 9 deletions TFT/src/User/Hal/sd.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern "C" {
#endif

#include "spi.h"
#include "variants.h" // for u8 etc...

// SDCard type definition
#define SD_TYPE_ERR 0X00
Expand Down Expand Up @@ -50,16 +50,16 @@ extern "C" {
#define SD_RESPONSE_FAILURE 0xFF

u8 SD_CD_Inserted(void);
u8 SD_Init(void); //initialization
u8 SD_Init(void); //initialization
void SD_DeInit(void);
u8 SD_ReadDisk(u8*buf,u32 sector,u8 cnt); //Read SD card, fatfs / usb call
u8 SD_WriteDisk(u8*buf,u32 sector,u8 cnt); //Write SD card, fatfs / usb call
u8 SD_ReadDisk(u8 * buf, u32 sector, u8 cnt); //Read SD card, fatfs / usb call
u8 SD_WriteDisk(u8 * buf, u32 sector, u8 cnt); //Write SD card, fatfs / usb call

u8 SD_Wait_Ready(void); //Waiting for SD card preparation
u8 SD_Get_Ack(u8 Response); //Get the answer
u32 SD_Get_Sector_Count(void); //Number of sectors read
u8 SD_GetCID(u8 *cid_data); //Read SD card CID
u8 SD_GetCSD(u8 *csd_data); //Read SD card CSD
u8 SD_Wait_Ready(void); //Waiting for SD card preparation
u8 SD_Get_Ack(u8 Response); //Get the answer
u32 SD_Get_Sector_Count(void); //Number of sectors read
u8 SD_GetCID(u8 * cid_data); //Read SD card CID
u8 SD_GetCSD(u8 * csd_data); //Read SD card CSD

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Hal/stm32f10x/GPIO_Init.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void GPIO_InitSet(uint16_t io, GPIO_MODE mode, uint8_t AF)
GPIO_Port[port]->BSRR = 1 << pin; // set high
}

if(pin <= 7)
if (pin <= 7)
{
GPIO_Port[port]->CRL &= ~(0xF << 4*(pin & 0x7)); // clear control reg bits
GPIO_Port[port]->CRL |= mode << 4*(pin & 0x7); // clear control reg bits
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Hal/stm32f10x/GPIO_Init.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _GPIO_INIT_H_
#define _GPIO_INIT_H_

#include "stm32f10x.h"
#include "variants.h"
#include "STM32Fxx_Pins.h"

/*
Expand Down
5 changes: 2 additions & 3 deletions TFT/src/User/Hal/stm32f10x/STM32_Flash.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#include "STM32_Flash.h"
#include "my_misc.h"
#include "stm32f10x.h"

#define SIGN_ADDRESS (0x08040000 - 0x800) // reserve the last page (2KB) to save user parameters

void STM32_FlashRead(u8 *data, u32 len)
{
u32 i = 0;
for(i = 0; i < len; i++)
for (i = 0; i < len; i++)
{
data[i] = *(vu8*)(SIGN_ADDRESS + i);
}
Expand All @@ -18,7 +17,7 @@ void STM32_FlashWrite(u8 *data, u32 len)
u32 i = 0;
FLASH_Unlock();
FLASH_ErasePage(SIGN_ADDRESS);
for(i = 0; i < len; i += 2)
for (i = 0; i < len; i += 2)
{
u16 data16 = data[i] | (data[MIN(i+1, len-1)] << 8); // stm32f10x needs to write at least 16 bits at a time
FLASH_ProgramHalfWord(SIGN_ADDRESS + i, data16);
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Hal/stm32f10x/STM32_Flash.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _STM32_FLASH_H_
#define _STM32_FLASH_H_

#include "stm32f10x.h"
#include "variants.h" // for u8 etc...

void STM32_FlashRead(u8 *data, u32 len);
void STM32_FlashWrite(u8 *data, u32 len);
Expand Down
8 changes: 4 additions & 4 deletions TFT/src/User/Hal/stm32f10x/Serial.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Serial.h"
#include "includes.h"
#include "includes.h" // for infoSettings, SERIAL_PORT etc...

#define SERIAL_PORT_QUEUE_SIZE NOBEYOND(512, RAM_SIZE * 64, 4096)
#define SERIAL_PORT_2_QUEUE_SIZE 512
Expand All @@ -15,7 +15,7 @@ typedef struct
USART_TypeDef *uart;
uint32_t dma_rcc;
DMA_Channel_TypeDef *dma_chanel;
}SERIAL_CFG;
} SERIAL_CFG;

static const SERIAL_CFG Serial[_UART_CNT] = {
{USART1, RCC_AHBPeriph_DMA1, DMA1_Channel5},
Expand Down Expand Up @@ -121,14 +121,14 @@ void Serial_DeInit(void)

void USART_IRQHandler(uint8_t port)
{
if((Serial[port].uart->SR & (1<<4))!=0)
if ((Serial[port].uart->SR & (1<<4))!=0)
{
Serial[port].uart->SR;
Serial[port].uart->DR;

dmaL1Data[port].wIndex = dmaL1Data[port].cacheSize - Serial[port].dma_chanel->CNDTR;
uint16_t wIndex = (dmaL1Data[port].wIndex == 0) ? dmaL1Data[port].cacheSize : dmaL1Data[port].wIndex;
if(dmaL1Data[port].cache[wIndex-1] == '\n') // Receive completed
if (dmaL1Data[port].cache[wIndex-1] == '\n') // Receive completed
{
infoHost.rx_ok[port] = true;
}
Expand Down
2 changes: 2 additions & 0 deletions TFT/src/User/Hal/stm32f10x/Serial.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _SERIAL_H_
#define _SERIAL_H_

#include <stdint.h>
#include "variants.h" // for u32 etc...
#include "uart.h"

typedef struct
Expand Down
Loading

0 comments on commit 6e7fd9e

Please sign in to comment.