久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標(biāo)題: NRF51822藍(lán)牙串口源碼分享 [打印本頁(yè)]

作者: zcw3726040    時(shí)間: 2018-10-1 19:36
標(biāo)題: NRF51822藍(lán)牙串口源碼分享
NRF51822 藍(lán)牙串口


單片機(jī)源程序如下:
  1. /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */

  12. #include <stdint.h>
  13. #include "app_error.h"
  14. #include "ble_dtm_app.h"
  15. #include "ble_serialization.h"
  16. #include "nrf_error.h"
  17. #include "ser_config.h"
  18. #include "ser_hal_transport.h"
  19. #include "ser_sd_transport.h"


  20. static uint32_t dtm_init_rsp_dec(const uint8_t * p_buffer, uint16_t length)
  21. {
  22.     uint32_t result_code;

  23.     const uint32_t err_code = ble_dtm_init_rsp_dec(p_buffer, length, &result_code);
  24.     APP_ERROR_CHECK(err_code);

  25.     return result_code;
  26. }


  27. uint32_t ble_dtm_init(app_uart_stream_comm_params_t * p_uart_comm_params)
  28. {
  29.     if (p_uart_comm_params == NULL)
  30.     {
  31.         return NRF_ERROR_NULL;
  32.     }
  33.    
  34.     uint32_t err_code = NRF_SUCCESS;
  35.     uint32_t index = 0;
  36.    
  37.     uint8_t * p_tx_buf = NULL;
  38.     uint32_t tx_buf_len = 0;

  39.     err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len);
  40.     if (err_code != NRF_SUCCESS)
  41.     {
  42.         return err_code;
  43.     }

  44.     p_tx_buf[index++] = SER_PKT_TYPE_DTM_CMD;
  45.     tx_buf_len -= SER_PKT_TYPE_SIZE;

  46.     err_code = ble_dtm_init_req_enc(p_uart_comm_params, &(p_tx_buf[SER_PKT_TYPE_SIZE]), &tx_buf_len);
  47.     if (err_code == NRF_SUCCESS)
  48.     {
  49.         tx_buf_len += SER_PKT_TYPE_SIZE;

  50.         err_code = ser_sd_transport_cmd_write(p_tx_buf, tx_buf_len, dtm_init_rsp_dec);
  51.         if (err_code != NRF_SUCCESS)
  52.         {
  53.             err_code = NRF_ERROR_INTERNAL;
  54.         }
  55.     }
  56.     else
  57.     {
  58.         err_code = NRF_ERROR_INTERNAL;
  59.     }

  60.     return err_code;
  61. }
復(fù)制代碼

所有資料51hei提供下載:
BLE實(shí)驗(yàn)4:藍(lán)牙串口.zip (14.5 MB, 下載次數(shù): 34)



作者: cnc2020    時(shí)間: 2018-12-15 18:39
good topic




歡迎光臨 (http://m.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 日韩视频在线观看 | 福利影视| 91日韩欧美| 国产毛片毛片毛片 | 欧美色综合 | 希岛爱理在线 | 美女一级片 | 欧美一级片在线观看 | 亚洲精品国产精品国自产在线 | 欧美日韩免费在线观看 | h片在线观看免费 | 欧美日韩少妇 | 伊人精品久久 | 超碰99在线| 国产一区二区在线免费 | 午夜www | 快播少女爱欢乐 | 天天干天天干天天操 | 午夜视频免费看 | 久久久成人免费视频 | 天堂在线视频tv | 人人草人人爱 | 亚洲久久久久久 | 国产视频h| 久久av一区| 亚洲成人免费网站 | 最新日韩av | 久久一区二区三区四区 | 日产精品久久久一区二区 | 国产精品久久久一区二区三区 | 夜夜操夜夜| 亚洲欧美日韩综合 | 中文字幕有码在线 | 日韩av免费播放 | 国产精品免费看 | wwwxxx欧美 | 欧美一级做性受免费大片免费 | 日韩在线一区二区 | 日韩欧美在线免费观看 | 日韩精品一区在线 | 91亚洲国产 |