| BlueNRG-1 DK: BLE examples

- Main Page
- Modules
- Files

- File List

BLE_Throughput_main.c
Go to the documentation of this file.
1
2 /******************** (C) COPYRIGHT 2016 STMicroelectronics ********************
3 * File Name : BLE_Throughput_main.c
4 * Author : VMA DIVISION
5 * Version : 1.1.0
6 * Date : 09-February-2016
7 * Description : Code demostrating the BLE Throughput applications
8 ********************************************************************************
9 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
10 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
11 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
12 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
13 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
14 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
15 *******************************************************************************/
16
200 /* Includes ------------------------------------------------------------------*/
201 #include <stdio.h>
202 #include <string.h>
203 #include "BlueNRG1_it.h"
204 #include "BlueNRG1_conf.h"
205 #include "ble_const.h"
206 #include "bluenrg1_stack.h"
207 #include "gp_timer.h"
208 #include "app_state.h"
209 #include "throughput.h"
210 #include "SDK_EVAL_Config.h"
211 #include "Throughput_config.h"
212
213 /* Private typedef -----------------------------------------------------------*/
214 /* Private define ------------------------------------------------------------*/
215 #define BLE_THROUGHPUT_VERSION_STRING "1.0.0"
216
217
218 /* Private macro -------------------------------------------------------------*/
219 /* Private variables ---------------------------------------------------------*/
220 /* Private function prototypes -----------------------------------------------*/
221 /* Private functions ---------------------------------------------------------*/
222
223 int main(void)
224 {
225 uint8_t ret;
226
227 /* System Init */
228 SystemInit();
229
230 /* Identify BlueNRG1 platform */
231 SdkEvalIdentification();
232
233 /* Init Clock */
234 Clock_Init();
235
236 /* Configure I/O communication channel:
237 It requires the void IO_Receive_Data(uint8_t * rx_data, uint16_t data_size) function
238 where user received data should be processed */
239 SdkEvalComIOConfig(Process_InputData);
240
241 /* BlueNRG-1 stack init */
242 ret = BlueNRG_Stack_Initialization(&BlueNRG_Stack_Init_params);
243 if (ret != BLE_STATUS_SUCCESS) {
244 printf("Error in BlueNRG_Stack_Initialization() 0x%02x\r\n", ret);
245 while(1);
246 }
247
248 #if SERVER
249 printf("BlueNRG-1 BLE Throughput Server Application (version: %s)\r\n", BLE_THROUGHPUT_VERSION_STRING);
250 #else
251 printf("BlueNRG-1 BLE Throughput Client Application (version: %s)\r\n", BLE_THROUGHPUT_VERSION_STRING);
252 #endif
253
254 /* Init Throughput test */
255 ret = THROUGHPUT_DeviceInit();
256 if (ret != BLE_STATUS_SUCCESS) {
257 printf("THROUGHPUT_DeviceInit()--> Failed 0x%02x\r\n", ret);
258 while(1);
259 }
260
261 printf("BLE Stack Initialized \n");
262
263 while(1) {
264 /* BlueNRG-1 stack tick */
265 BTLE_StackTick();
266
267 /* Application tick */
268 APP_Tick();
269 }
270
271 } /* end main() */
272
273 #ifdef USE_FULL_ASSERT
274
281 void assert_failed(uint8_t* file, uint32_t line)
282 {
283 /* User can add his own implementation to report the file name and line number,
284 ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
285
286 /* Infinite loop */
287 while (1)
288 {
289 }
290 }
291
292 #endif
293
294 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/