void btPRESS (void* pdata){ while(1){ flag = GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0); if(flag==1){ if(btStatus==0) { GPIO_WriteBit(GPIOC,GPIO_Pin_9,Bit_SET); const unsigned char menu[] = "/?!\r\n"; UART1Send(menu, sizeof(menu)); UART2Send(menu, sizeof(menu)); LCD_Clear(); //Clear the LCD. LCD_GoTo(0,0); //Go to Line 0, position 0 of LCD. LCD_SendText("@300 7E1"); LCD_GoTo(1,0); //Go to Line 1, position 2 (on the right) of LCD. LCD_SendText (menu); } CoTickDelay (10); btStatus = 1; GPIO_WriteBit(GPIOC,GPIO_Pin_9,Bit_RESET); }else{ GPIO_WriteBit(GPIOC,GPIO_Pin_9,Bit_RESET); btStatus = 0; } } }
void initializeBoard(){ RCC_Init(); board_map();//Configura todas as portas IO e perifericos usart_init(); LCD_Initialization(); // Initialize the LCD. LCD_Clear(); //Clear the LCD. LCD_GoTo(0,0); //Go to Line 0, position 0 of LCD. LCD_SendText ("SL7000 Bluetooth"); LCD_GoTo(1,0); //Go to Line 1, position 2 (on the right) of LCD. LCD_SendText ("IEC Auto Detect"); }
void USART2_IRQHandler(void) { if (USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) // Received characters modify string { GPIO_WriteBit(GPIOC,GPIO_Pin_2,Bit_SET); StringLoop[rx_index++] = USART_ReceiveData(USART2); if (rx_index >= (sizeof(StringLoop) - 1)) rx_index = 0; } LCD_Clear(); //Clear the LCD. LCD_GoTo(0,0); //Go to Line 0, position 0 of LCD. LCD_SendText(StringLoop); // if (USART_GetFlagStatus(USART1, USART_FLAG_RXNE) != RESET) // { // GPIO_WriteBit(GPIOC,GPIO_Pin_9,Bit_SET); // i = USART_ReceiveData(USART1); // if(j == NUM) // { // name[j] = i; // j = 0; // } // else // { // name[j++] = i; // } // name[j] = '\0'; // } GPIO_WriteBit(GPIOC,GPIO_Pin_2,Bit_RESET); }
void Minus(void) { if (z <=10) z=10; else z-=10; timerInitStructure.TIM_Period = z-1; LCD_Clear(); LCD_SendText("Probkowanie co:"); LCD_GoTo(1,0); LCD_SendInt(z); }
int main(void) { ///-----Inicjalizacja funkcji---- SystemInit(); DELAY_Init(); LCD_Init(); DAC_Conf(); EXTILine0_Config(); EXTILine3_Config(); Timer(); LCD_Clear(); LCD_GoTo(0,0); LCD_SendText("Probkowanie co:"); LCD_GoTo(1,0); LCD_SendInt(z); DAC_Cmd(DAC_Channel_1, ENABLE); //wlacz przetwornik while (1) { int timerValue = TIM_GetCounter(TIM2); //sprawdzanie wartosci timera if(timerValue >=z-1) { TIM_ClearITPendingBit(TIM3, TIM_IT_Update); DAC_SetChannel1Data(DAC_Align_12b_R, k); k++; if(k >= 4000) { k=0; } } } }