X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=Src%2Fmain.c;h=7b5b75d0e3921e514183d9feb8bd79c6cdc78492;hb=abb212223d07a11a335151a64e111d8a670e93f5;hp=043fe33869050840d43adf271d6110e661263783;hpb=20f95c72bf21389ac92f354d8d81f5fe87772fc0;p=home-hw.git diff --git a/Src/main.c b/Src/main.c index 043fe33..7b5b75d 100644 --- a/Src/main.c +++ b/Src/main.c @@ -123,18 +123,20 @@ int main(void) MX_USB_PCD_Init(); MX_TIM4_Init(); /* USER CODE BEGIN 2 */ - display_init(); + //display_init(); usb_start(&usb); - // bmp_init(); + bmp_init(); LL_TIM_EnableCounter(TIM4); LL_TIM_EnableIT_UPDATE(TIM4); LL_TIM_GenerateEvent_UPDATE(TIM4); +#if 0 { byte buf[5] = { 0xff, 0xff, 10, 0xff, 0xff }; display_buffer(buf); } +#endif /* USER CODE END 2 */ @@ -144,23 +146,29 @@ int main(void) { if (rx_packet_state == 1 && !tx_packet_state) { - display_buffer(rx_packet); + static byte led_state; + if (led_state) + LL_GPIO_SetOutputPin(LED_GPIO_Port, LED_Pin); + else + LL_GPIO_ResetOutputPin(LED_GPIO_Port, LED_Pin); + led_state ^= 1; + + // display_buffer(rx_packet); tx_packet_state = 1; + tx_packet[0] = adjusted_temp >> 8; + tx_packet[1] = adjusted_temp & 0xff; + tx_packet[2] = adjusted_press >> 8; + tx_packet[3] = adjusted_press & 0xff; usb_ep_send(&usb, 0x82, tx_packet, 8); rx_packet_state = 0; usb_ep_receive(&usb, 0x01, rx_packet, 64); } + bmp_step(); + // debug_printf("Counter = %d\n", cnt); // display_counter(cnt); - static byte led_state; - if (led_state) - LL_GPIO_SetOutputPin(LED_GPIO_Port, LED_Pin); - else - LL_GPIO_ResetOutputPin(LED_GPIO_Port, LED_Pin); - led_state ^= 1; - __WFI(); /* USER CODE END WHILE */