You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zavlaha-kzk/src/app_io.c

31 lines
588 B

/**
* TODO file description
*/
#include <stdbool.h>
#include <hardware/gpio.h>
#include <hardware/adc.h>
#include "app_io.h"
#include "pinout.h"
void set_relays(bool one, bool two, bool three, bool four) {
gpio_put(PIN_RE1, one);
gpio_put(PIN_RE2, two);
gpio_put(PIN_RE3, three);
gpio_put(PIN_RE1, four);
}
void open_valve(uint8_t num) {
gpio_put(PIN_RE1, num == 1);
gpio_put(PIN_RE2, num == 2);
gpio_put(PIN_RE3, num == 3);
gpio_put(PIN_RE4, num == 4);
}
uint16_t moisture_read() {
adc_select_input(ADC_NUM_MOISTURE);
return adc_read();
}