esp32-warm-water
esp32 based project for the control of a heating element based on temperature
utility.c
Go to the documentation of this file.
1 /*
2  * MIT License
3  *
4  * Copyright (c) 2021 wolffshots
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  *
24  * A note on the copyright line: https://www.copyright.gov/title17/92chap4.html#408
25  */
26 
32 #include "utility.h"
33 #include "esp_log.h"
34 
35 static const char *TAG = CONFIG_UTILITY_LOG_TAG;
36 
38 void print_chip_info(void)
39 {
40  esp_chip_info_t chip_info;
41  esp_chip_info(&chip_info);
42  ESP_LOGI(TAG, "This is %s chip with %d CPU cores, WiFi%s%s, ",
43  CONFIG_IDF_TARGET,
44  chip_info.cores,
45  (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
46  (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
47  ESP_LOGI(TAG, "silicon revision %d, ", chip_info.revision);
48  ESP_LOGI(TAG, "%dMB %s flash", spi_flash_get_chip_size() / (1024 * 1024),
49  (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
50  ESP_LOGI(TAG, "Free heap: %d", esp_get_free_heap_size());
51 }
56 void util_delay_millis(int millis)
57 {
58  vTaskDelay(millis / portTICK_RATE_MS);
59 }
64 void util_delay_seconds(int seconds)
65 {
66  vTaskDelay(seconds * (1000 / portTICK_RATE_MS));
67 }
72 void util_delay_minutes(int minutes)
73 {
74  vTaskDelay(minutes * 60 * (1000 / portTICK_RATE_MS));
75 }
76 
77 // void app_main(void){
78 // do nothing when directly run
79 
80 // in future do testing here
81 // }
void util_delay_minutes(int minutes)
Definition: utility.c:72
void print_chip_info(void)
Definition: utility.c:38
void util_delay_seconds(int seconds)
Definition: utility.c:64
void util_delay_millis(int millis)
Definition: utility.c:56
defininitions for simple utility functions
const char * TAG
Definition: wifi_sta.c:42