From c82bbdc1ca1f541c50e2f1fb950a40d3fbe3e002 Mon Sep 17 00:00:00 2001 From: Razvalyaev Date: Sun, 28 Dec 2025 15:40:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D0=BE=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B5=D0=B5=20=D0=B8=D0=B7=20main.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MDK-ARM/Core/App/main.c | 54 +++-------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/MDK-ARM/Core/App/main.c b/MDK-ARM/Core/App/main.c index 9585862..3e1b17f 100644 --- a/MDK-ARM/Core/App/main.c +++ b/MDK-ARM/Core/App/main.c @@ -10,13 +10,8 @@ //-- Includes ------------------------------------------------------------------ #include "main.h" -void restart_receive(void); -void heartbit(void); //-- Defines ------------------------------------------------------------------- -uint8_t rxbuff[10] = {0}; -uint8_t txbuff[20] = {0}; -uint16_t seq0_buff[2][100] = {0}; -uint16_t seq1_buff[2][100] = {0}; + //-- Peripheral init functions ------------------------------------------------- void periph_init() { @@ -30,61 +25,20 @@ void periph_init() #endif NVIC_SetAllPriorities(); printf("\nAll peripherals inited, SYSCLK = %3d MHz\n", (int)(SystemCoreClock / 1E6)); - - - UART_Start(&huart1, UART_FIFOLevel_1_8, UART_FIFOLevel_1_8); - -// TMR_Set_Callback(&htmr2, TMR_Callback_Update, &heartbit); - TMR_Start(&htmr0, DISABLE); - TMR_Start(&htmr1, DISABLE); - TMR_Start(&htmr2, ENABLE); - ADC_SEQ_Set_Callback(&hadc, ADC_SEQ_Num_1, ADC_Callback_SeqCplt, &heartbit); -// ADC_SEQ_Start(&hadc, ADC_SEQ_Num_0, seq0_buff, 100); - ADC_SEQ_Start(&hadc, ADC_SEQ_Num_1, NULL, 100); } //-- Main ---------------------------------------------------------------------- -uint32_t startmillis = 0; -uint32_t prev_tick; + int main() { periph_init(); -// UART_Receive_IT(&huart1, rxbuff, sizeof(rxbuff)); - TMR_Delay_Start(&htmr0, &prev_tick); - ADC_SEQ_SoftwareStart(); - while (1) { - if(TMR_Delay_Done(&htmr0, 2000000, &prev_tick)) - { - TMR_Delay_Start(&htmr0, &prev_tick); - GPIO_ToggleBits(GPIOA, GPIO_Pin_8); - startmillis = millis(); -// ADC_SEQ_SoftwareStart(); - } - TMR_Delay(&htmr0, 100000); -// GPIO_ToggleBits(GPIOA, GPIO_Pin_7); -// UART_Transmit_IT(&huart1, (uint8_t*)"Hello World: ", sizeof("Hello World: ")-1); -// int len = sprintf((char*)txbuff, "\r\nValue: %d", ADC_Channel_GetValue(&hadc, ADC_CH_Num_3)); -// UART_Transmit_IT(&huart1, txbuff, len); + while (1) + { }; //return 0; } -void restart_receive(void) -{ -// UART_Receive_IT(&huart1, rxbuff, sizeof(rxbuff)); -// UART_Transmit_IT(&huart1, rxbuff, sizeof(rxbuff)); -} - -char tickbuff[40] = {0}; -void heartbit(void) -{ - static uint32_t prev_tick = 0; - int len = sprintf(tickbuff, "\r\nTick: %d, Value: %d", TMR_Get_Cnt(&htmr0) - prev_tick, ADC_Channel_GetValue(&hadc, ADC_CH_Num_3)); - prev_tick = TMR_Get_Cnt(&htmr0); - UART_Transmit_IT(&huart1, (uint8_t *)tickbuff, len); -} - //-- Assert -------------------------------------------------------------------- void Error_Handler(void) {