Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
esp32 freertos ring oscillator benchmark
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "nvs_flash.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
#define IN_GPIO 13
#define OUT_GPIO 14
void ring_oscillator(void *pvParameter)
{
gpio_pad_select_gpio(IN_GPIO);
gpio_pad_select_gpio(OUT_GPIO);
gpio_set_direction(IN_GPIO, GPIO_MODE_INPUT);
gpio_set_direction(OUT_GPIO, GPIO_MODE_OUTPUT);
while(1) {
gpio_set_level(OUT_GPIO, 1-gpio_get_level(IN_GPIO));
}
}
void app_main()
{
nvs_flash_init();
xTaskCreate(&ring_oscillator, "ring_oscillator", 512, NULL, 5, NULL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment