| | |
| | | #include "ir_nec.h" |
| | | #include "gprs_module_api.h" |
| | | #include "1lcd_new.h" |
| | | #include "1powermanage.h" |
| | | |
| | | |
| | | volatile uint32_t msTicks = 0; |
| | | volatile uint32_t get_time = 0; |
| | |
| | | while (Sys_GetTick() < start_time + ms) |
| | | ; // Ñ»·µÈ´ý |
| | | } |
| | | #if Debug_Model |
| | | |
| | | void AppNvr_Print(void) |
| | | { |
| | | CMU_ClocksType CMU_Clocks; |
| | |
| | | ; // µÈ´ý·¢ËÍÍê³É |
| | | return ch; |
| | | } |
| | | #endif |
| | | |
| | | void Timer_Init(uint32_t psc, uint32_t arr_value) |
| | | { |
| | |
| | | void project_test_2(void) |
| | | { |
| | | IWDT_Clr(); |
| | | // if (HWID0_READ == 0) |
| | | // { |
| | | // EX_PWR_EN_H; |
| | | // } |
| | | // else |
| | | // { |
| | | // EX_PWR_EN_L; |
| | | // } |
| | | Gprs_Uart1_Rx_DMA_CH3_Check(); |
| | | Gprs_Uart1_Receive_Data(); |
| | | if ((GPIO_ReadInputDataBit(GPIOF, GPIO_Pin_14) == 0) || (GPIO_ReadInputDataBit(GPIOF, GPIO_Pin_15) == 0)) // ¶Ì°´ key3 ÎÞÏßÉÏ·¢+ÎÞÏßÉÏ·¢ |
| | | if (HWID0_READ == 0) |
| | | { |
| | | delay_ms(50); |
| | | if (GPIO_ReadInputDataBit(GPIOF, GPIO_Pin_14) == 0) // key3 |
| | | { |
| | | printf("Turn_On power 3.3v and send gprs\r\n"); |
| | | GPRS_POWER_ON; // 3.8V ʹÄÜÒý½Å |
| | | GPRS_POWER_EN_H; // ´ò¿ªÎÞÏßÄ£¿éµçÔ´ |
| | | delay_ms(500); |
| | | IWDT_Clr(); |
| | | Gprs_Open(); |
| | | //GPRS_Send_process(); |
| | | } |
| | | EX_PWR_EN_H; |
| | | } |
| | | else |
| | | { |
| | | EX_PWR_EN_L; |
| | | } |
| | | Gprs_Uart1_Rx_DMA_CH3_Check(); |
| | | Gprs_Uart1_Receive_Data(); |
| | | if ((GPIO_ReadInputDataBit(GPIOF, GPIO_Pin_14) == 0) || (GPIO_ReadInputDataBit(GPIOF, GPIO_Pin_15) == 0)) // ¶Ì°´ key3 ÎÞÏßÉÏ·¢+ÎÞÏßÉÏ·¢ |
| | | { |
| | | delay_ms(50); |
| | | if (GPIO_ReadInputDataBit(GPIOF, GPIO_Pin_14) == 0) // key3 |
| | | { |
| | | printf("Turn_On power 3.3v and send gprs\r\n"); |
| | | GPRS_POWER_ON; // 3.8V ʹÄÜÒý½Å |
| | | GPRS_POWER_EN_H; // ´ò¿ªÎÞÏßÄ£¿éµçÔ´ |
| | | delay_ms(500); |
| | | IWDT_Clr(); |
| | | Gprs_Open(); |
| | | GPRS_Send_process(); |
| | | } |
| | | if (GPIO_ReadInputDataBit(GPIOF, GPIO_Pin_15) == 0) // key2 ¶Ï°´½øÈëµÍ¹¦ºÄ |
| | | { |
| | | //printf("lower model \r\n"); |
| | | BSTIM_CR1_CEN_Setable(DISABLE); |
| | | delay_ms(50); |
| | | LCD_3V3_OFF; |
| | | GPIO_IPD_Init(); |
| | | pwr_enter_sleep_mode((uint32)(PMU_CR_SLPDP_DEEPSLEEP)); |
| | | printf("lower model \r\n"); |
| | | Deep_sleep_mode();//Éî¶È˯Ãß |
| | | } |
| | | } |
| | | } |
| | |
| | | else if (press_duration >= LONG__LONG_PRESS_TIME) // 9v |
| | | { |
| | | printf("Long long press detected.\n"); |
| | | OUTPUT1_EN_ON; |
| | | OUTPUT1_EN_ON; |
| | | power9V_ON; |
| | | BOOST_EN_ON; |
| | | } |
| | |
| | | uint32_t total_ticks = msTicks * arr_value; |
| | | float measured_frequency = (float)total_ticks * psc; |
| | | float error_percentage = ((measured_frequency - SYS_CLOCK_HZ) / SYS_CLOCK_HZ) * 100; |
| | | printf("Measured Frequency: %.2f Hz\r\n", measured_frequency); |
| | | printf("Error Percentage: %.2f%%\r\n", error_percentage); |
| | | //printf("Measured Frequency: %.2f Hz\r\n", measured_frequency); |
| | | //printf("Error Percentage: %.2f%%\r\n", error_percentage); |
| | | BSTIM_CR1_CEN_Setable(ENABLE); |
| | | } |
| | | |
| | |
| | | } |
| | | void Project_Test(void) |
| | | { |
| | | project_test_1(); // led ÖÜÆÚÉÁ˸ |
| | | project_test_2(); // key3 ÎÞÏßÉÏ·¢ ke2 ¶Ì°´µÍ¹¦ºÄ |
| | | project_test_3(); // SEPICµçÔ´Êä³ö key1 (°´¼ü²Ù×÷:¶Ì°´12v ³¤°²4s 5V ³¤°² 6s 9v) |
| | | project_test_5(); // Âö³å ¶ÏÏß¼ì²â |
| | | project_test_6(); // ²É¼¯µçѹ mcu ÎÂ¶È µôµç¼ì²â |
| | | Project_Test_8(); // ½èµç²âÊÔ ¿ª¸Ç¼Ó£¨¹âÃ÷µç×裩£¬¸É»Æ¼ì²â |
| | | project_test_10(); // RTC(ÍⲿʱÖÓ»ñÈ¡) |
| | | // project_test_11(); // uart5 uart1ͨÐżì²â |
| | | IWDT_Clr(); |
| | | project_test_1(); // led ÖÜÆÚÉÁ˸ |
| | | project_test_2(); // key3 ÎÞÏßÉÏ·¢ ke2 ¶Ì°´µÍ¹¦ºÄ |
| | | project_test_3(); // SEPICµçÔ´Êä³ö key1 (°´¼ü²Ù×÷:¶Ì°´12v ³¤°²4s 5V ³¤°² 6s 9v) |
| | | project_test_5(); // Âö³å ¶ÏÏß¼ì²â |
| | | project_test_6(); // ²É¼¯µçѹ mcu ÎÂ¶È µôµç¼ì²â |
| | | Project_Test_8(); // ½èµç²âÊÔ ¿ª¸Ç¼Ó£¨¹âÃ÷µç×裩£¬¸É»Æ¼ì²â |
| | | project_test_10(); // RTC(ÍⲿʱÖÓ»ñÈ¡) |
| | | //project_test_11(); // uart5 uart1ͨÐżì²â |
| | | IWDT_Clr(); |
| | | } |