VisualMicro Hack for MS Visual Studio to use freeRTOS esp-idf on ESP32

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

VisualMicro Hack for MS Visual Studio to use freeRTOS esp-idf on ESP32

Postby Deouss » Sat May 26, 2018 6:19 pm

Here is a process that is more like a hack but it simply allows to use Visual Studio with Espressif IoT framework

Steps:

1) Go to https://www.visualmicro.com/, download and install VisualMicro Extension

Image

2) Verify and update the extension from the list

Image

3) Create a new Arduino Project in Visual Studio
Note: Ignore the .ino file that opens right after
Do not delethe the .ino file

Image

4) Expand Solution Explorer and right-click on 'Source Files' then -> Add -> New Item -> c++ File(.cpp)
Name the new file main.cpp - this is mandatory

Image

5) Place the following code into that file
Note - this is a simple blink example to test

Code: Select all

#undef CONFIG_AUTOSTART_ARDUINO

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"

#define BLINK_GPIO (gpio_num_t)2

extern "C" void app_main()
{
	gpio_pad_select_gpio(BLINK_GPIO);
	gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
	while (1) {
		/* Blink off (output low) */
		gpio_set_level(BLINK_GPIO, 0);
		vTaskDelay(100 / portTICK_PERIOD_MS);
		/* Blink on (output high) */
		gpio_set_level(BLINK_GPIO, 1);
		vTaskDelay(100 / portTICK_PERIOD_MS);
	}
}
6) Enjoy using freeRTOS Espressif esp-idf framework ;)

Note: It is probably possible to mix Arduino code with RTOS - needs testing

Who is online

Users browsing this forum: Google [Bot] and 135 guests