Datasheet

BLEUart
BLEUart is a wrapper class for NUS (Nordic UART Service), which is a proprietary service defined by Nordic
Semiconductors that we use as a baseline transport mechanism between Bluefruit modules and our mobile and
desktop Bluefruit LE Connect applications. You can use it to easily send ASCII or binary data in both directions,
between the peripheral and the central device.
API
BLEUart has the following public API:
Example
The following example shows how to use the BLEUart helper class.
This example may be out of date, and you should always consult the latest example code in the nRF52 BSP!
The Bluefruit nRF52 Feather codebase is in an early BETA stage and is undergoing active development
based on customer feedback and testing. As such, the class documentation here is incomplete, and you
should consult the Github repo for the latest code and API developments: https://goo.gl/LdEx62
// RX Callback signature (fires when data was written by the central)
typedef void (*rx_callback_t) (void);
// Constructor
BLEUart(uint16_t fifo_depth = BLE_UART_DEFAULT_FIFO_DEPTH);
virtual err_t begin(void);
bool notifyEnabled(void);
void setRxCallback( rx_callback_t fp);
// Stream API
virtual int read ( void );
virtual int read ( uint8_t * buf, size_t size );
virtual size_t write ( uint8_t b );
virtual size_t write ( const uint8_t *content, size_t len );
virtual int available ( void );
virtual int peek ( void );
virtual void flush ( void );
// Pull in write(str) and write(buf, size) from Print
using Print::write;
#include <bluefruit.h>
BLEDis bledis;
BLEUart bleuart;
BLEBas blebas;
#define STATUS_LED (17)
#define BLINKY_MS (2000)
© Adafruit Industries https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide Page 127 of 175