Antonio Vilei / X_NUCLEO_IDB0XA1

Fork of X_NUCLEO_IDB0XA1 by ST Expansion SW Team

Embed: (wiki syntax)

« Back to documentation index

BlueNRGDevice

BlueNRGDevice

BlueNRG BLE_API Device Adaptation. More...

Functions

BlueNRGDevice bluenrgDeviceInstance (IDB0XA1_PIN_SPI_MOSI, IDB0XA1_PIN_SPI_MISO, IDB0XA1_PIN_SPI_SCK, IDB0XA1_PIN_SPI_nCS, IDB0XA1_PIN_SPI_RESET, IDB0XA1_PIN_SPI_IRQ)
 The singleton which represents the BlueNRG transport for the BLEDevice.
BLEInstanceBase * createBLEInstance (void)
 BLE-API requires an implementation of the following function in order to obtain its transport handle.
 BlueNRGDevice (PinName mosi, PinName miso, PinName sck, PinName cs, PinName rst, PinName irq)
 Constructor.
virtual ~BlueNRGDevice (void)
 Destructor.
uint8_t getUpdaterHardwareVersion (uint8_t *upd_hw_version)
 Get BlueNRG HW updater version.
int updateFirmware (const uint8_t *fw_image, uint32_t fw_size)
 Flash a new firmware using internal bootloader.
virtual ble_error_t init (BLE::InstanceID_t instanceID, FunctionPointerWithContext< BLE::InitializationCompleteCallbackContext * > callback)
 Initialises anything required to start using BLE.
void reset (void)
 Resets the BLE HW, removing any existing services and characteristics.
virtual void waitForEvent (void)
 Wait for any BLE Event like BLE Connection, Read Request etc.
virtual const char * getVersion (void)
 get GAP version
virtual Gap & getGap ()
 get reference to GAP object
virtual GattServer & getGattServer ()
 get reference to GATT server object
virtual ble_error_t shutdown (void)
 shut down the BLE device
int32_t spiRead (uint8_t *buffer, uint8_t buff_size)
 Reads from BlueNRG SPI buffer and store data into local buffer.
int32_t spiWrite (uint8_t *data1, uint8_t *data2, uint8_t Nb_bytes1, uint8_t Nb_bytes2)
 Writes data from local buffer to SPI.

Detailed Description

BlueNRG BLE_API Device Adaptation.


Function Documentation

BlueNRGDevice ( PinName  mosi,
PinName  miso,
PinName  sck,
PinName  cs,
PinName  rst,
PinName  irq 
) [inherited]

Constructor.

Parameters:
mosimbed pin to use for MOSI line of SPI interface
misombed pin to use for MISO line of SPI interface
sckmbed pin to use for SCK line of SPI interface
csmbed pin to use for not chip select line of SPI interface
rstmbed pin to use for BlueNRG reset
irqmbed pin for BlueNRG IRQ

Definition at line 94 of file BlueNRGDevice.cpp.

BlueNRGDevice bluenrgDeviceInstance ( IDB0XA1_PIN_SPI_MOSI  ,
IDB0XA1_PIN_SPI_MISO  ,
IDB0XA1_PIN_SPI_SCK  ,
IDB0XA1_PIN_SPI_nCS  ,
IDB0XA1_PIN_SPI_RESET  ,
IDB0XA1_PIN_SPI_IRQ   
)

The singleton which represents the BlueNRG transport for the BLEDevice.

See file 'x_nucleo_idb0xa1_targets.h' for details regarding the peripheral pins used!

BLEInstanceBase* createBLEInstance ( void   )

BLE-API requires an implementation of the following function in order to obtain its transport handle.

Definition at line 78 of file BlueNRGDevice.cpp.

Gap & getGap (  ) [virtual, inherited]

get reference to GAP object

Parameters:
[in]void
Returns:
Gap&

Definition at line 257 of file BlueNRGDevice.cpp.

GattServer & getGattServer (  ) [virtual, inherited]

get reference to GATT server object

Parameters:
[in]void
Returns:
GattServer&

Definition at line 274 of file BlueNRGDevice.cpp.

uint8_t getUpdaterHardwareVersion ( uint8_t *  upd_hw_version ) [inherited]

Get BlueNRG HW updater version.

Parameters:
versionThis parameter returns the updater HW version.
Return values:
Statusof the call

Definition at line 134 of file BlueNRGDevice.cpp.

const char * getVersion ( void   ) [virtual, inherited]

get GAP version

Get the BLE stack version information

Parameters:
[in]void
Returns:
char *
char *

Definition at line 245 of file BlueNRGDevice.cpp.

ble_error_t init ( BLE::InstanceID_t  instanceID,
FunctionPointerWithContext< BLE::InitializationCompleteCallbackContext * >  callback 
) [virtual, inherited]

Initialises anything required to start using BLE.

Parameters:
[in]void
Returns:
ble_error_t

Definition at line 166 of file BlueNRGDevice.cpp.

void reset ( void   ) [inherited]

Resets the BLE HW, removing any existing services and characteristics.

Parameters:
[in]void
Returns:
void

Definition at line 199 of file BlueNRGDevice.cpp.

ble_error_t shutdown ( void   ) [virtual, inherited]

shut down the BLE device

Parameters:
[out]errorif any

Definition at line 290 of file BlueNRGDevice.cpp.

int32_t spiRead ( uint8_t *  buffer,
uint8_t  buff_size 
) [inherited]

Reads from BlueNRG SPI buffer and store data into local buffer.

Parameters:
buffer: Buffer where data from SPI are stored
buff_size,:Buffer size
Return values:
int32_t: Number of read bytes

Definition at line 331 of file BlueNRGDevice.cpp.

int32_t spiWrite ( uint8_t *  data1,
uint8_t *  data2,
uint8_t  Nb_bytes1,
uint8_t  Nb_bytes2 
) [inherited]

Writes data from local buffer to SPI.

Parameters:
data1: First data buffer to be written
data2: Second data buffer to be written
Nb_bytes1,:Size of first data buffer to be written
Nb_bytes2,:Size of second data buffer to be written
Return values:
Numberof read bytes

Definition at line 399 of file BlueNRGDevice.cpp.

int updateFirmware ( const uint8_t *  fw_image,
uint32_t  fw_size 
) [inherited]

Flash a new firmware using internal bootloader.

Parameters:
fw_imagePointer to the firmware image (raw binary data, little-endian).
fw_sizeSize of the firmware image. The firmware image size shall be multiple of 4 bytes.
Return values:
intIt returns 0 if successful, or a number not equal to 0 in case of error (ACI_ERROR, UNSUPPORTED_VERSION, WRONG_IMAGE_SIZE, CRC_ERROR)

Definition at line 153 of file BlueNRGDevice.cpp.

void waitForEvent ( void   ) [virtual, inherited]

Wait for any BLE Event like BLE Connection, Read Request etc.

Parameters:
[in]void
Returns:
char *

Definition at line 219 of file BlueNRGDevice.cpp.

~BlueNRGDevice ( void   ) [virtual, inherited]

Destructor.

Definition at line 125 of file BlueNRGDevice.cpp.