my fork

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

stm32_bluenrg_ble.c File Reference

stm32_bluenrg_ble.c File Reference

Go to the source code of this file.

Functions

static void us150Delay ()
 Utility function for delay.
void set_irq_as_output ()
 Set in Output mode the IRQ.
void set_irq_as_input ()
 Set the IRQ in input mode.
void HAL_SPI_MspInit (SPI_HandleTypeDef *hspi)
 This function is used for low level initialization of the SPI communication with the BlueNRG Expansion Board.
void Hal_Write_Serial (const void *data1, const void *data2, int32_t n_bytes1, int32_t n_bytes2)
 Writes data to a serial interface.
void BNRG_SPI_Init (void)
 Initializes the SPI communication with the BlueNRG Expansion Board.
void BlueNRG_RST (void)
 Resets the BlueNRG.
uint8_t BlueNRG_DataPresent (void)
 Reports if the BlueNRG has data for the host micro.
void BlueNRG_HW_Bootloader (void)
 Activate internal bootloader using pin.
int32_t BlueNRG_SPI_Read_All (SPI_HandleTypeDef *hspi, uint8_t *buffer, uint8_t buff_size)
 Reads from BlueNRG SPI buffer and store data into local buffer.
int32_t BlueNRG_SPI_Write (SPI_HandleTypeDef *hspi, uint8_t *data1, uint8_t *data2, uint8_t Nb_bytes1, uint8_t Nb_bytes2)
 Writes data from local buffer to SPI.
void Enable_SPI_IRQ (void)
 Enable SPI IRQ.
void Disable_SPI_IRQ (void)
 Disable SPI IRQ.
void Clear_SPI_IRQ (void)
 Clear Pending SPI IRQ.
void Clear_SPI_EXTI_Flag (void)
 Clear EXTI (External Interrupt) line for SPI IRQ.

Detailed Description

Author:
CL
Version:
V1.0.0
Date:
04-July-2014
Attention:

© COPYRIGHT(c) 2014 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file stm32_bluenrg_ble.c.


Function Documentation

uint8_t BlueNRG_DataPresent ( void   )

Reports if the BlueNRG has data for the host micro.

Parameters:
None
Return values:
1if data are present, 0 otherwise

Definition at line 212 of file stm32_bluenrg_ble.c.

void BlueNRG_HW_Bootloader ( void   )

Activate internal bootloader using pin.

Parameters:
None
Return values:
None

Definition at line 225 of file stm32_bluenrg_ble.c.

void BlueNRG_RST ( void   )

Resets the BlueNRG.

Parameters:
None
Return values:
None

Definition at line 197 of file stm32_bluenrg_ble.c.

int32_t BlueNRG_SPI_Read_All ( SPI_HandleTypeDef *  hspi,
uint8_t *  buffer,
uint8_t  buff_size 
)

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

Parameters:
hspi: Handle of the STM32Cube HAL SPI interface
buffer: Buffer where data from SPI are stored
buff_size,:Buffer size
Return values:
int32_t: Number of read bytes

Definition at line 239 of file stm32_bluenrg_ble.c.

int32_t BlueNRG_SPI_Write ( SPI_HandleTypeDef *  hspi,
uint8_t *  data1,
uint8_t *  data2,
uint8_t  Nb_bytes1,
uint8_t  Nb_bytes2 
)

Writes data from local buffer to SPI.

Parameters:
hspi: Handle of the STM32Cube HAL SPI interface
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 302 of file stm32_bluenrg_ble.c.

void BNRG_SPI_Init ( void   )

Initializes the SPI communication with the BlueNRG Expansion Board.

Parameters:
None
Return values:
None

Definition at line 174 of file stm32_bluenrg_ble.c.

void Clear_SPI_EXTI_Flag ( void   )

Clear EXTI (External Interrupt) line for SPI IRQ.

Parameters:
None
Return values:
None

Definition at line 465 of file stm32_bluenrg_ble.c.

void Clear_SPI_IRQ ( void   )

Clear Pending SPI IRQ.

Parameters:
None
Return values:
None

Definition at line 455 of file stm32_bluenrg_ble.c.

void Disable_SPI_IRQ ( void   )

Disable SPI IRQ.

Disable interrupts from BLE controller.

Parameters:
None
Return values:
None

Definition at line 445 of file stm32_bluenrg_ble.c.

void Enable_SPI_IRQ ( void   )

Enable SPI IRQ.

Writes data to a serial interface.

Parameters:
None
Return values:
None

Definition at line 435 of file stm32_bluenrg_ble.c.

void HAL_SPI_MspInit ( SPI_HandleTypeDef *  hspi )

This function is used for low level initialization of the SPI communication with the BlueNRG Expansion Board.

Parameters:
Pointerto the handle of the STM32Cube HAL SPI interface.
Return values:
None

Definition at line 60 of file stm32_bluenrg_ble.c.

void Hal_Write_Serial ( const void *  data1,
const void *  data2,
int32_t  n_bytes1,
int32_t  n_bytes2 
)

Writes data to a serial interface.

Parameters:
data1: 1st buffer
data2: 2nd buffer
n_bytes1,:number of bytes in 1st buffer
n_bytes2,:number of bytes in 2nd buffer
Return values:
None

Definition at line 142 of file stm32_bluenrg_ble.c.

void set_irq_as_input (  )

Set the IRQ in input mode.

Parameters:
None
Return values:
None

Definition at line 395 of file stm32_bluenrg_ble.c.

void set_irq_as_output (  )

Set in Output mode the IRQ.

Parameters:
None
Return values:
None

Definition at line 377 of file stm32_bluenrg_ble.c.

static void us150Delay (  ) [static]

Utility function for delay.

Parameters:
None
Return values:
NoneNOTE: TODO: implement with clock-independent function.

Definition at line 417 of file stm32_bluenrg_ble.c.