Rework switch-assignment, Update connection-plan
Rework config.cpp and config.hpp: - different naming convention for evaluated switch objects - thus updated macros for switches - add new evalswitch instances for 4 switches on 1 adc - update switch assignment, use the 4 new inputs Update connection plan with new assignment, add stripboard details
This commit is contained in:
parent
1f53fabd19
commit
451981b165
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -3,15 +3,19 @@
|
||||
|
||||
//--- inputs ---
|
||||
//create and configure objects for evaluated switches
|
||||
gpio_evaluatedSwitch SW_START(GPIO_SW_START, true, false); //pullup true, not inverted (switch to GND, internal pullup used)
|
||||
gpio_evaluatedSwitch SW_RESET(GPIO_SW_RESET, true, false); //pullup true, not inverted (switch to GND, internal pullup used)
|
||||
gpio_evaluatedSwitch SW_SET(GPIO_SW_SET, true, false); //pullup true, not inverted (switch to GND, internal pullup used)
|
||||
gpio_evaluatedSwitch SW_PRESET1(GPIO_SW_PRESET1, true, false); //pullup true, not inverted (switch to GND, internal pullup used)
|
||||
gpio_evaluatedSwitch SW_PRESET2(GPIO_SW_PRESET2, false, true); //pullup false, INVERTED (switch to 3V3, pulldown on pcb soldered)
|
||||
gpio_evaluatedSwitch SW_PRESET3(GPIO_SW_PRESET3, false, true); //pullup false, INVERTED (switch to 3V3, pulldown on pcb soldered)
|
||||
//gpio_evaluatedSwitch sw_gpio_39(GPIO_NUM_39, false, true); //pullup false, INVERTED (switch to 3V3, pulldown on pcb soldered)
|
||||
gpio_evaluatedSwitch sw_gpio_34(GPIO_NUM_34, false, true); //pullup false, INVERTED (switch to 3V3, pulldown on pcb soldered)
|
||||
gpio_evaluatedSwitch sw_gpio_32(GPIO_NUM_32, true, false); //pullup true, not inverted (switch to GND, internal pullup used)
|
||||
gpio_evaluatedSwitch sw_gpio_33(GPIO_NUM_33, true, false); //pullup true, not inverted (switch to GND, internal pullup used)
|
||||
gpio_evaluatedSwitch sw_gpio_25(GPIO_NUM_25, true, false); //pullup true, not inverted (switch to GND, internal pullup used)
|
||||
gpio_evaluatedSwitch sw_gpio_26(GPIO_NUM_26, true, false); //pullup true, not inverted (switch to GND, internal pullup used)
|
||||
|
||||
//evaluated switch with function to obtain the current input state instead of gpio
|
||||
gpio_evaluatedSwitch SW_ADC34_0 (&switchesAnalog_getState_sw0);
|
||||
//--- switches connected to 4 sw to analog stripboard ---
|
||||
//evaluated switches with function to obtain the current input state instead of gpio
|
||||
gpio_evaluatedSwitch sw_gpio_analog_0(&switchesAnalog_getState_sw0);
|
||||
gpio_evaluatedSwitch sw_gpio_analog_1(&switchesAnalog_getState_sw1);
|
||||
gpio_evaluatedSwitch sw_gpio_analog_2(&switchesAnalog_getState_sw2);
|
||||
gpio_evaluatedSwitch sw_gpio_analog_3(&switchesAnalog_getState_sw3);
|
||||
|
||||
//create buzzer object with no gap between beep events
|
||||
buzzer_t buzzer(GPIO_BUZZER, 0);
|
||||
|
@ -23,17 +23,34 @@ extern "C" {
|
||||
|
||||
|
||||
//==================================
|
||||
//===== define input gpio pins =====
|
||||
//==== define analog input pins ====
|
||||
//==================================
|
||||
#define GPIO_SW_START GPIO_NUM_26
|
||||
#define GPIO_SW_RESET GPIO_NUM_25
|
||||
#define GPIO_SW_SET GPIO_NUM_33
|
||||
#define GPIO_SW_PRESET1 GPIO_NUM_32
|
||||
#define GPIO_SW_PRESET2 GPIO_NUM_32 //gpio 34 currently used fir testing switches-analog
|
||||
#define GPIO_SW_PRESET3 GPIO_NUM_39
|
||||
|
||||
#define GPIO_POTI GPIO_NUM_36
|
||||
#define ADC_CHANNEL_POTI ADC1_CHANNEL_0
|
||||
#define GPIO_4SW_TO_ANALOG GPIO_NUM_39
|
||||
#define ADC_CHANNEL_4SW_TO_ANALOG ADC1_CHANNEL_3 //gpio 39
|
||||
//ADC1_CHANNEL_0 gpio36
|
||||
//ADC1_CHANNEL_6 gpio_34
|
||||
//ADC1_CHANNEL_3 gpio_39
|
||||
|
||||
|
||||
//=====================================
|
||||
//==== assign switches to objects =====
|
||||
//=====================================
|
||||
//see config.cpp for available evaluated switch objects
|
||||
#define SW_START sw_gpio_26
|
||||
#define SW_RESET sw_gpio_25
|
||||
#define SW_SET sw_gpio_analog_0
|
||||
#define SW_PRESET1 sw_gpio_analog_1
|
||||
#define SW_PRESET2 sw_gpio_analog_2
|
||||
#define SW_PRESET3 sw_gpio_analog_3
|
||||
|
||||
//unused but already available evaluated inputs
|
||||
//#define ? sw_gpio_33
|
||||
//#define ? sw_gpio_32
|
||||
//#define ? sw_gpio_34
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------
|
||||
@ -72,18 +89,21 @@ extern "C" {
|
||||
//===== global variables =====
|
||||
//============================
|
||||
//create global evaluated switch objects
|
||||
//--- inputs ---
|
||||
//create objects for switches at bottom screw temerinals
|
||||
extern gpio_evaluatedSwitch SW_START;
|
||||
extern gpio_evaluatedSwitch SW_RESET;
|
||||
extern gpio_evaluatedSwitch SW_SET;
|
||||
extern gpio_evaluatedSwitch SW_PRESET1;
|
||||
extern gpio_evaluatedSwitch SW_PRESET2;
|
||||
extern gpio_evaluatedSwitch SW_PRESET3;
|
||||
//--- switches on digital gpio pins ---
|
||||
//extern gpio_evaluatedSwitch sw_gpio_39;
|
||||
extern gpio_evaluatedSwitch sw_gpio_34;
|
||||
extern gpio_evaluatedSwitch sw_gpio_32;
|
||||
extern gpio_evaluatedSwitch sw_gpio_33;
|
||||
extern gpio_evaluatedSwitch sw_gpio_25;
|
||||
extern gpio_evaluatedSwitch sw_gpio_26;
|
||||
|
||||
//--- switches connected to 4-sw-to-analog stripboard ---
|
||||
extern gpio_evaluatedSwitch sw_gpio_analog_0;
|
||||
extern gpio_evaluatedSwitch sw_gpio_analog_1;
|
||||
extern gpio_evaluatedSwitch sw_gpio_analog_2;
|
||||
extern gpio_evaluatedSwitch sw_gpio_analog_3;
|
||||
|
||||
|
||||
|
||||
extern gpio_evaluatedSwitch SW_ADC34_0;
|
||||
|
||||
//create global buzzer object
|
||||
extern buzzer_t buzzer;
|
||||
|
@ -82,21 +82,12 @@ extern "C" void app_main()
|
||||
esp_log_level_set("buzzer", ESP_LOG_ERROR);
|
||||
esp_log_level_set("control", ESP_LOG_INFO);
|
||||
|
||||
// //create task for controlling the machine
|
||||
// xTaskCreate(task_control, "task_control", configMINIMAL_STACK_SIZE * 3, NULL, 5, NULL);
|
||||
// //create task for handling the buzzer
|
||||
// xTaskCreate(&task_buzzer, "task_buzzer", 2048, NULL, 2, NULL);
|
||||
//create task for controlling the machine
|
||||
xTaskCreate(task_control, "task_control", configMINIMAL_STACK_SIZE * 3, NULL, 5, NULL);
|
||||
//create task for handling the buzzer
|
||||
xTaskCreate(&task_buzzer, "task_buzzer", 2048, NULL, 2, NULL);
|
||||
|
||||
//beep at startup
|
||||
buzzer.beep(3, 70, 50);
|
||||
|
||||
while(1){
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
SW_ADC34_0.handle();
|
||||
|
||||
switchesAnalog_getState(0);
|
||||
if (SW_ADC34_0.risingEdge){
|
||||
printf("rising edge detected\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user