| | |
| | | /* Includes ------------------------------------------------------------------*/ |
| | | #include "main.h" |
| | | #include "adc.h" |
| | | #include "i2c.h" |
| | | #include "spi.h" |
| | | #include "tim.h" |
| | | #include "usart.h" |
| | | #include "gpio.h" |
| | |
| | | /* USER CODE BEGIN Includes */ |
| | | #include "miscdev.h" |
| | | #include "sht20.h" |
| | | #include "isl1208.h" |
| | | /* USER CODE END Includes */ |
| | | |
| | | /* Private typedef -----------------------------------------------------------*/ |
| | |
| | | { |
| | | |
| | | /* USER CODE BEGIN 1 */ |
| | | int rv; |
| | | float temperature, humidity; |
| | | |
| | | /* USER CODE END 1 */ |
| | | |
| | | /* MCU Configuration--------------------------------------------------------*/ |
| | |
| | | MX_ADC1_Init(); |
| | | MX_TIM6_Init(); |
| | | MX_TIM1_Init(); |
| | | MX_I2C1_Init(); |
| | | MX_SPI1_Init(); |
| | | /* USER CODE BEGIN 2 */ |
| | | |
| | | beep_start(2, 300); |
| | | printf("ISKBoard ISL1208 RTC example.\r\n"); |
| | | set_rtctime("2025-08-08 08:08:08"); |
| | | |
| | | /* USER CODE END 2 */ |
| | | |
| | | /* Infinite loop */ |
| | | /* USER CODE BEGIN WHILE */ |
| | | while (1) |
| | | { |
| | | rv = sht20_sample_TrH(&temperature, &humidity); |
| | | if( rv ) |
| | | { |
| | | printf("ERROR: SHT20 sample data failure, rv=%d\r\n", rv); |
| | | } |
| | | else |
| | | { |
| | | printf("SHT20 sample temperature: %.2f relative humidity: %.1f%%\r\n", temperature, humidity); |
| | | } |
| | | HAL_Delay(1000); |
| | | print_rtctime(); |
| | | HAL_Delay(1000); |
| | | |
| | | /* USER CODE END WHILE */ |
| | | |