mux.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef __MUX_H
  2. #define __MUX_H
  3. //
  4. #define LED_NUMBER 28
  5. #define LINE_0_SET GPIOE->scr = GPIO_PINS_3
  6. #define LINE_0_RESET GPIOE->clr = GPIO_PINS_3
  7. #define LINE_1_SET GPIOE->scr = GPIO_PINS_2
  8. #define LINE_1_RESET GPIOE->clr = GPIO_PINS_2
  9. #define LINE_2_SET GPIOB->scr = GPIO_PINS_9
  10. #define LINE_2_RESET GPIOB->clr = GPIO_PINS_9
  11. #define COL_1_SET GPIOD->scr = GPIO_PINS_6
  12. #define COL_1_RESET GPIOD->clr = GPIO_PINS_6
  13. #define COL_2_SET GPIOD->scr = GPIO_PINS_7
  14. #define COL_2_RESET GPIOD->clr = GPIO_PINS_7
  15. #define COL_3_SET GPIOB->scr = GPIO_PINS_6
  16. #define COL_3_RESET GPIOB->clr = GPIO_PINS_6
  17. #define COL_4_SET GPIOB->scr = GPIO_PINS_7
  18. #define COL_4_RESET GPIOB->clr = GPIO_PINS_7
  19. typedef enum
  20. {
  21. LED_OFF = 0,
  22. LED_ON,
  23. LED_BLINK,
  24. } led_state_t;
  25. typedef struct
  26. {
  27. char label[8];
  28. uint8_t line[3]; // [line_0, line_1, line_2]
  29. led_state_t state;
  30. uint32_t cnt;
  31. } mux_channel_t;
  32. //
  33. void mux_led_init(mux_channel_t *ch);
  34. //
  35. void mux_gpio_init(void);
  36. //
  37. void mux_led_proc(void);
  38. //
  39. void mux_led_blink(void);
  40. //
  41. void mux_led_test_init(void);
  42. //
  43. void mux_led_test_toggle(void);
  44. #endif // __MUX_H