From df737bb92e7ff5f5c7495c06d0e231338805a86c Mon Sep 17 00:00:00 2001 From: guanjiao <sqrgj@163.com> Date: 星期三, 16 五月 2018 23:19:20 +0800 Subject: [PATCH] 从工程中删除platform中相关文件 --- 源码/核心板/Src/main.c | 52 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 36 insertions(+), 16 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" index 20697f8..af5d8de 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" @@ -21,9 +21,11 @@ #include <stdio.h> #include "deca_device_api.h" #include "deca_regs.h" -#include "deca_sleep.h" -#include "lcd.h" -#include "port.h" +#include "Rcc_Nvic_Systick.h" +#include "Usart.h" +#include "Spi.h" +#include "dw_driver.h" +#include "led.h" /* Example application name and version to display on LCD screen. */ #define APP_NAME "DS TWR INIT v1.1" @@ -135,10 +137,10 @@ *ts += ts_field[i] << (i * 8); } } -void GPIO_Toggle(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) -{ - GPIO_WriteBit(GPIOx, GPIO_Pin, (BitAction)!GPIO_ReadOutputDataBit(GPIOx, GPIO_Pin)); -} +//void GPIO_Toggle(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) +//{ +// GPIO_WriteBit(GPIOx, GPIO_Pin, (BitAction)!GPIO_ReadOutputDataBit(GPIOx, GPIO_Pin)); +//} int fputc(int ch, FILE *f) { @@ -197,7 +199,7 @@ deca_sleep(100); } } -extern volatile unsigned long time32_reset; +//extern volatile unsigned long time32_reset; extern uint8_t Work_Mode; uint32 frame_len; uint8_t send[9]; @@ -207,21 +209,39 @@ uint8_t TAG_ID, ANCHOR_ID, jumptime = 0; uint32_t rec_dist, hex_dist; uint16_t check; + +void Device_Init(void) +{ + Rcc_Init(); + Nvic_Init(); + Systick_Init(); + Led_Init(); + DW_GPIO_Init(); + Usart_Init(); + Spi_Init(); + + GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); + +} + int main(void) { - RCC_ClocksTypeDef RCC_Clocks; /* Start with board specific hardware init. */ - peripherals_init();//初始化外设 - RCC_GetClocksFreq(&RCC_Clocks); + + Device_Init(); +// RCC_ClocksTypeDef RCC_Clocks; /* Start with board specific hardware init. */ +// peripherals_init();//初始化外设 +// RCC_GetClocksFreq(&RCC_Clocks); /* Display application name on LCD. */ // lcd_display_str(APP_NAME); /* Reset and initialise DW1000. * For initialisation, DW1000 clocks must be temporarily set to crystal speed. After initialisation SPI rate can be increased for optimum * performance. */ - reset_DW1000();//重启DW1000 /* Target specific drive of RSTn line into DW1000 low for a period. */ - spi_set_rate_low();//降低SPI频率 + Reset_DW1000();//重启DW1000 /* Target specific drive of RSTn line into DW1000 low for a period. */ +// spi_set_rate_low();//降低SPI频率 dwt_initialise(DWT_LOADUCODE);//初始化DW1000 - spi_set_rate_high();//回复SPI频率 +// spi_set_rate_high();//回复SPI频率 + Spi_ChangePrescaler(SPIx_PRESCALER_FAST); //设置为快速模式 /* Configure DW1000. See NOTE 6 below. */ dwt_configure(&config);//配置DW1000 @@ -343,7 +363,7 @@ /* Increment frame sequence number after transmission of the final message (modulo 256). */ frame_seq_nb++; - time32_reset = 0; +// time32_reset = 0; GPIO_Toggle(GPIOA, LED_PIN); //LED闪烁 jumptime = 0; } @@ -473,7 +493,7 @@ dis = dist2 * 100; //dis 为单位为cm的距离 dist[TAG_ID] = LP(dis, TAG_ID); //LP 为低通滤波器,让数据更稳定 - time32_reset = 0; +// time32_reset = 0; GPIO_Toggle(GPIOA, LED_PIN); if (GPIO_ReadInputDataBit(GPIOA, SW2) != RESET) //通过拨码开关判断数据输出格式 { -- Gitblit v1.9.3