d_inouts.h 740 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef D_INOUTS_H
  2. #include "board.h"
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <stdlib.h>
  6. #define INOUTS_EXPAND_AS_ENUM(name, ...) name ## _,
  7. #ifdef DINS_ENABLE
  8. enum inputs_e {
  9. DI_TABLE(INOUTS_EXPAND_AS_ENUM)
  10. INPUTS_TOTAL_COUNT
  11. };
  12. extern uint8_t inputs[INPUTS_TOTAL_COUNT];
  13. bool get_inputs(uint8_t *inputs_p);
  14. uint8_t get_state_din_outs(gpio_t pin);
  15. #endif
  16. #ifdef DOUTS_ENABLE
  17. enum outputs_e {
  18. RELAYS(INOUTS_EXPAND_AS_ENUM)
  19. OUTPUTS_TOTAL_COUNT
  20. };
  21. extern uint8_t outputs[OUTPUTS_TOTAL_COUNT];
  22. bool set_outputs(uint8_t *outputs_p);
  23. void set_state_douts(gpio_t pin, uint8_t value);
  24. #endif
  25. #ifdef DINS_ENABLE || DOUTS_ENABLE
  26. void d_inouts_task(void *arg);
  27. #endif
  28. #endif /* D_INOUTS_H */