|
@@ -0,0 +1,70 @@
|
|
|
+#ifndef __MUX_H
|
|
|
+#define __MUX_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
|
|
|
+{
|
|
|
+ LED_OFF = 0,
|
|
|
+ LED_ON,
|
|
|
+ LED_BLINK,
|
|
|
+
|
|
|
+} led_state_t;
|
|
|
+
|
|
|
+
|
|
|
+typedef struct
|
|
|
+{
|
|
|
+ char label[8];
|
|
|
+ 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);
|
|
|
+
|
|
|
+
|
|
|
+#endif // __MUX_H
|
|
|
+
|