Ver código fonte

update:spi波特率参数乱填也不应该出错

alienwalker 4 anos atrás
pai
commit
58861dd075

+ 2 - 0
application/include/luat_conf_bsp.h

@@ -173,4 +173,6 @@ extern unsigned int gLVFlashTime;
 #undef LV_USE_PERF_MONITOR
 #endif
 
+#define LUAT_GPIO_NUMS	32
+
 #endif

+ 3 - 3
application/src/luat_io_queue_air105.c

@@ -23,7 +23,7 @@
 #include "luat_lib_io_queue.h"
 #include "app_interface.h"
 
-#define LUAT_LOG_TAG "hwtimer"
+#define LUAT_LOG_TAG "ioqueue"
 #include "luat_log.h"
 
 static int32_t luat_io_queue_done_cb(void *pData, void *pParam)
@@ -46,8 +46,8 @@ static int32_t __FUNC_IN_RAM__ luat_io_queue_capture_cb(void *pData, void *pPara
 	uint64_t tick = GetSysTick();
 	msg.handler = l_io_queue_capture_handler;
 	msg.ptr = ((uint32_t)pData << 8) | GPIO_Input(pData);
-	msg.arg1 = (tick >> 32);
-	msg.arg2 = tick & 0x0ffffffff;
+	msg.arg1 = (tick >> 32) & 0xffffffff;
+	msg.arg2 = tick & 0xffffffff;
 	luat_msgbus_put(&msg, 1);
 	return 0;
 }

+ 2 - 0
bsp/air105/hal/core_spi.c

@@ -434,6 +434,7 @@ void SPI_MasterInit(uint8_t SpiID, uint8_t DataBit, uint8_t Mode, uint32_t Speed
 			break;
 		}
 		div = (SystemCoreClock >> 2) / Speed;
+		if (!div) div = 2;
 		if (div % 2) div++;
 		prvSPI[SpiID].Speed = (SystemCoreClock >> 2) / div;
 		SPI->CTRLR0 = ctrl;
@@ -1163,6 +1164,7 @@ void SPI_SetNewConfig(uint8_t SpiID, uint32_t Speed, uint8_t NewMode)
 		SPI = (SPI_TypeDef *)prvSPI[SpiID].RegBase;
 		SPI->SSIENR = 0;
 		div = (SystemCoreClock >> 2) / Speed;
+		if (!div) div = 2;
 		if (div % 2) div++;
 		prvSPI[SpiID].Speed = (SystemCoreClock >> 2) / div;
 		SPI->BAUDR = div;