Browse Source

efElectricAgingTrendMining main.c 朱涛 commit at 2020-09-29

朱涛 4 năm trước cách đây
mục cha
commit
85547fb946
1 tập tin đã thay đổi với 70 bổ sung0 xóa
  1. 70 0
      efElectricAgingTrendMining/main.c

+ 70 - 0
efElectricAgingTrendMining/main.c

@@ -244,3 +244,73 @@ static struct gpio_keys_button yl9200_buttons[] = {
 		.code		= BTN_3,
 		.desc		= "SW3",
 		.active_low	= 1,
+		.wakeup		= 1,
+	},
+	{
+		.gpio		= AT91_PIN_PB2,
+		.code		= BTN_4,
+		.desc		= "SW4",
+		.active_low	= 1,
+		.wakeup		= 1,
+	},
+	{
+		.gpio		= AT91_PIN_PB6,
+		.code		= BTN_5,
+		.desc		= "SW5",
+		.active_low	= 1,
+		.wakeup		= 1,
+	}
+};
+
+static struct gpio_keys_platform_data yl9200_button_data = {
+	.buttons	= yl9200_buttons,
+	.nbuttons	= ARRAY_SIZE(yl9200_buttons),
+};
+
+static struct platform_device yl9200_button_device = {
+	.name		= "gpio-keys",
+	.id		= -1,
+	.num_resources	= 0,
+	.dev		= {
+		.platform_data	= &yl9200_button_data,
+	}
+};
+
+static void __init yl9200_add_device_buttons(void)
+{
+	at91_set_gpio_input(AT91_PIN_PA24, 1);	/* SW2 */
+	at91_set_deglitch(AT91_PIN_PA24, 1);
+	at91_set_gpio_input(AT91_PIN_PB1, 1);	/* SW3 */
+	at91_set_deglitch(AT91_PIN_PB1, 1);
+	at91_set_gpio_input(AT91_PIN_PB2, 1);	/* SW4 */
+	at91_set_deglitch(AT91_PIN_PB2, 1);
+	at91_set_gpio_input(AT91_PIN_PB6, 1);	/* SW5 */
+	at91_set_deglitch(AT91_PIN_PB6, 1);
+
+	/* Enable buttons (Sheet 5) */
+	at91_set_gpio_output(AT91_PIN_PB7, 1);
+
+	platform_device_register(&yl9200_button_device);
+}
+#else
+static void __init yl9200_add_device_buttons(void) {}
+#endif
+
+/*
+ * Touchscreen
+ */
+#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
+static int ads7843_pendown_state(void)
+{
+	return !at91_get_gpio_value(AT91_PIN_PB11);	/* Touchscreen PENIRQ */
+}
+
+static struct ads7846_platform_data ads_info = {
+	.model			= 7843,
+	.x_min			= 150,
+	.x_max			= 3830,
+	.y_min			= 190,
+	.y_max			= 3830,
+	.vref_delay_usecs	= 100,
+
+	/* For a 8" touch-screen */