Modifications

Sauter à la navigation Sauter à la recherche
3 553 octets ajoutés ,  21 mai 2017 à 14:59
aucun résumé de modification
Ligne 2 : Ligne 2 :     
{{traduction}}
 
{{traduction}}
 +
 +
== Raccordement par défaut ==
 +
To make things fast, we attached all the pins required to a default pin out. In order to follow along with the default tutorial wiring, the Bluefruit LE SPI Friend should not be modified and will use the following pins:
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
| align="center" | Broches SPI du Bluefruit LE
 +
| align="center" | Broche Arduino
 +
|- style="font-size: 90%"
 +
| align="left" | SCK
 +
| align="left" | SPI Matériel: SCK
 +
|- style="font-size: 90%"
 +
| align="left" | MISO
 +
| align="left" | SPI matériel: MISO
 +
|- style="font-size: 90%"
 +
| align="left" | MOSI
 +
| align="left" | SPI matériel: MOSI
 +
|- style="font-size: 90%"
 +
| align="left" | CS
 +
| align="left" | 8
 +
|- style="font-size: 90%"
 +
| align="left" | IRQ
 +
| align="left" | 7
 +
|- style="font-size: 90%"
 +
| align="left" | RST
 +
| align="left" | 4
 +
|}
 +
 +
Par défaut, [https://www.arduino.cc/en/Reference/SPI Adafruit utilise le bus SPI matériel]. Those pins are shared with other digital pins. For example, it uses the UNO's hardware pins #13, #12 and #11.
 +
 +
If you have an Uno or compatible (Atmega328) with the 2x3 header missing, you can short the jumpers on the bottom of the shield to hard-connect SCK/MISO/MOSI to 13/12/11.
 +
 +
If you don't want to use the 2x3 hardware SPI for some reason, you can always use software SPI, which is a tad slower but can use any 3 pins. Just solder jumper wires from the SCK/MISO/MOSI breakouts to whatever pins you like.
 +
 +
== 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):
 +
 +
<syntaxhighlight lang="c">
 +
#define BLUEFRUIT_SPI_CS              8
 +
#define BLUEFRUIT_SPI_IRQ              7
 +
#define BLUEFRUIT_SPI_RST              4
 +
</syntaxhighlight>
 +
 +
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:
 +
 +
<syntaxhighlight lang="c">
 +
#define BLUEFRUIT_SPI_SCK              13
 +
#define BLUEFRUIT_SPI_MISO            12
 +
#define BLUEFRUIT_SPI_MOSI            11
 +
</syntaxhighlight>
 +
 +
The '''BluefruitConfig.h''' file can be found in a dedicated tab, as shown below:
 +
 +
{{ADFImage|Bluefruit-LE-Shield-Brancher-00.png}}
 +
 +
 +
 +
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)
 +
 +
<syntaxhighlight lang="c">
 +
/* ...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);
 +
</syntaxhighlight>
 +
 +
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)
 +
 +
<syntaxhighlight lang="c">
 +
/* ...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);
 +
</syntaxhighlight>
    
{{Bluefruit-LE-Shield-TRAILER}}
 
{{Bluefruit-LE-Shield-TRAILER}}
29 917

modifications

Menu de navigation