Différences entre versions de « Bluefruit-LE-Shield-Brancher »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 41 : Ligne 41 :
  
 
== Modifier le brochage par défaut ==
 
== Modifier le brochage par défaut ==
The examples sketches may use slightly different pins.  If you wish to change the location of the CS, IRQ or RST pins, open the '''BluefruitConfig.h''' file in the example folder of the example you are using, and change the pin to an appropriate value (See the Software section of this tutorial for instructions on installing the library):
+
Si vous voulez que les croquis/sketch d'exemple utilisent des broches SPI différentes (pour CS, IRQ ou RST) alors ouvrez le fichier '''BluefruitConfig.h''' disponible dans le répertoire exemple (de l'exemple que vous désirez tester). Dans ce fichier .h, il faudra changer les broches pour qu'elles aient la nouvelle affectation souhaitée (Voyez la section "Logiciel" See the Software section of this tutorial for instructions on installing the library):
  
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">

Version du 25 mai 2017 à 21:52


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Raccordement par défaut

Pour une mise en place rapide, Adafruit a déjà raccordé le Bluefruit LE sur les broches par défaut. Cela permet de suivre le tutoriel (qui exploite également les broches par défaut).

Le Bluefruit LE SPI Friend (comme le shield BlueFruit LE pour Arduino) ne devrait pas être modifié et utilisera le brochage le brochage suivant:

Broches SPI du Bluefruit LE Broche Arduino
SCK SPI Matériel: SCK
MISO SPI matériel: MISO
MOSI SPI matériel: MOSI
CS 8
IRQ
Interruption
7
RST
Reset
4

Par défaut, Adafruit utilise le bus SPI matériel. Ces broches SPI sont partagées avec d'autres broches digitales. Par exemple, sur un Arduino UNO, le bus SPI matériel utilise les broches #13, #12 et #11.

Si vous disposez d'un Arduino Uno (ou Atmega328 compatible) dont le connecteur 2x3 est manquant alors vous pouvez brancher des fils (sous le shield) pour réaliser le raccordement sur le bus SPI matériel de SCK/MISO/MOSI vers 13/12/11.

Si vous ne voulez pas utiliser le bus SPI matériel (connecteur 2x3 broches), il est toujours possible d'utiliser du SPI logiciel. Le SPI logiciel est plus lent mais permet d'utiliser n'importe quelle broche digital pour émuler le bus SPI logiciel (il faudra 3 broches). Utilisez simplement des fils pour réaliser des pontages entre les breakouts SCK/MISO/MOSI et les broches que vous souhaitez utiliser.

Si vous voulez modifier les broches SPI utilisés (le raccordement par défaut), il ne faut pas souder le connecteur SPI (2x3 broches) sur votre shield.

Modifier le brochage par défaut

Si vous voulez que les croquis/sketch d'exemple utilisent des broches SPI différentes (pour CS, IRQ ou RST) alors ouvrez le fichier BluefruitConfig.h disponible dans le répertoire exemple (de l'exemple que vous désirez tester). Dans ce fichier .h, il faudra changer les broches pour qu'elles aient la nouvelle affectation souhaitée (Voyez la section "Logiciel" See the Software section of this tutorial for instructions on installing the library):

#define BLUEFRUIT_SPI_CS               8
#define BLUEFRUIT_SPI_IRQ              7
#define BLUEFRUIT_SPI_RST              4

If you want to use software (bitbang) SPI, you can change the SCK, MISO and MOSI pins using the following macros in the same file:

#define BLUEFRUIT_SPI_SCK              13
#define BLUEFRUIT_SPI_MISO             12
#define BLUEFRUIT_SPI_MOSI             11

The BluefruitConfig.h file can be found in a dedicated tab, as shown below:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

For all the example code, we have at the top of the sketch a few different ways you can communicate with the Bluefruit LE: hardware serial, software serial, hardware SPI and software SPI.

For the SPI Bluefruit, you cannot use serial. However, you can choose between hardware and software SPI.

If you want to use hardware SPI, uncomment this chunk of code (and comment out the other three options)

/* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

If you want to use software/bitbang SPI, uncomment the following definition. You can then use any 6 pins (or 5, if you dont want to use RST)

/* ...software SPI, using SCK/MOSI/MISO user-defined SPI pins and then user selected CS/IRQ/RST */
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_SCK, BLUEFRUIT_SPI_MISO,
                             BLUEFRUIT_SPI_MOSI, BLUEFRUIT_SPI_CS,
                             BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

Basé sur "Bluefruit LE Shield" d'Adafruit Industries, écrit par Kevin Townsend - Traduit en Français par shop.mchobby.be CC-BY-SA pour la traduction
Toute copie doit contenir ce crédit, lien vers cette page et la section "crédit de traduction".

Based on "Bluefruit LE Shield" from Adafruit Industries, written by Kevin Townsend - Translated to French by shop.mchobby.be CC-BY-SA for the translation
Copies must includes this credit, link to this page and the section "crédit de traduction" (translation credit).

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com