Skip to content

Instantly share code, notes, and snippets.

@jadonk jadonk/PB-simplegaming.dts
Last active Jan 15, 2018

Embed
What would you like to do?
device_video_clock 0-100/0-100/0-100
debug_crash no
debug_rawsound no
debug_speedmark no
device_alsa_device default
device_alsa_mixer channel
device_color_bgr15 yes
device_color_bgr16 yes
device_color_bgr24 yes
device_color_bgr32 yes
device_color_bgr8 yes
device_color_palette8 yes
device_color_yuy2 yes
device_dpi_pclock_low 31250000
device_hdmi_pclock_low 0
device_joystick auto
device_keyboard auto
device_mouse none
device_raw_firstkeyhack no
device_raw_mousedev[0] auto
device_raw_mousedev[1] auto
device_raw_mousedev[2] auto
device_raw_mousedev[3] auto
device_raw_mousetype[0] pnp
device_raw_mousetype[1] pnp
device_raw_mousetype[2] pnp
device_raw_mousetype[3] pnp
device_sdl_samples 512
device_sound auto
device_video fb
device_video_cursor auto
device_video_doublescan yes
device_video_fastchange no
device_video_interlace yes
device_video_output auto
device_video_overlaysize auto
device_video_singlescan yes
dir_artwork /home/debian/.advance/artwork:/usr/local/share/advance/artwork
dir_diff /home/debian/.advance/diff
dir_hi /home/debian/.advance/hi
dir_image /home/debian/.advance/image:/usr/local/share/advance/image
dir_inp /home/debian/.advance/inp
dir_memcard /home/debian/.advance/memcard
dir_nvram /home/debian/.advance/nvram
dir_rom /home/debian/.advance/rom:/usr/local/share/advance/rom
dir_sample /home/debian/.advance/sample:/usr/local/share/advance/sample
dir_snap /home/debian/.advance/snap
dir_sta /home/debian/.advance/sta
display_adjust none
display_antialias yes
display_artwork_backdrop yes
display_artwork_bezel no
display_artwork_crop yes
display_artwork_overlay yes
display_aspect auto
display_beam 1
display_brightness 1
display_buffer no
display_color auto
display_expand 1.25
display_flicker 0
display_flipx no
display_flipy no
display_frameskip auto
display_gamma 1
display_intensity 1.5
display_interlaceeffect none
display_magnify auto
display_magnifysize 640
display_mode auto
display_pausebrightness 1
display_resize fractional
display_resizeeffect auto
display_restore yes
display_rgbeffect none
display_rol no
display_ror no
display_scanlines no
display_skipcolumns auto
display_skiplines auto
display_translucency yes
display_vsync yes
include
input_hotkey yes
input_idleexit 0
input_map[event10] auto
input_map[event11] auto
input_map[event12] auto
input_map[event13] auto
input_map[event14] auto
input_map[event1] auto
input_map[event2] auto
input_map[event3] auto
input_map[event4] auto
input_map[event5] auto
input_map[event6] auto
input_map[event7] auto
input_map[event8] auto
input_map[event9] auto
input_map[p1_dialx] auto
input_map[p1_dialy] auto
input_map[p1_lightgunx] auto
input_map[p1_lightguny] auto
input_map[p1_mousex] auto
input_map[p1_mousey] auto
input_map[p1_paddlex] auto
input_map[p1_paddley] auto
input_map[p1_pedalbrake] auto
input_map[p1_pedalgas] auto
input_map[p1_pedalother] auto
input_map[p1_stickx] auto
input_map[p1_sticky] auto
input_map[p1_stickz] auto
input_map[p1_trackballx] auto
input_map[p1_trackbally] auto
input_map[p2_dialx] auto
input_map[p2_dialy] auto
input_map[p2_lightgunx] auto
input_map[p2_lightguny] auto
input_map[p2_mousex] auto
input_map[p2_mousey] auto
input_map[p2_paddlex] auto
input_map[p2_paddley] auto
input_map[p2_pedalbrake] auto
input_map[p2_pedalgas] auto
input_map[p2_pedalother] auto
input_map[p2_stickx] auto
input_map[p2_sticky] auto
input_map[p2_stickz] auto
input_map[p2_trackballx] auto
input_map[p2_trackbally] auto
input_map[p3_dialx] auto
input_map[p3_dialy] auto
input_map[p3_lightgunx] auto
input_map[p3_lightguny] auto
input_map[p3_mahjong_a] auto
input_map[p3_mahjong_b] auto
input_map[p3_mahjong_bet] auto
input_map[p3_mahjong_c] auto
input_map[p3_mahjong_chance] auto
input_map[p3_mahjong_chi] auto
input_map[p3_mahjong_d] auto
input_map[p3_mahjong_double_up] auto
input_map[p3_mahjong_e] auto
input_map[p3_mahjong_f] auto
input_map[p3_mahjong_flip_flop] auto
input_map[p3_mahjong_g] auto
input_map[p3_mahjong_h] auto
input_map[p3_mahjong_i] auto
input_map[p3_mahjong_j] auto
input_map[p3_mahjong_k] auto
input_map[p3_mahjong_kan] auto
input_map[p3_mahjong_l] auto
input_map[p3_mahjong_m] auto
input_map[p3_mahjong_n] auto
input_map[p3_mahjong_pon] auto
input_map[p3_mahjong_reach] auto
input_map[p3_mahjong_ron] auto
input_map[p3_mahjong_score] auto
input_map[p3_mousex] auto
input_map[p3_mousey] auto
input_map[p3_paddlex] auto
input_map[p3_paddley] auto
input_map[p3_pedalbrake] auto
input_map[p3_pedalgas] auto
input_map[p3_pedalother] auto
input_map[p3_stickx] auto
input_map[p3_sticky] auto
input_map[p3_stickz] auto
input_map[p3_trackballx] auto
input_map[p3_trackbally] auto
input_map[p4_dialx] auto
input_map[p4_dialy] auto
input_map[p4_lightgunx] auto
input_map[p4_lightguny] auto
input_map[p4_mahjong_a] auto
input_map[p4_mahjong_b] auto
input_map[p4_mahjong_bet] auto
input_map[p4_mahjong_c] auto
input_map[p4_mahjong_chance] auto
input_map[p4_mahjong_chi] auto
input_map[p4_mahjong_d] auto
input_map[p4_mahjong_double_up] auto
input_map[p4_mahjong_e] auto
input_map[p4_mahjong_f] auto
input_map[p4_mahjong_flip_flop] auto
input_map[p4_mahjong_g] auto
input_map[p4_mahjong_h] auto
input_map[p4_mahjong_i] auto
input_map[p4_mahjong_j] auto
input_map[p4_mahjong_k] auto
input_map[p4_mahjong_kan] auto
input_map[p4_mahjong_l] auto
input_map[p4_mahjong_m] auto
input_map[p4_mahjong_n] auto
input_map[p4_mahjong_pon] auto
input_map[p4_mahjong_reach] auto
input_map[p4_mahjong_ron] auto
input_map[p4_mahjong_score] auto
input_map[p4_mousex] auto
input_map[p4_mousey] auto
input_map[p4_paddlex] auto
input_map[p4_paddley] auto
input_map[p4_pedalbrake] auto
input_map[p4_pedalgas] auto
input_map[p4_pedalother] auto
input_map[p4_stickx] auto
input_map[p4_sticky] auto
input_map[p4_stickz] auto
input_map[p4_trackballx] auto
input_map[p4_trackbally] auto
input_map[p5_dialx] auto
input_map[p5_dialy] auto
input_map[p5_lightgunx] auto
input_map[p5_lightguny] auto
input_map[p5_mahjong_a] auto
input_map[p5_mahjong_b] auto
input_map[p5_mahjong_bet] auto
input_map[p5_mahjong_c] auto
input_map[p5_mahjong_chance] auto
input_map[p5_mahjong_chi] auto
input_map[p5_mahjong_d] auto
input_map[p5_mahjong_double_up] auto
input_map[p5_mahjong_e] auto
input_map[p5_mahjong_f] auto
input_map[p5_mahjong_flip_flop] auto
input_map[p5_mahjong_g] auto
input_map[p5_mahjong_h] auto
input_map[p5_mahjong_i] auto
input_map[p5_mahjong_j] auto
input_map[p5_mahjong_k] auto
input_map[p5_mahjong_kan] auto
input_map[p5_mahjong_l] auto
input_map[p5_mahjong_m] auto
input_map[p5_mahjong_n] auto
input_map[p5_mahjong_pon] auto
input_map[p5_mahjong_reach] auto
input_map[p5_mahjong_ron] auto
input_map[p5_mahjong_score] auto
input_map[p5_mousex] auto
input_map[p5_mousey] auto
input_map[p5_paddlex] auto
input_map[p5_paddley] auto
input_map[p5_pedalbrake] auto
input_map[p5_pedalgas] auto
input_map[p5_pedalother] auto
input_map[p5_stickx] auto
input_map[p5_sticky] auto
input_map[p5_stickz] auto
input_map[p5_trackballx] auto
input_map[p5_trackbally] auto
input_map[p6_dialx] auto
input_map[p6_dialy] auto
input_map[p6_lightgunx] auto
input_map[p6_lightguny] auto
input_map[p6_mahjong_a] auto
input_map[p6_mahjong_b] auto
input_map[p6_mahjong_bet] auto
input_map[p6_mahjong_c] auto
input_map[p6_mahjong_chance] auto
input_map[p6_mahjong_chi] auto
input_map[p6_mahjong_d] auto
input_map[p6_mahjong_double_up] auto
input_map[p6_mahjong_e] auto
input_map[p6_mahjong_f] auto
input_map[p6_mahjong_flip_flop] auto
input_map[p6_mahjong_g] auto
input_map[p6_mahjong_h] auto
input_map[p6_mahjong_i] auto
input_map[p6_mahjong_j] auto
input_map[p6_mahjong_k] auto
input_map[p6_mahjong_kan] auto
input_map[p6_mahjong_l] auto
input_map[p6_mahjong_m] auto
input_map[p6_mahjong_n] auto
input_map[p6_mahjong_pon] auto
input_map[p6_mahjong_reach] auto
input_map[p6_mahjong_ron] auto
input_map[p6_mahjong_score] auto
input_map[p6_mousex] auto
input_map[p6_mousey] auto
input_map[p6_paddlex] auto
input_map[p6_paddley] auto
input_map[p6_pedalbrake] auto
input_map[p6_pedalgas] auto
input_map[p6_pedalother] auto
input_map[p6_stickx] auto
input_map[p6_sticky] auto
input_map[p6_stickz] auto
input_map[p6_trackballx] auto
input_map[p6_trackbally] auto
input_map[p7_dialx] auto
input_map[p7_dialy] auto
input_map[p7_lightgunx] auto
input_map[p7_lightguny] auto
input_map[p7_mahjong_a] auto
input_map[p7_mahjong_b] auto
input_map[p7_mahjong_bet] auto
input_map[p7_mahjong_c] auto
input_map[p7_mahjong_chance] auto
input_map[p7_mahjong_chi] auto
input_map[p7_mahjong_d] auto
input_map[p7_mahjong_double_up] auto
input_map[p7_mahjong_e] auto
input_map[p7_mahjong_f] auto
input_map[p7_mahjong_flip_flop] auto
input_map[p7_mahjong_g] auto
input_map[p7_mahjong_h] auto
input_map[p7_mahjong_i] auto
input_map[p7_mahjong_j] auto
input_map[p7_mahjong_k] auto
input_map[p7_mahjong_kan] auto
input_map[p7_mahjong_l] auto
input_map[p7_mahjong_m] auto
input_map[p7_mahjong_n] auto
input_map[p7_mahjong_pon] auto
input_map[p7_mahjong_reach] auto
input_map[p7_mahjong_ron] auto
input_map[p7_mahjong_score] auto
input_map[p7_mousex] auto
input_map[p7_mousey] auto
input_map[p7_paddlex] auto
input_map[p7_paddley] auto
input_map[p7_pedalbrake] auto
input_map[p7_pedalgas] auto
input_map[p7_pedalother] auto
input_map[p7_stickx] auto
input_map[p7_sticky] auto
input_map[p7_stickz] auto
input_map[p7_trackballx] auto
input_map[p7_trackbally] auto
input_map[p8_dialx] auto
input_map[p8_dialy] auto
input_map[p8_lightgunx] auto
input_map[p8_lightguny] auto
input_map[p8_mahjong_a] auto
input_map[p8_mahjong_b] auto
input_map[p8_mahjong_bet] auto
input_map[p8_mahjong_c] auto
input_map[p8_mahjong_chance] auto
input_map[p8_mahjong_chi] auto
input_map[p8_mahjong_d] auto
input_map[p8_mahjong_double_up] auto
input_map[p8_mahjong_e] auto
input_map[p8_mahjong_f] auto
input_map[p8_mahjong_flip_flop] auto
input_map[p8_mahjong_g] auto
input_map[p8_mahjong_h] auto
input_map[p8_mahjong_i] auto
input_map[p8_mahjong_j] auto
input_map[p8_mahjong_k] auto
input_map[p8_mahjong_kan] auto
input_map[p8_mahjong_l] auto
input_map[p8_mahjong_m] auto
input_map[p8_mahjong_n] auto
input_map[p8_mahjong_pon] auto
input_map[p8_mahjong_reach] auto
input_map[p8_mahjong_ron] auto
input_map[p8_mahjong_score] auto
input_map[p8_mousex] auto
input_map[p8_mousey] auto
input_map[p8_paddlex] auto
input_map[p8_paddley] auto
input_map[p8_pedalbrake] auto
input_map[p8_pedalgas] auto
input_map[p8_pedalother] auto
input_map[p8_stickx] auto
input_map[p8_sticky] auto
input_map[p8_stickz] auto
input_map[p8_trackballx] auto
input_map[p8_trackbally] auto
input_map[safequit] auto
input_map[service_coin5] auto
input_map[service_coin6] auto
input_map[service_coin7] auto
input_map[service_coin8] auto
input_map[ui_toggle_ui] auto
input_steadykey no
lcd_server none
lcd_speed 4
lcd_timeout 500
misc_bios default
misc_cheat no
misc_cheatfile cheat.dat
misc_difficulty none
misc_eventdebug no
misc_eventfile event.dat
misc_freeplay no
misc_hiscorefile hiscore.dat
misc_lang none
misc_languagefile english.lng
misc_mutedemo no
misc_quiet yes
misc_safequit yes
misc_smp yes
misc_timetorun 0
record_sound no
record_sound_time 15
record_video no
record_video_interleave 2
record_video_time 15
script_coin1
script_coin2
script_coin3
script_coin4
script_emulation
script_event1
script_event10
script_event11
script_event12
script_event13
script_event14
script_event2
script_event3
script_event4
script_event5
script_event6
script_event7
script_event8
script_event9
script_knocker on(kdb, 0b100); wait(!event()); off(kdb, 0b100);
script_led1 on(kdb, 0b1); wait(!event()); off(kdb, 0b1);
script_led2 on(kdb, 0b10); wait(!event()); off(kdb, 0b10);
script_led3
script_play
script_safequit
script_start1
script_start2
script_start3
script_start4
script_turbo while (event()) { toggle(kdb, 0b100); delay(100); } off(kdb, 0b100);
script_video wait(!event()); set(kdb, 0);
sound_adjust auto
sound_equalizer_highvolume 0
sound_equalizer_lowvolume 0
sound_equalizer_midvolume 0
sound_latency 0.05
sound_mode auto
sound_normalize yes
sound_samplerate 44100
sound_samples yes
sound_volume -3
sync_fps auto
sync_resample auto
sync_speed 1
sync_startuptime auto
sync_turbospeed 3
ui_color[help_other] 000000 808080
ui_color[help_p1] 000000 ffff00
ui_color[help_p2] 000000 00ff00
ui_color[help_p3] 000000 ff0000
ui_color[help_p4] 000000 00ffff
ui_color[interface] 000000 ffffff
ui_color[select] 000000 afffff
ui_color[tag] 247ef0 ffffff
ui_font auto
ui_fontsize auto
ui_helpimage auto
ui_translucency 0.8
device_video_modeline generate 1.512 112 112 128 144 160 163 164 175 -hsync -vsync
device_video_modeline generate 1.512 112 112 128 144 160 163 164 175 -hsync -vsync
device_video_modeline generate 1.512 112 112 128 144 160 163 164 175 -hsync -vsync
[Unit]
Description=ADVMAME
After=systemd-user-sessions.service
After=rc-local.service
IgnoreOnIsolate=yes
[Service]
#User=debian
ExecStart=/home/debian/advmame.sh
Type=idle
Restart=always
RestartSec=10
UtmpIdentifier=tty1
TTYPath=/dev/tty1
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION= FRAMEBUFFER=/dev/fb0 HOME=/home/debian
[Install]
WantedBy=multi-user.target
#!/bin/sh
/var/lib/cloud9/test_buttons.sh
/usr/local/bin/advmame circus
#/bin/bash
sudo modprobe fbtft_device name=adafruit18 busnum=2 cs=1 rotate=270 gpios=reset:86,dc:45
sudo systemctl stop getty@tty1.service
sudo rm /dev/tty
sudo ln -s /dev/tty1 /dev/tty
sudo chmod go+rw /dev/tty1
/*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/interrupt-controller/irq.h>
/ {
/*
* Free up the pins used by the cape from the pinmux helpers.
*/
fragment@0 {
target = <&ocp>;
__overlay__ {
P1_04_pinmux { status = "disabled"; }; /* LEDs - left */
P2_03_pinmux { status = "disabled"; }; /* LEDs - right */
P1_06_pinmux { status = "disabled"; }; /* LCD - CS */
P1_08_pinmux { status = "disabled"; }; /* LCD - SCLK */
P1_10_pinmux { status = "disabled"; }; /* LCD - MISO */
P1_12_pinmux { status = "disabled"; }; /* LCD - MOSI */
P2_01_pinmux { status = "disabled"; }; /* LCD - LED */
P2_17_pinmux { status = "disabled"; }; /* LCD - DC */
P2_19_pinmux { status = "disabled"; }; /* LCD - RST */
P2_02_pinmux { status = "disabled"; }; /* keys - down */
P2_04_pinmux { status = "disabled"; }; /* keys - right */
P2_06_pinmux { status = "disabled"; }; /* keys - up */
P2_08_pinmux { status = "disabled"; }; /* keys - left */
P2_18_pinmux { status = "disabled"; }; /* keys - enter */
P2_20_pinmux { status = "disabled"; }; /* keys - one */
P2_22_pinmux { status = "disabled"; }; /* keys - esc */
P2_24_pinmux { status = "disabled"; }; /* keys - five */
};
};
/*
* Free up the gpios used by the cape-universal gpio helpers.
*/
fragment@1 {
target = <&ocp>;
__overlay__ {
cape-universal { status = "disabled"; };
};
};
/*
* Make a new set of gpio helpers.
*/
fragment@2 {
target = <&ocp>;
__overlay__ {
cape-universal@1 {
compatible = "gpio-of-helper";
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <>;
P1_02 {
gpio-name = "P1_02";
gpio = <&gpio2 23 0>;
input;
dir-changeable;
};
P1_20 {
gpio-name = "P1_20";
gpio = <&gpio0 20 0>;
input;
dir-changeable;
};
P1_26 {
gpio-name = "P1_26";
gpio = <&gpio0 12 0>;
input;
dir-changeable;
};
P1_28 {
gpio-name = "P1_28";
gpio = <&gpio0 13 0>;
input;
dir-changeable;
};
P1_29 {
gpio-name = "P1_29";
gpio = <&gpio3 21 0>;
input;
dir-changeable;
};
P1_30 {
gpio-name = "P1_30";
gpio = <&gpio1 11 0>;
input;
dir-changeable;
};
P1_31 {
gpio-name = "P1_31";
gpio = <&gpio3 18 0>;
input;
dir-changeable;
};
P1_32 {
gpio-name = "P1_32";
gpio = <&gpio1 10 0>;
input;
dir-changeable;
};
P1_33 {
gpio-name = "P1_33";
gpio = <&gpio3 15 0>;
input;
dir-changeable;
};
P1_34 {
gpio-name = "P1_34";
gpio = <&gpio0 26 0>;
input;
dir-changeable;
};
P1_35 {
gpio-name = "P1_35";
gpio = <&gpio2 24 0>;
input;
dir-changeable;
};
P1_36 {
gpio-name = "P1_36";
gpio = <&gpio3 14 0>;
input;
dir-changeable;
};
P2_05 {
gpio-name = "P2_05";
gpio = <&gpio0 30 0>;
input;
dir-changeable;
};
P2_07 {
gpio-name = "P2_07";
gpio = <&gpio0 31 0>;
input;
dir-changeable;
};
P2_09 {
gpio-name = "P2_09";
gpio = <&gpio0 15 0>;
input;
dir-changeable;
};
P2_10 {
gpio-name = "P2_10";
gpio = <&gpio1 20 0>;
input;
dir-changeable;
};
P2_11 {
gpio-name = "P2_11";
gpio = <&gpio0 14 0>;
input;
dir-changeable;
};
P2_25 {
gpio-name = "P2_25";
gpio = <&gpio1 9 0>;
input;
dir-changeable;
};
P2_27 {
gpio-name = "P2_27";
gpio = <&gpio1 8 0>;
input;
dir-changeable;
};
P2_28 {
gpio-name = "P2_28";
gpio = <&gpio3 20 0>;
input;
dir-changeable;
};
P2_29 {
gpio-name = "P2_29";
gpio = <&gpio0 7 0>;
input;
dir-changeable;
};
P2_30 {
gpio-name = "P2_30";
gpio = <&gpio3 17 0>;
input;
dir-changeable;
};
P2_31 {
gpio-name = "P2_31";
gpio = <&gpio0 19 0>;
input;
dir-changeable;
};
P2_32 {
gpio-name = "P2_32";
gpio = <&gpio3 16 0>;
input;
dir-changeable;
};
P2_33 {
gpio-name = "P2_33";
gpio = <&gpio1 13 0>;
input;
dir-changeable;
};
P2_34 {
gpio-name = "P2_34";
gpio = <&gpio3 19 0>;
input;
dir-changeable;
};
P2_35 {
gpio-name = "P2_35";
gpio = <&gpio2 22 0>;
input;
dir-changeable;
};
};
};
};
/*
* Free up the SPI port used by the cape and reallocate it for the LCD.
*/
fragment@3 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
channel@0 {
status = "disabled";
};
channel@1 {
status = "disabled";
};
adafruit18: adafruit18@0{
compatible = "sitronix,st7735r";
pinctrl-names = "default";
pinctrl-0 = <
&P1_06_spi_cs_pin /* CS */
&P1_08_spi_sclk_pin /* SCLK */
&P1_10_spi_pin /* MISO */
&P1_12_spi_pin /* MOSI */
&P2_19_gpio_pin /* RST */
&P2_17_gpio_pin /* DC */
&P2_01_gpio_pin /* LED */
>;
reg = <0>;
buswidth = <8>;
reset-gpios = <&gpio0 27 0>;
dc-gpios = <&gpio2 1 0>;
led-gpios = <&gpio1 18 1>;
debug = <1>;
spi-max-frequency = <32000000>;
rotate = <0>;
bgr;
fps = <30>;
};
};
};
/*
* Load the drivers for the buttons and LEDs.
*/
fragment@4 {
target-path="/";
__overlay__ {
gpio-keys {
compatible = "gpio-keys";
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <
&P2_02_gpio_pu_pin /* down */
&P2_04_gpio_pu_pin /* right */
&P2_06_gpio_pu_pin /* up */
&P2_08_gpio_pu_pin /* left */
&P2_18_gpio_pu_pin /* enter */
&P2_20_gpio_pu_pin /* one */
&P2_22_gpio_pu_pin /* esc */
&P2_24_gpio_pu_pin /* five */
>;
left {
label = "left";
linux,code = <105>;
gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
};
right {
label = "right";
linux,code = <106>;
gpios = <&gpio1 26 GPIO_ACTIVE_LOW>;
};
up {
label = "up";
linux,code = <103>;
gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
};
down {
label = "down";
linux,code = <108>;
gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
};
five {
label = "five";
linux,code = <6>;
gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
};
one {
label = "one";
linux,code = <2>;
gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
};
esc {
label = "esc";
linux,code = <1>;
gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
};
enter {
label = "enter";
linux,code = <28>;
gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
};
};
capeleds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <
&P1_04_gpio_pin /* left */
&P2_03_gpio_pin /* right */
>;
led@1 {
label = "gamingpocketcape::left";
gpios = <&gpio2 25 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
led@2 {
label = "gamingpocketcape::right";
gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
};
};
};
};
#!/bin/bash
INDEXES="1 2 3 4 5 6 7 8"
GPIOS="59 58 57 60 47 64 46 48"
PINS="P2_02 P2_04 P2_06 P2_08 P2_18 P2_20 P2_22 P2_24"
NAMES="DOWN RIGHT UP LEFT A B C D"
for i in ${INDEXES}; do
NAME[$i]=$(cut -d' ' -f"$i" <<<"${NAMES}")
GPIO[$i]=$(cut -d' ' -f"$i" <<<"${GPIOS}")
PIN[$i]=$(cut -d' ' -f"$i" <<<"${PINS}")
if [ ! -e /sys/class/gpio/gpio${GPIO[$i]} ]; then
echo ${GPIO[$i]} > /sys/class/gpio/export
fi
STATE_PATH="/sys/devices/platform/ocp/ocp:${PIN[$i]}_pinmux/state"
if [ "$(cat ${STATE_PATH})" != "gpio_pu" ]; then
echo gpio_pu > ${STATE_PATH}
fi
LAST_VALUE[$i]=2
done
while true; do
for i in ${INDEXES}; do
VALUE=$(cat /sys/class/gpio/gpio"${GPIO[$i]}"/value)
if [ "${VALUE}" == "0" ]; then
STATE="PRESSED"
else
STATE="RELEASED"
fi
if [ "${VALUE}" != "${LAST_VALUE[$i]}" ]; then
LAST_VALUE[$i]=${VALUE}
echo "${NAME[$i]} (${GPIO[$i]}): ${STATE}"
fi
done
sleep 0.1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.