解决了因为汉字在两个数据块直接导致的数据流乱码,
下个版本打算两字节两个字节的读取,这样就就不怕数据块中 换行太多导致显示不下。 Signed-off-by: 无闻风 <53944749+wuwenfengmi1998@users.noreply.github.com>
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="863708209232398990" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1538997678727627292" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="863708209232398990" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1538997678727627292" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
66BE74F758C12D739921AEA421D593D3=3
|
||||
8DF89ED150041C4CBC7CB9A9CAA90856=DE78FCE0BA5B3294914EFBF8CCE3C6CE
|
||||
DC22A860405A8BF2F2C095E5B6529F12=C0E5DD146C4FCAF07F69BC2160CDF33F
|
||||
8DF89ED150041C4CBC7CB9A9CAA90856=C51B2B4ECCDABDF7BBEE78EFB628823D
|
||||
DC22A860405A8BF2F2C095E5B6529F12=C51B2B4ECCDABDF7BBEE78EFB628823D
|
||||
eclipse.preferences.version=1
|
||||
|
||||
+51
-33
@@ -31,6 +31,7 @@ Mcu.IP3=RCC
|
||||
RCC.SDIOHCLKDiv2FreqValue=36000000
|
||||
Mcu.IP0=FATFS
|
||||
Mcu.IP1=FSMC
|
||||
PE4.GPIOParameters=GPIO_PuPd,GPIO_Label
|
||||
Mcu.UserConstants=
|
||||
Mcu.ThirdPartyNb=0
|
||||
RCC.SDIOFreq_Value=72000000
|
||||
@@ -39,25 +40,25 @@ Mcu.IPNb=6
|
||||
ProjectManager.PreviousToolchain=
|
||||
PD4.Signal=FSMC_NOE
|
||||
RCC.APB2TimFreq_Value=72000000
|
||||
Mcu.Pin6=PE9
|
||||
Mcu.Pin6=PG0
|
||||
PD0.Signal=FSMC_D2_DA2
|
||||
Mcu.Pin7=PE7
|
||||
PD8.Signal=FSMC_D13_DA13
|
||||
Mcu.Pin7=PE10
|
||||
Mcu.Pin8=PE11
|
||||
Mcu.Pin8=PE8
|
||||
OSC_OUT.Mode=HSE-External-Oscillator
|
||||
Mcu.Pin9=PE12
|
||||
Mcu.Pin9=PE9
|
||||
SH.FSMC_A10.0=FSMC_A10,A10_1
|
||||
OSC_OUT.Signal=RCC_OSC_OUT
|
||||
RCC.AHBFreq_Value=72000000
|
||||
Mcu.Pin0=OSC_IN
|
||||
Mcu.Pin1=OSC_OUT
|
||||
Mcu.Pin0=PE2
|
||||
Mcu.Pin1=PE3
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
Mcu.Pin2=PB0
|
||||
Mcu.Pin3=PG0
|
||||
Mcu.Pin2=PE4
|
||||
Mcu.Pin3=OSC_IN
|
||||
SH.FSMC_D4_DA4.ConfNb=1
|
||||
SH.FSMC_D12_DA12.ConfNb=1
|
||||
Mcu.Pin4=PE7
|
||||
Mcu.Pin5=PE8
|
||||
Mcu.Pin4=OSC_OUT
|
||||
Mcu.Pin5=PB0
|
||||
ProjectManager.ProjectBuild=false
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
@@ -78,10 +79,15 @@ PA14.Mode=Serial_Wire
|
||||
PB14.Mode=Full_Duplex_Master
|
||||
SH.FSMC_D6_DA6.0=FSMC_D6,16b-d1
|
||||
File.Version=6
|
||||
PE4.GPIO_Label=KEY_DOWN
|
||||
SPI2.CalculateBaudRate=18.0 MBits/s
|
||||
PE3.GPIOParameters=GPIO_PuPd,GPIO_Label
|
||||
SH.FSMC_D9_DA9.ConfNb=1
|
||||
PE2.Signal=GPIO_Input
|
||||
PE3.Locked=true
|
||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
PE10.Signal=FSMC_D7_DA7
|
||||
PE4.Signal=GPIO_Input
|
||||
SH.FSMC_D5_DA5.0=FSMC_D5,16b-d1
|
||||
ProjectManager.HalAssertFull=false
|
||||
PB0.Locked=true
|
||||
@@ -107,13 +113,14 @@ SPI2.Direction=SPI_DIRECTION_2LINES
|
||||
PB13.Mode=Full_Duplex_Master
|
||||
PE7.Signal=FSMC_D4_DA4
|
||||
SH.FSMC_D7_DA7.ConfNb=1
|
||||
PE2.GPIO_Label=KEY_UP
|
||||
PD15.Signal=FSMC_D1_DA1
|
||||
ProjectManager.CustomerFirmwarePackage=
|
||||
PG12.Signal=FSMC_NE4
|
||||
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
||||
ProjectManager.ProjectFileName=103ze_code.ioc
|
||||
SH.FSMC_D12_DA12.0=FSMC_D12,16b-d1
|
||||
Mcu.PinsNb=32
|
||||
Mcu.PinsNb=35
|
||||
ProjectManager.NoMain=false
|
||||
SH.FSMC_D8_DA8.ConfNb=1
|
||||
PD1.Signal=FSMC_D3_DA3
|
||||
@@ -135,7 +142,9 @@ ProjectManager.TargetToolchain=STM32CubeIDE
|
||||
FSMC.DataSetupTime1=1
|
||||
SH.FSMC_D5_DA5.ConfNb=1
|
||||
SH.FSMC_A10.ConfNb=1
|
||||
PE4.Locked=true
|
||||
SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
|
||||
PE2.GPIOParameters=GPIO_PuPd,GPIO_Label
|
||||
ProjectManager.RegisterCallBack=
|
||||
OSC_IN.Signal=RCC_OSC_IN
|
||||
RCC.USBFreq_Value=72000000
|
||||
@@ -143,6 +152,7 @@ PE11.Signal=FSMC_D8_DA8
|
||||
PB12.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||
VP_FATFS_VS_Generic.Mode=User_defined
|
||||
PB14.Signal=SPI2_MISO
|
||||
PE2.GPIO_PuPd=GPIO_PULLUP
|
||||
SH.FSMC_D7_DA7.0=FSMC_D7,16b-d1
|
||||
board=custom
|
||||
PG12.Mode=NorPsramChipSelect4_1
|
||||
@@ -156,9 +166,13 @@ PE14.Signal=FSMC_D11_DA11
|
||||
PE15.Signal=FSMC_D12_DA12
|
||||
MxCube.Version=6.2.0
|
||||
PE8.Signal=FSMC_D5_DA5
|
||||
Mcu.Pin30=VP_FATFS_VS_Generic
|
||||
Mcu.Pin30=PD4
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
Mcu.Pin31=VP_SYS_VS_Systick
|
||||
Mcu.Pin33=VP_FATFS_VS_Generic
|
||||
PE3.GPIO_PuPd=GPIO_PULLUP
|
||||
Mcu.Pin34=VP_SYS_VS_Systick
|
||||
Mcu.Pin31=PD5
|
||||
Mcu.Pin32=PG12
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
PA13.Mode=Serial_Wire
|
||||
ProjectManager.FreePins=false
|
||||
@@ -166,22 +180,23 @@ RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1Ti
|
||||
ProjectManager.AskForMigrate=true
|
||||
Mcu.Name=STM32F103Z(C-D-E)Tx
|
||||
PE12.Signal=FSMC_D9_DA9
|
||||
Mcu.Pin26=PD2
|
||||
Mcu.Pin27=PD4
|
||||
Mcu.Pin24=PD0
|
||||
Mcu.Pin26=PA14
|
||||
Mcu.Pin27=PD0
|
||||
Mcu.Pin24=PD15
|
||||
ProjectManager.UnderRoot=true
|
||||
Mcu.Pin25=PD1
|
||||
PE4.GPIO_PuPd=GPIO_PULLUP
|
||||
Mcu.Pin25=PA13
|
||||
PD14.Signal=FSMC_D0_DA0
|
||||
Mcu.Pin28=PD5
|
||||
Mcu.Pin28=PD1
|
||||
RCC.FSMCFreq_Value=72000000
|
||||
Mcu.Pin29=PG12
|
||||
Mcu.Pin29=PD2
|
||||
ProjectManager.CoupleFile=false
|
||||
RCC.SYSCLKFreq_VALUE=72000000
|
||||
Mcu.Pin22=PA13
|
||||
Mcu.Pin23=PA14
|
||||
Mcu.Pin22=PD10
|
||||
Mcu.Pin23=PD14
|
||||
RCC.TimSysFreq_Value=72000000
|
||||
Mcu.Pin20=PD14
|
||||
Mcu.Pin21=PD15
|
||||
Mcu.Pin20=PD8
|
||||
Mcu.Pin21=PD9
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
KeepUserPlacement=false
|
||||
OSC_IN.Mode=HSE-External-Oscillator
|
||||
@@ -190,23 +205,26 @@ ProjectManager.CompilerOptimize=6
|
||||
SH.FSMC_D15_DA15.0=FSMC_D15,16b-d1
|
||||
PA14.Signal=SYS_JTCK-SWCLK
|
||||
ProjectManager.HeapSize=0x800
|
||||
Mcu.Pin15=PB14
|
||||
Mcu.Pin15=PE15
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
Mcu.Pin16=PB15
|
||||
Mcu.Pin16=PB12
|
||||
Mcu.Pin13=PE13
|
||||
SH.FSMC_D11_DA11.0=FSMC_D11,16b-d1
|
||||
Mcu.Pin13=PB12
|
||||
Mcu.Pin14=PB13
|
||||
Mcu.Pin19=PD10
|
||||
Mcu.Pin14=PE14
|
||||
Mcu.Pin19=PB15
|
||||
SH.FSMC_NOE.0=FSMC_NOE,Lcd1
|
||||
ProjectManager.ComputerToolchain=false
|
||||
Mcu.Pin17=PD8
|
||||
Mcu.Pin17=PB13
|
||||
SH.FSMC_D2_DA2.ConfNb=1
|
||||
Mcu.Pin18=PD9
|
||||
Mcu.Pin18=PB14
|
||||
SH.FSMC_D1_DA1.ConfNb=1
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
Mcu.Pin11=PE14
|
||||
Mcu.Pin12=PE15
|
||||
Mcu.Pin10=PE13
|
||||
Mcu.Pin11=PE11
|
||||
Mcu.Pin12=PE12
|
||||
Mcu.Pin10=PE10
|
||||
PE3.Signal=GPIO_Input
|
||||
PE2.Locked=true
|
||||
PE3.GPIO_Label=KEY_B
|
||||
PD2.Signal=GPIO_Output
|
||||
RCC.APB1Freq_Value=36000000
|
||||
PB0.Signal=GPIO_Output
|
||||
|
||||
@@ -58,6 +58,12 @@ void Error_Handler(void);
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
#define KEY_UP_Pin GPIO_PIN_2
|
||||
#define KEY_UP_GPIO_Port GPIOE
|
||||
#define KEY_B_Pin GPIO_PIN_3
|
||||
#define KEY_B_GPIO_Port GPIOE
|
||||
#define KEY_DOWN_Pin GPIO_PIN_4
|
||||
#define KEY_DOWN_GPIO_Port GPIOE
|
||||
#define LCD_BL_Pin GPIO_PIN_0
|
||||
#define LCD_BL_GPIO_Port GPIOB
|
||||
#define FLASH_E_Pin GPIO_PIN_12
|
||||
|
||||
@@ -196,9 +196,9 @@ static void MX_GPIO_Init(void)
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
|
||||
@@ -208,6 +208,12 @@ static void MX_GPIO_Init(void)
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(SD_E_GPIO_Port, SD_E_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pins : KEY_UP_Pin KEY_B_Pin KEY_DOWN_Pin */
|
||||
GPIO_InitStruct.Pin = KEY_UP_Pin|KEY_B_Pin|KEY_DOWN_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : LCD_BL_Pin */
|
||||
GPIO_InitStruct.Pin = LCD_BL_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+11592
-10329
File diff suppressed because it is too large
Load Diff
+891
-658
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -2,5 +2,5 @@ main.c:70:5:main 8 static
|
||||
main.c:117:6:SystemClock_Config 72 static
|
||||
main.c:156:13:MX_SPI2_Init 8 static
|
||||
main.c:194:13:MX_GPIO_Init 48 static
|
||||
main.c:235:13:MX_FSMC_Init 40 static
|
||||
main.c:299:6:Error_Handler 4 static,ignoring_inline_asm
|
||||
main.c:241:13:MX_FSMC_Init 40 static
|
||||
main.c:305:6:Error_Handler 4 static,ignoring_inline_asm
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -66,8 +66,8 @@ all: main-build
|
||||
main-build: 103ze_code.elf secondary-outputs
|
||||
|
||||
# Tool invocations
|
||||
103ze_code.elf: $(OBJS) $(USER_OBJS) C:\Users\kevin\Desktop\smartbooks\103ze\STM32F103ZETX_FLASH.ld makefile objects.list $(OPTIONAL_TOOL_DEPS)
|
||||
arm-none-eabi-gcc -o "103ze_code.elf" @"objects.list" $(USER_OBJS) $(LIBS) -mcpu=cortex-m3 -T"C:\Users\kevin\Desktop\smartbooks\103ze\STM32F103ZETX_FLASH.ld" --specs=nosys.specs -Wl,-Map="103ze_code.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
|
||||
103ze_code.elf: $(OBJS) $(USER_OBJS) C:\Users\13370\Desktop\smartbooks\103ze\STM32F103ZETX_FLASH.ld makefile objects.list $(OPTIONAL_TOOL_DEPS)
|
||||
arm-none-eabi-gcc -o "103ze_code.elf" @"objects.list" $(USER_OBJS) $(LIBS) -mcpu=cortex-m3 -T"C:\Users\13370\Desktop\smartbooks\103ze\STM32F103ZETX_FLASH.ld" --specs=nosys.specs -Wl,-Map="103ze_code.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
|
||||
@echo 'Finished building target: $@'
|
||||
@echo ' '
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
c.c:14:5:my_main 736 static
|
||||
c.c:21:5:my_main 1120 static
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,18 +1,18 @@
|
||||
fatfs_sd.c:29:6:SDTimer_Handler 4 static
|
||||
fatfs_sd.c:39:13:SELECT 8 static
|
||||
fatfs_sd.c:45:13:DESELECT 8 static
|
||||
fatfs_sd.c:51:13:SPI_TxByte 16 static
|
||||
fatfs_sd.c:58:16:SPI_RxByte 24 static
|
||||
fatfs_sd.c:71:13:SPI_RxBytePtr 16 static
|
||||
fatfs_sd.c:77:16:SD_ReadyWait 16 static
|
||||
fatfs_sd.c:95:13:SD_PowerOn 32 static
|
||||
fatfs_sd.c:138:13:SD_PowerOff 4 static
|
||||
fatfs_sd.c:144:16:SD_CheckPower 4 static
|
||||
fatfs_sd.c:151:13:SD_RxDataBlock 24 static
|
||||
fatfs_sd.c:183:13:SD_TxDataBlock 24 static
|
||||
fatfs_sd.c:231:13:SD_SendCmd 24 static
|
||||
fatfs_sd.c:275:9:SD_disk_initialize 32 static
|
||||
fatfs_sd.c:378:9:SD_disk_status 16 static
|
||||
fatfs_sd.c:387:9:SD_disk_read 24 static
|
||||
fatfs_sd.c:431:9:SD_disk_write 24 static
|
||||
fatfs_sd.c:486:9:SD_disk_ioctl 56 static
|
||||
fatfs_sd.c:43:13:SELECT 8 static
|
||||
fatfs_sd.c:49:13:DESELECT 8 static
|
||||
fatfs_sd.c:55:13:SPI_TxByte 16 static
|
||||
fatfs_sd.c:62:16:SPI_RxByte 24 static
|
||||
fatfs_sd.c:75:13:SPI_RxBytePtr 16 static
|
||||
fatfs_sd.c:81:16:SD_ReadyWait 16 static
|
||||
fatfs_sd.c:100:13:SD_PowerOn 32 static
|
||||
fatfs_sd.c:143:13:SD_PowerOff 4 static
|
||||
fatfs_sd.c:149:16:SD_CheckPower 4 static
|
||||
fatfs_sd.c:156:13:SD_RxDataBlock 24 static
|
||||
fatfs_sd.c:186:13:SD_TxDataBlock 24 static
|
||||
fatfs_sd.c:234:13:SD_SendCmd 24 static
|
||||
fatfs_sd.c:278:9:SD_disk_initialize 32 static
|
||||
fatfs_sd.c:383:9:SD_disk_status 16 static
|
||||
fatfs_sd.c:392:9:SD_disk_read 24 static
|
||||
fatfs_sd.c:436:9:SD_disk_write 24 static
|
||||
fatfs_sd.c:491:9:SD_disk_ioctl 56 static
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+51
-5
@@ -9,15 +9,24 @@
|
||||
#include "text.h"
|
||||
#include "fatfs.h"
|
||||
#include "fatfs_sd.h"
|
||||
|
||||
#define KEY_UP HAL_GPIO_ReadPin(KEY_UP_GPIO_Port,KEY_UP_Pin)
|
||||
#define KEY_B HAL_GPIO_ReadPin(KEY_B_GPIO_Port,KEY_B_Pin)
|
||||
#define KEY_DOWN HAL_GPIO_ReadPin(KEY_DOWN_GPIO_Port,KEY_DOWN_Pin)
|
||||
|
||||
FATFS SD;
|
||||
|
||||
#define fuck 256
|
||||
|
||||
int my_main()
|
||||
{
|
||||
uint8_t res;
|
||||
FIL fil;
|
||||
char fil_buff[128];
|
||||
uint16_t br=128;
|
||||
char str[16];
|
||||
char fil_buff[fuck+1]={0};
|
||||
char fuck_flag=0;
|
||||
char fuck_buff;
|
||||
uint16_t br=0;
|
||||
char str[fuck+1]={0};
|
||||
LCD_BL(0);
|
||||
LCDx_Init();
|
||||
LCD_Clear(GRAY);
|
||||
@@ -29,8 +38,7 @@ int my_main()
|
||||
|
||||
f_mount(&SD,"0:",1);
|
||||
res=f_open(&fil,"0:/demo.txt",FA_READ);
|
||||
res=f_read(&fil,fil_buff,64,(UINT*)&br);
|
||||
LCD_ShowString(0,0,fil_buff,16,RED,BLUE,64);
|
||||
|
||||
|
||||
/*
|
||||
sprintf(str,"%02x\n%02x\n%02x\n%02x\n%02x",ftinfo.fontok,ftinfo.ugbkaddr,ftinfo.ugbksize,ftinfo.f12addr,ftinfo.gbk12size);
|
||||
@@ -40,6 +48,44 @@ int my_main()
|
||||
*/
|
||||
while(1)
|
||||
{
|
||||
if(KEY_UP==0)
|
||||
{
|
||||
HAL_Delay(10);
|
||||
while(KEY_UP==0);
|
||||
LCD_Clear(WHITE);
|
||||
for(int a=0;a<fuck+1;a++)
|
||||
{
|
||||
fil_buff[a]=0;
|
||||
str[a]=0;
|
||||
}
|
||||
|
||||
if(fuck_flag==1)
|
||||
{
|
||||
fuck_flag=0;
|
||||
res=f_read(&fil,fil_buff,fuck-1,(UINT*)&br);
|
||||
for(int a=fuck-2;a>0;a--)
|
||||
{
|
||||
fil_buff[a+1]=fil_buff[a];
|
||||
}
|
||||
fil_buff[0]=fuck_buff;
|
||||
|
||||
}else
|
||||
{
|
||||
res=f_read(&fil,fil_buff,fuck,(UINT*)&br);
|
||||
}
|
||||
|
||||
if((fil_buff[fuck-1]>127)&&(fil_buff[fuck-2]<128))
|
||||
{
|
||||
fuck_buff=fil_buff[fuck-1];
|
||||
fil_buff[fuck-1]='\0';
|
||||
fuck_flag=1;
|
||||
|
||||
}
|
||||
|
||||
sprintf(str,"%s\0",fil_buff);
|
||||
LCD_ShowString(0,0,str,16,WHITE,BLACK,fuck);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+13
-8
@@ -24,15 +24,19 @@ static uint8_t PowerFlag = 0;
|
||||
#define SD_CS_GPIO_Port GPIOD
|
||||
#define SD_CS_Pin GPIO_PIN_2
|
||||
|
||||
volatile uint8_t Timer1, Timer2;
|
||||
volatile uint32_t Timer1, Timer2;
|
||||
|
||||
void SDTimer_Handler(void)
|
||||
{
|
||||
if(Timer1 > 0)
|
||||
{
|
||||
Timer1--;
|
||||
|
||||
}
|
||||
if(Timer2 > 0)
|
||||
{
|
||||
Timer2--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* SPI Chip Select */
|
||||
@@ -79,13 +83,14 @@ static uint8_t SD_ReadyWait(void)
|
||||
uint8_t res;
|
||||
|
||||
|
||||
Timer2 = 50;
|
||||
Timer2 = 50000;
|
||||
SPI_RxByte();
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
res = SPI_RxByte();
|
||||
Timer2--;
|
||||
} while ((res != 0xFF) && Timer2);
|
||||
|
||||
return res;
|
||||
@@ -152,13 +157,11 @@ static bool SD_RxDataBlock(BYTE *buff, UINT btr)
|
||||
{
|
||||
uint8_t token;
|
||||
|
||||
|
||||
Timer1 = 10;
|
||||
|
||||
|
||||
Timer1 = 10000;
|
||||
do
|
||||
{
|
||||
token = SPI_RxByte();
|
||||
Timer1--;
|
||||
} while((token == 0xFF) && Timer1);
|
||||
|
||||
|
||||
@@ -297,7 +300,7 @@ DSTATUS SD_disk_initialize(BYTE drv)
|
||||
if (SD_SendCmd(CMD0, 0) == 1)
|
||||
{
|
||||
|
||||
Timer1 = 100;
|
||||
Timer1 = 100000;
|
||||
|
||||
|
||||
if (SD_SendCmd(CMD8, 0x1AA) == 1)
|
||||
@@ -314,6 +317,7 @@ DSTATUS SD_disk_initialize(BYTE drv)
|
||||
do {
|
||||
if (SD_SendCmd(CMD55, 0) <= 1 && SD_SendCmd(CMD41, 1UL << 30) == 0)
|
||||
break; /* ACMD41 with HCS bit */
|
||||
Timer1--;
|
||||
} while (Timer1);
|
||||
|
||||
if (Timer1 && SD_SendCmd(CMD58, 0) == 0)
|
||||
@@ -344,6 +348,7 @@ DSTATUS SD_disk_initialize(BYTE drv)
|
||||
if (SD_SendCmd(CMD1, 0) == 0)
|
||||
break; /* CMD1 */
|
||||
}
|
||||
Timer1--;
|
||||
} while (Timer1);
|
||||
|
||||
if (!Timer1 || SD_SendCmd(CMD16, 512) != 0)
|
||||
|
||||
+11
-5
@@ -361,6 +361,10 @@ void LCD_ShowString(uint16_t x,uint16_t y,uint8_t *p,uint8_t size,uint16_t bg,ui
|
||||
if(*p=='\r')
|
||||
{
|
||||
p++;
|
||||
if(*p!='\n')
|
||||
{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
if(*p=='\n')
|
||||
{
|
||||
@@ -368,15 +372,17 @@ void LCD_ShowString(uint16_t x,uint16_t y,uint8_t *p,uint8_t size,uint16_t bg,ui
|
||||
y+=size;
|
||||
p++;
|
||||
}
|
||||
if(*p<127)
|
||||
{
|
||||
LCD_ShowChar(x,y,*p,size,bg,color);
|
||||
x+=(size/2);
|
||||
}else
|
||||
if(*p>127)
|
||||
{
|
||||
|
||||
|
||||
Show_Font(x,y,p,size,bg,color);
|
||||
p++;
|
||||
x+=size;
|
||||
}else
|
||||
{
|
||||
LCD_ShowChar(x,y,*p,size,bg,color);
|
||||
x+=(size/2);
|
||||
}
|
||||
p++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user