Initial commit.

This commit is contained in:
Filipe Rodrigues 2024-12-12 13:22:27 +00:00
commit 930b985abe
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU
10 changed files with 121 additions and 0 deletions

12
.clang-format Normal file
View File

@ -0,0 +1,12 @@
---
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
UseTab: AlignWithSpaces
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty
ColumnLimit: 120
SpaceBeforeRangeBasedForLoopColon: false
AllowShortCaseLabelsOnASingleLine: true
IndentCaseBlocks: false
ReflowComments: false

6
.clangd Normal file
View File

@ -0,0 +1,6 @@
CompileFlags:
Add: -Wno-unknown-warning-option
Remove: [-m*, -f*]
Diagnostics:
UnusedIncludes: None

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
# ESP
build/
sdkconfig
sdkconfig.old
# Clangd
.cache

7
.prettierrc Normal file
View File

@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"useTabs": true,
"semi": true,
"singleQuote": true,
"singleAttributePerLine": true
}

18
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "ESP-IDF",
"compilerPath": "${config:idf.toolsPath}/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc",
"compileCommands": "${config:idf.buildPath}/compile_commands.json",
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${workspaceFolder}/**"
],
"browse": {
"path": ["${config:idf.espIdfPath}/components", "${workspaceFolder}"],
"limitSymbolsToIncludedHeaders": true
}
}
],
"version": 4
}

15
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "gdbtarget",
"request": "attach",
"name": "Eclipse CDT GDB Adapter"
},
{
"type": "espidf",
"name": "Launch",
"request": "launch"
}
]
}

4
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"C_Cpp.intelliSenseEngine": "default",
"cSpell.words": ["IRAM"]
}

4
CMakeLists.txt Normal file
View File

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tpl2)

4
main/CMakeLists.txt Normal file
View File

@ -0,0 +1,4 @@
idf_component_register(
SRCS "main.c"
INCLUDE_DIRS ""
)

44
main/main.c Normal file
View File

@ -0,0 +1,44 @@
#include "driver/gpio.h"
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "spi_flash_mmap.h"
#include <stdio.h>
void app_main(void) {
// Initialize the pin
const int pin = GPIO_NUM_2;
gpio_reset_pin(pin);
gpio_set_direction(pin, GPIO_MODE_OUTPUT);
/*
bool status = 0;
while (1) {
// Set it and toggle it
gpio_set_level(pin, status);
status = !status;
// Then sleep
const int ms = 500;
const int ticks = ms / portTICK_PERIOD_MS;
vTaskDelay(ticks);
}
*/
/*
while (1) {
const int ms_in = 200;
const int ms_out = 2000;
// Set it and toggle it
for (int i = 0; i < 3; i++) {
gpio_set_level(pin, 1);
vTaskDelay(ms_in / portTICK_PERIOD_MS);
gpio_set_level(pin, 0);
vTaskDelay(ms_in / portTICK_PERIOD_MS);
}
vTaskDelay((ms_out - ms_in) / portTICK_PERIOD_MS);
}
*/
}