Modifications

Sauter à la navigation Sauter à la recherche
623 octets ajoutés ,  13 juin 2016 à 09:41
Ligne 118 : Ligne 118 :  
from machine import SPI
 
from machine import SPI
   −
# configure the SPI master @ 2MHz
+
# configurer le bus SPI 0 en maître (master) et à la vitesse de 2MHz
 
spi = SPI(0, SPI.MASTER, baudrate=200000, polarity=0, phase=0)
 
spi = SPI(0, SPI.MASTER, baudrate=200000, polarity=0, phase=0)
 
spi.write('hello')
 
spi.write('hello')
spi.read(5) # receive 5 bytes on the bus
+
spi.read(5) # réception de 5 bytes/octets sur le bus
 
rbuf = bytearray(5)
 
rbuf = bytearray(5)
spi.write_readinto('hello', rbuf) # send a receive 5 bytes
+
spi.write_readinto('hello', rbuf) # envoyer et recevoir 5 bytes/octets
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Si vous avez besoin d'exemple l'envoi {{underline|et réception}} de donnée sur le bus SPI, vous pouvez consulter le projet de [https://github.com/ropod7/pyboard_drive pyboard_drive] (''GitHub de Roman Podgaiski'') et plus particulièrement le pilote concernant ILI9341 permettant de prendre le contrôle d'un écran TFT. La bibliothèque est certes écrite pour une carte MicroPython PyBoard mais c'est du MicroPython. Roman a été amené à faire des lectures dans la RAM de l'écran via le bus SPI. Ce projet est donc une excellente source d'information.
    
== Port SD (todo) ==
 
== Port SD (todo) ==
29 917

modifications

Menu de navigation