Sélectionner Le Bus Série - Adafruit BlueFruit LE Guide Utilisateur

Table des Matières

Publicité

output is 'noisy' on the serial console but is handy since you can see all communication between the micro and the BLE
// ----------------------------------------------------------------------------------------------
// These settings are used in both SW UART, HW UART and SPI mode
// ----------------------------------------------------------------------------------------------
#define BUFSIZE
128
#define VERBOSE_MODE
UART logiciel
If you are using Software UART, you can set up which pins are going to be used for RX, TX, and CTS flow control. Some
microcontrollers are limited on which pins can be used! Check the SoftwareSerial library documentation for more details
// SOFTWARE UART SETTINGS
#define BLUEFRUIT_SWUART_RXD_PIN
#define BLUEFRUIT_SWUART_TXD_PIN
#define BLUEFRUIT_UART_CTS_PIN
#define BLUEFRUIT_UART_RTS_PIN
UART Matériel
If you have Hardware Serial, there's a 'name' for it, usually Serial1 - you can set that up here:
// HARDWARE UART SETTINGS
#ifdef Serial1
// this makes it not complain on compilation if there's no Serial1
#define BLUEFRUIT_HWSERIAL_NAME
#endif
La broche MODE
For both hardware and software serial, you will likely want to define the MODE pin. There's a few sketches that dont use it, instead
depending on commands to set/unset the mode. Its best to use the MODE pin if you have a GPIO to spare!
#define BLUEFRUIT_UART_MODE_PIN
Broches SPI
For both Hardware and Software SPI, you'll want to set the CS (chip select) line, IRQ (interrupt request) line and if you have a pin to
spare, RST (Reset)
// SHARED SPI SETTINGS
#define BLUEFRUIT_SPI_CS
#define BLUEFRUIT_SPI_IRQ
#define BLUEFRUIT_SPI_RST
Broches SPI logiciel
If you don't have a hardware SPI port available, you can use any three pins...its a tad slower but very flexible
// SOFTWARE SPI SETTINGS
#define BLUEFRUIT_SPI_SCK
#define BLUEFRUIT_SPI_MISO
#define BLUEFRUIT_SPI_MOSI
Refer to the table above to determine whether you have SPI or UART controlled Bluefruits!
Sélectionner le Bus Série
Once you've configured your pin setup in the BluefruitConfig.h file, you can now check and adapt the example sketch.
The Adafruit_BluefruitLE_nRF51 library supports four different serial bus options, depending on the HW you are using: SPI both
hardware and software type, and UART both hardware and software type.
Carte de type UART (Bluefruit LE UART Friend & Flora BLE)
This is for Bluefruit LE UART Friend & Flora BLE boards. You can use either software serial or hardware serial. Hardware serial is
higher quality, and less risky with respect to losing data. However, you may not have hardware serial available! Software serial does
// Size of the read buffer for incoming data
true
// If set to 'true' enables debug output
// Required for software serial!
9
// Required for software serial!
10
// Required for software serial!
11
// Optional, set to -1 if unused
-1
Serial1
12
// Set to -1 if unused
8
7
4
// Optional but recommended, set to -1 if unused
13
12
11

Publicité

Table des Matières
loading

Table des Matières