一、簡介
本文介紹如何在******bleperipheral工程中,以char7為例。
二、實驗平台
編譯環境:iar820.02
協議棧:ble-cc254x-1.40
**檢視器:source insight 3.5
硬體平台:smartrf 開發板
smartrf
三、編寫宣告
相關cc2541群:606444519
**小店:
四、實驗前提
請完成以下博文:
【cc2541歷程
五、硬體原理圖
暫無
1.增加char7巨集定義((
******gattprofile.h中constants段部分))
#define ******profile_char1 0 // rw uint8 - profile characteristic 1 value
#define ******profile_char2 1 // rw uint8 - profile characteristic 2 value
#define ******profile_char3 2 // rw uint8 - profile characteristic 3 value
#define ******profile_char4 3 // rw uint8 - profile characteristic 4 value
#define ******profile_char5 4 // rw uint8 - profile characteristic 5 value
#define ******profile_char6 5 //rw uint8 - profile characteristic 6 value
#define ******profile_char7 6 // rw uint8 - profile characteristic 7 value
#define ******profile_chara 9 //rw uint8 - profile characteristic a value
// ****** profile service uuid
#define ******profile_serv_uuid 0xfff0
// key pressed uuid
#define ******profile_char1_uuid 0xfff1
#define ******profile_char2_uuid 0xfff2
#define ******profile_char3_uuid 0xfff3
#define ******profile_char4_uuid 0xfff4
#define ******profile_char5_uuid 0xfff5
#define ******profile_char6_uuid 0xfff6
#define ******profile_char7_uuid 0xfff7
#define ******profile_chara_uuid 0xfffa
// ****** keys profile services bit fields
#define ******profile_service 0x00000001
// length of characteristic 5 in bytes
#define ******profile_char5_len 5
#define ******profile_char6_len 4 // 溫度傳輸
#define ******profile_char7_len 20 // 裝置名稱
#define ******profile_chara_len 4 // pwm 輸出
2.增加char6的uuid(******gattprofile.c中global variables段部分)
// characteristic 7 uuid: 0xfff7
const uint8 ******profilechar7uuid[att_bt_uuid_size] =
;
3.增加char7的配置屬性(
******gattprofile.c中
profile attributes - variables段)
// ****** profile characteristic 7 properties
static uint8 ******profilechar7props = gatt_prop_read | gatt_prop_write;
// characteristic 5 value
static uint8 ******profilechar7[******profile_char7_len] = ;
static uint8 ******profilechar7len = 0;
// ****** profile characteristic 7 user description
static uint8 ******profilechar7userdesp[19] = "device name config\0";
4.修改屬性表.
藍芽CC2541 串列埠學習筆記
usart暫存器如下 1.u0csr 為 usart0的控制和狀態 7位 usart模式選擇 0為spi模式 1為usart模式 6為 usart接收使能 0為禁止 1為使能接收 5位 spi主從模式設定 0主模式 1為從模式 4位 usart幀錯誤狀態 0沒有錯誤 1有錯誤 3位 usart奇偶校...
超低低功耗藍芽晶元CC2541 乾貨分析
特性點 rf 2.4 ghz 藍芽低能量符合和專有的rf片上系統 支援250 kbps的,500 kbps的,1 mbps的,2 mbps的資料傳輸速率 出色的鏈路預算,啟用 如果沒有外部的遠端應用 前端 可程式設計輸出功率為0 dbm 卓越的接收靈敏度 94 dbm的輸出功率1 mbps 選擇性和...
關於TI藍芽CC2541的學習 I O配置
1.cc2541的核心為51內,有21個數字輸入 輸出的i o口,可以作為普通的i o也可以作為外設的埠使用。1.1普通i o口。cc2541復位是i 0預設是上拉,即輸出高電平。出p1.0和p1.1,因為其沒有上拉和下拉電阻 作為通用i o時,cc2541的引腳可分為三組每個8位的埠,即0埠,1埠...