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.

35 lines
1.5 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <stdio.h>
  5. #include "tim.h"
  6. #include "usart.h"
  7. #include "zboard.h"
  8. #define GPIO_SET(port, pin, mirror, _state) \
  9. HAL_GPIO_WritePin(GPIO##port, GPIO_PIN_##pin, mirror _state ? GPIO_PIN_SET : GPIO_PIN_RESET);
  10. #define GPIO_GET(port, pin, mirror) (mirror(HAL_GPIO_ReadPin(GPIO##port, GPIO_PIN_##pin) == GPIO_PIN_SET))
  11. /***********************************************************************************************************************
  12. * ========================================================================================================= *
  13. ***********************************************************************************************************************/
  14. void port_do_debug_light_state(void);
  15. /***********************************************************************************************************************
  16. * =======================================================UART======================================================== *
  17. ***********************************************************************************************************************/
  18. typedef struct {
  19. UART_HandleTypeDef* uarthandler;
  20. uint8_t rxbuf;
  21. } uart_t;
  22. void port_mock_on_uart_rx(uart_t* uart);
  23. void port_uart_start_all_uart_receive(void);
  24. bool port_electric_relay_get_state(int relayindex);
  25. void port_electric_relay_set_state(int relayindex, bool state);
  26. static inline bool port_get_gpio_int(int index) {
  27. return false;
  28. }