42 lines
722 B
C
42 lines
722 B
C
#include <stdio.h>
|
|
|
|
#include "driver/gpio.h"
|
|
#include "esp_log.h"
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "freertos/portmacro.h"
|
|
|
|
#include "resistor_ranges.h"
|
|
|
|
#define TAG "main"
|
|
|
|
enum ranges {R1, R10, R100, R_NUM};
|
|
|
|
resistor_range ranges[] = {
|
|
[R1] = {
|
|
.pin = GPIO_NUM_6,
|
|
.resistance = 1,
|
|
},
|
|
[R10] = {
|
|
.pin = GPIO_NUM_7,
|
|
.resistance = 10,
|
|
},
|
|
[R100] = {
|
|
.pin = GPIO_NUM_NC,
|
|
.resistance = 100,
|
|
},
|
|
};
|
|
|
|
unsigned int r_ind = 0;
|
|
|
|
void app_main(void){
|
|
set_resistor_gpio(ranges, R100);
|
|
|
|
while(1){
|
|
ESP_LOGI(TAG, "RANGE : %d", r_ind);
|
|
activate_range(ranges, r_ind, R100);
|
|
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
|
r_ind = (r_ind + 1) % R_NUM;
|
|
}
|
|
}
|