123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #ifndef __MUX_H
- #define __MUX_H
- #include <stdbool.h>
- //
- #define LED_NUMBER 28
- #define LINE_0_SET GPIOE->scr = GPIO_PINS_3
- #define LINE_0_RESET GPIOE->clr = GPIO_PINS_3
- #define LINE_1_SET GPIOE->scr = GPIO_PINS_2
- #define LINE_1_RESET GPIOE->clr = GPIO_PINS_2
- #define LINE_2_SET GPIOB->scr = GPIO_PINS_9
- #define LINE_2_RESET GPIOB->clr = GPIO_PINS_9
- #define COL_1_SET GPIOD->scr = GPIO_PINS_6
- #define COL_1_RESET GPIOD->clr = GPIO_PINS_6
- #define COL_2_SET GPIOD->scr = GPIO_PINS_7
- #define COL_2_RESET GPIOD->clr = GPIO_PINS_7
- #define COL_3_SET GPIOB->scr = GPIO_PINS_6
- #define COL_3_RESET GPIOB->clr = GPIO_PINS_6
- #define COL_4_SET GPIOB->scr = GPIO_PINS_7
- #define COL_4_RESET GPIOB->clr = GPIO_PINS_7
- typedef enum
- {
- INP_1 = 0,
- INP_2,
- INP_3,
- INP_4,
-
- INP_5,
- INP_6,
- INP_7,
- INP_8,
-
- OUT_1_G,
- OUT_2_G,
- OUT_3_G,
- OUT_4_G,
-
- OUT_1_R,
- OUT_2_R,
- OUT_3_R,
- OUT_4_R,
-
- STATUS_G,
- STATUS_R,
- RX_G,
- TX_R,
-
- OUT_5_R,
- OUT_6_R,
- OUT_7_R,
- OUT_8_R,
-
- OUT_5_G,
- OUT_6_G,
- OUT_7_G,
- OUT_8_G,
-
- } led_t;
- typedef enum
- {
- LED_OFF = 0,
- LED_ON,
- LED_BLINK,
-
- } led_state_t;
- typedef struct
- {
- led_t name;
- uint8_t line[3]; // [line_0, line_1, line_2]
- led_state_t state;
- uint32_t cnt;
-
- } mux_channel_t;
- //
- void mux_led_init(mux_channel_t *ch);
- //
- void mux_gpio_init(void);
- //
- void mux_led_proc(void);
- //
- void mux_led_blink(void);
- //
- void mux_led_test_init(void);
- //
- void mux_led_test_toggle(void);
- //
- void mux_led_status(bool state);
- extern mux_channel_t leds[];
- #endif // __MUX_H
|