void InitBluetooth() { int i; GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBxPeriphClockCmd(RCC_GPIO_BL,ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_PIN_BL; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIO_BL_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_PIN_RS; GPIO_Init(GPIO_BL_PORT, &GPIO_InitStructure); KEY_Disable RS_Enable for (i=0; i<100000; i++); KEY_Enable RS_Disable for (i=0; i<100000; i++); RS_Enable USART_Configuration(38400); USART_NVIC_Config(); for (i=0; i<100000; i++); sprintf_u0( control_str); for (i=0; i<100000; i++); KEY_Disable for (i=0; i<100000; i++); RS_Disable for (i=0; i<100000; i++); RS_Enable USART_Configuration(38400); USART_NVIC_Config(); }
int main(void) { /* !< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f4xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f4xx.c file */ init_rx_buffer(&rx_buffer); init_rx_frame(&rx_frame); USART_Configuration(); USART_NVIC_Config(); USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); while(1); return 0; }
int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f2xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f2xx.c file */ u8 ID[4]; volatile u8 tmp,k; //SystemInit(); //SystemCoreClockUpdate(); Open207_LEDInit(); USART_Configuration(); USART_NVIC_Config(); printf("\r\n SPI Rom Copy SPI1 to SPI2\r\n"); SPIx_Init(1); SPIx_Init(2); Read_Status_Register(1); Read_Status_Register(2); SPIx_Read_ID(1,ID); printf("SPI1 Flash Rom ID is"); printf(" 0x%x 0x%x \r\n",ID[0],ID[1]); SPIx_Read_ID(2,ID); printf("SPI2 Flash Rom ID is"); printf(" 0x%x 0x%x \r\n",ID[0],ID[1]); /* for (i=0 ; i<255; i++) { tmp = read_buffer(2,i); printf("intel[%3d] ::",tmp); write_buffer(1,i,tmp); tmp = read_buffer(1,i); printf("[%3d] copy\r\n",tmp); } */ printf("========Flash Rom Copy========\r\n"); printf("[C]SPI CH Select (Default : 2)\r\n"); printf("[S]Read Status Register\r\n"); printf("[W]Write Protect Disable\r\n"); printf("[R]Read ID\r\n"); printf("[E]Eraser Flash Memory\r\n"); printf("[L]Read Address 0 to 99\r\n"); printf("[-]Copy Start SPI1 to SPI2 \r\n"); printf("[M]Compare Match SPI1 Vs SPI2\r\n"); printf("========Press Key========\r\n"); while (1) { GPIO_SetBits(Open207Z_LED_GPIO , Open207Z_GPIO_Pin_LED2); GPIO_SetBits(Open207Z_LED_GPIO , Open207Z_GPIO_Pin_LED3); GPIO_SetBits(Open207Z_LED_GPIO , Open207Z_GPIO_Pin_LED4); Delay(0x5fffff); GPIO_ResetBits(Open207Z_LED_GPIO , Open207Z_GPIO_Pin_LED2); GPIO_ResetBits(Open207Z_LED_GPIO , Open207Z_GPIO_Pin_LED3); GPIO_ResetBits(Open207Z_LED_GPIO , Open207Z_GPIO_Pin_LED4); Delay(0x5fffff); if (UART_DATA == COPY_START) { UART_DATA = 0; MemCopy(); } else if (UART_DATA == DATA_All_VERIFY) { UART_DATA = 0; Compair_Match(START_ADDRESS,END_ADDRESS); } } }