@Danetco @acris
Le pi zéro ne possède pas de sortie audio Jack. Pour cela il faut passer par une carte son USB ou encore utiliser les pwm du Pi :
https://learn.adafruit.com/introducing-the-raspberry-pi-zero/audio-outputs
https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio
Il faut alors reconfigurer 2 pins du GPIO afinde leur donner la fonction PWM. Pour cela on peut passer par une configuration dans le fichier config.txt :
dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4
mais sur RB on a directement créer un overlay qui réalise cette configuration, ce sera plus élégant :
Ensuite dans le fichier config.txt il suffit simplement d'ajouter :
dtoverlay=pwm-audio-pi-zero
ensuite il faut réaliser le montage suivant :
0_1556364376783_raspberry_pi_audiofilter.png
pour réaliser des filtres passe bas afin de récupérer Audio Left et Audio right. Pour cela on a besoin de :
2 résistances 150 Ohms
2 résistances 270 Ohms
2 condensateurs 33nF
2 condensateurs 10µF
4 diodes (pas réellements necessaires)
0_1556364385162_raspberry_pi_pi_zero_audio_bb.png
sinon tu optes pour une ampli audio 5v stereo encore plus simple
https://www.ebay.fr/itm/10Pcs-2-Canaux-3W-Dc-2-5-5V-PAM8403-Classe-Numerique-D-Amplificateur-Audio-hh/263669634235?hash=item3d63ef54bb:g:9skAAOSwhHFbQibF
0_1556364535491_s-l300.jpg
pour les gpios avec les custom GPIO ajoutés dans la dragonblaze c'est pbien plus simple :
# ------------ D2 - GPIO Controllers ------------ #
## GPIO Controllers
## enable controllers on GPIO with mk_arcarde_joystick_rpi (0,1)
controllers.gpio.enabled=0
## mk_gpio arguments, map=1 for one controller, map=1,2 for 2 (map=1,map=1,2)
controllers.gpio.args=map=1,2
## Custom mk_gpio arguments,
## map=5 gpio1=Y-,Y+,X-,X+,start,select,a,b,tr,y,x,tl,hk for one controller,
## map=5 gpio1=pin1,pin2,pin3,.....,pin12,pin13
## map=5,6 gpio1=Y-,Y+,X-,X+,start,select,a,b,tr,y,x,tl,hk gpio2=Y-,Y+,X-,X+,start,select,a,b,tr,y,x,tl,hk for 2 (map=5,map=5,6)
## map=5,6 gpio1=gpiox,gpioy,gpioz,.....,gpiou,gpiov gpio2=gpiox,gpioy,gpioz,.....,gpiou,gpiov
# where gpiox,gpioy,gpioz ... are NOT pin numbers on the connector, BUT location gpio numbered as in
# https://www.raspberrypi-spy.co.uk/wp-content/uploads/2012/06/Raspberry-Pi-GPIO-Layout-Model-B-Plus-rotated-2700x900.png
## Set pin to -1 to disable it
# controllers.gpio.args=map=5,6 gpio=4,17,27,22,10,9,25,24,23,18,15,14,2 gpio2=11,5,6,13,19,26,21,20,16,12,7,8,3
## MCP configuration : GPIO and MCP can be used together. You can mix them.
## map=0x20,0x21 for 2 mcp23017 on i2c bus
#controllers.gpio.args=map=0x20,0x21,5,6 gpio=4,17,27,22,10,9,25,24,23,18,15,14,-1 gpio2=11,5,6,13,19,26,21,20,16,12,7,8,-1
Voici ma config pour le schéma de cablage avec un ecran en sur le bus spi
pour ça il faut editer le fichier recalbox.conf :
controllers.gpio.enabled=1
controllers.gpio.args=map=5 gpio=2,3,4,5,12,25,26,14,15,6,13,19,16
0_1556364917536_gpiopinoutdiagramrecalbox1player_waveshare_3.2_tft_spi_150dpi.png
tu testes avec evtest tes boutons
evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: CHICONY HP Basic USB Keyboard
/dev/input/event1: GPIO Custom Controller 1
Select the device event number [0-1]: 1
Input driver version is 1.0.1
Input device ID: bus 0x15 vendor 0x1 product 0x5 version 0x100
Input device name: "GPIO Custom Controller 1"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 304 (BTN_SOUTH)
Event code 305 (BTN_EAST)
Event code 307 (BTN_NORTH)
Event code 308 (BTN_WEST)
Event code 310 (BTN_TL)
Event code 311 (BTN_TR)
Event code 314 (BTN_SELECT)
Event code 315 (BTN_START)
Event code 316 (BTN_MODE)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 0
Min -1
Max 1
Event code 1 (ABS_Y)
Value 0
Min -1
Max 1
Properties:
Testing ... (interrupt to exit)
Event: time 1554206133.568392, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1554206133.568392, -------------- SYN_REPORT ------------
Event: time 1554206133.668428, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1554206133.668428, -------------- SYN_REPORT ------------
Event: time 1554206133.828394, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1554206133.828394, -------------- SYN_REPORT ------------
Event: time 1554206133.948415, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1554206133.948415, -------------- SYN_REPORT ------------
Event: time 1554206134.088402, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1554206134.088402, -------------- SYN_REPORT ------------
Event: time 1554206134.168414, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1554206134.168414, -------------- SYN_REPORT ------------
Event: time 1554206134.268405, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
Event: time 1554206134.268405, -------------- SYN_REPORT ------------
Event: time 1554206134.368410, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
Event: time 1554206134.368410, -------------- SYN_REPORT ------------
Hope this helps