Skip to content

Instantly share code, notes, and snippets.

@tomerweller
Created November 29, 2016 06:34
Show Gist options
  • Save tomerweller/7f9f202858cb064c84722c72f6c20aee to your computer and use it in GitHub Desktop.
Save tomerweller/7f9f202858cb064c84722c72f6c20aee to your computer and use it in GitHub Desktop.
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