From 83de2a69af869f4e5c0462a50255317fb9e37099 Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期一, 17 十月 2022 23:27:01 +0800 Subject: [PATCH] fix FP0 --- Src/functions.c | 35 ++++++++++++++++++++++------------- 1 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Src/functions.c b/Src/functions.c index 7d7c303..055d62e 100644 --- a/Src/functions.c +++ b/Src/functions.c @@ -8,7 +8,7 @@ #include "functions.h" #include "string.h" #include "stm32f0xx_hal.h" -#if (BOARD_TYPE == 12) +#if (BOARD_TYPE == 14) #include "fp0.h" #endif extern __IO uint32_t uwTick; @@ -54,6 +54,7 @@ // unsigned short Clk1=SysTick->VAL; return nCurTick; } + const unsigned short crc16_table[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, @@ -96,7 +97,7 @@ { crc_reg = (crc_reg >> 8) ^ crc16_table[(crc_reg ^ *data++) & 0xff]; } -return (~crc_reg) & 0xFFFF; + return (~crc_reg) & 0xFFFF; } const uint16_t polynom = 0xA001; @@ -269,7 +270,7 @@ void PendSvCallBack() { -#if (BOARD_TYPE == 12) +#if (BOARD_TYPE == 14) ///* if (bSPI1RecvDone) { @@ -280,7 +281,7 @@ #endif if (Uart2Stat.bPacketRecved) { - ParsePacket(2, (pPacket)Uart2RecvBuf1, Uart2RecvBuf1DataLen); + KBusParsePacket(2, (pPacket)Uart2RecvBuf1, Uart2RecvBuf1DataLen); Uart2RecvBuf1DataLen=0; Uart2Stat.bPacketRecved=0; Uart2RecvDMA(Uart2RecvBuf1,sizeof(Uart2RecvBuf1)); @@ -294,7 +295,7 @@ if (LL_SPI_IsActiveFlag_RXNE(SPI1)) { value = LL_SPI_ReceiveData8( SPI1); -#if (BOARD_TYPE == 12) +#if (BOARD_TYPE == 14) KMem.SDD[62]++; KMem.SDT[122]++; if (!bSPI1Sending) @@ -443,7 +444,7 @@ */ void ToggleRunLed() { LL_GPIO_TogglePin(GPIOC,LL_GPIO_PIN_13);} void ToggleErrLed() { LL_GPIO_TogglePin(GPIOC,LL_GPIO_PIN_14);} -#if (BOARD_TYPE == 12) +#if (BOARD_TYPE == 14) void ToggleOutStat() { LL_GPIO_TogglePin(GPIOC,LL_GPIO_PIN_15);} void SetOutStat(uchar bOn) @@ -611,8 +612,12 @@ return Input165_R(8); case 11: return Input165_R(8); - case 12: - return 0; //FP0 + case 13: + return Input165_R(16); + case 14: + return 0; //FP0 + case 15: + return Input165_R(16); default: break; } @@ -696,13 +701,15 @@ return ReadConfig_5(); //New Slave 8 in 8 o case 9: case 10: - return ReadConfig_5(); //New Slave 8 in 8 o + return ReadConfig_5(); //New Master Slave 8 in 8 o case 11: return ReadConfig_11(); //Mini Board - case 12: - return (~(LL_GPIO_ReadInputPort(GPIOA)>>4))&0x0f; //FP0 case 13: return ReadConfig_5(); + case 14: + return (~(LL_GPIO_ReadInputPort(GPIOA)>>4))&0x0f; //FP0 + case 15: + return ReadConfig_5(); //Wireless Master Slave 8 in 8 o default: return 0; @@ -747,6 +754,7 @@ STRCLK2_1(); __enable_irq(); } + void Output595_16(unsigned int cc) { //unsigned char i; @@ -843,14 +851,14 @@ void PutOutput(unsigned int Y) { -#if (BOARD_TYPE==12) +#if (BOARD_TYPE == 14) return ; #endif PutOutputSPI2(Y); //Output595_16(Y); } -#if (BOARD_TYPE == 9 || BOARD_TYPE == 10 ) +#if (BOARD_TYPE == 9 || BOARD_TYPE == 10 || BOARD_TYPE == 15 ) //#pragma message("9,10") // V4.2 管脚排列向右移动了一位。 #define SRCLK1_0() LL_GPIO_ResetOutputPin(GPIOB,LL_GPIO_PIN_1) @@ -878,6 +886,7 @@ if (bEnable) {OE1_0();} else {OE1_1();} } + void displayInput(unsigned int cc) { //unsigned char i; -- Gitblit v1.9.1