Initial project setup
This commit is contained in:
42
main/main.c
Normal file
42
main/main.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "dcdc_controller.h"
|
||||
#include "usb_cdc_cli.h"
|
||||
|
||||
static const char *TAG = "watch-watch";
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
if (dcdc_init() != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Помилка ініціалізації DCDC контролера");
|
||||
return;
|
||||
}
|
||||
|
||||
if (usb_cdc_cli_init() != ESP_OK) {
|
||||
ESP_LOGW(TAG, "USB CDC CLI недоступний");
|
||||
} else {
|
||||
ESP_LOGI(TAG, "USB CDC CLI запущено");
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Початок послідовного ввімкнення каналів з інтервалом 4 с");
|
||||
const TickType_t on_time = pdMS_TO_TICKS(4000);
|
||||
|
||||
size_t prev_channel = DCDC_CHANNEL_COUNT - 1;
|
||||
while (true) {
|
||||
for (size_t ch = 0; ch < dcdc_channel_count(); ++ch) {
|
||||
if (prev_channel != ch) {
|
||||
dcdc_disable(prev_channel);
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "-> Ввімкнення каналу %d", (int)ch);
|
||||
dcdc_enable(ch);
|
||||
vTaskDelay(on_time);
|
||||
|
||||
prev_channel = ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user