- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Noridc nRF51822 BLE Storage
1nRF51822:蓝牙协议中的flash存储
Gandy Huang
Gandy.huang@
\Nordic\Documentation\s110\html\a00018.html
2Include file
? #include pstorage_platform.h //copy from proximity project
? #include pstorage.h“
? 向工程添加
? pstorage.c
3增加回掉函数
void pstorage_test_cb_handler(pstorage_handle_t * p_handle,
uint8_t op_code,
uint32_t result,
uint8_t * p_data,
uint32_t data_len)
{
//自行处理对应时间,可以不处理
}
4增加系统处理
static void sys_evt_dispatch(uint32_t sys_evt)
{
pstorage_sys_event_handler(sys_evt);
}
static void ble_ant_stack_init(void)
{
// Initialize SoftDevice
SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM,
false);
// Subscribe for BLE events.
uint32_t err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
// Register with the SoftDevice handler module for System events.
err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
APP_ERROR_CHECK(err_code);
}
5运用
//自定义变量
pstorage_handle_t m_storage_test;
uint32_t flash_test[2]={1,2};
uint32_t flash_test2[2];
int main(void)
{
// Initialize
ble_stack_init();
。。。。。。。。。。。。
pstorage_module_param_t param;
uint32_t err_code = pstorage_init(); //flash init
APP_ERROR_CHECK(err_code);
param.block_size = 1024; //存储的大小
param.block_count = 1; //分页
param.cb = pstorage_test_cb_handler; //回调函数
pstorage_register(param, m_storage_test); //注册
pstorage_clear(m_storage_test, 1024); //clear
//保存数据
pstorage_store(m_storage_test,(uint8_t *)flash_test[0],8,0);
//保存数据不是立刻可以存储,而是通过协议栈队列实现,因此读取数据最后确认操作完成后操作
nrf_delay_ms(50);
pstorage_load((uint8_t *)flash_test2[0],m_storage_test,8,0); //读取
}
6谢谢
您可能关注的文档
- model liquid crystal.pdf
- Modeling and Comparison of Dissolution.pdf
- Modeling and Simulation of Double-tube Hydraulic Damper External Characteristic.pdf
- Modeling the Counts of Faint Radio Loud Quasars Constraints on the Supermassive Black Hole.pdf
- Modelling football match results and the efficiency of fixed-odds betting Corresponding au.pdf
- MODELS FOR IMPLEMENTING VIRTUAL STUDIES ABROAD.pdf
- Module 3,B7.doc
- Module 7 Unit 1九上.ppt
- Module 9 Letters from Abroad(国外来信).ppt
- Module_1_Wonders_of_the_world_导学案_(教师版).doc
- Notes on local reflection principles.pdf
- Notes on solutions in Wronskian form to soliton equations KdV-type.pdf
- Novel Design and Verification of a 16 x 16-b Self- Repairable Reconfigurable Inner Product.pdf
- Novel Designs for Efficient Broadband Frequency Doublers.pdf
- Novelty Detection Based on Sentence Level Patterns.pdf
- Novell Access Manager.pdf
- Novel Modular-Rotor Switched-Flux Permanent Magnet Machines.pdf
- NPTF Training.ppt
- NPCA110P_DS_1.1.pdf
- NREL aeroelastic codes comparison 39113 2006.pdf
最近下载
- 初中语文通用版 现代文阅读答题技巧(公式化模板 + 完整版提分攻略).docx VIP
- 期刊合作办刊协议书.docx VIP
- 驭胜s350维修手册及电路图n351整车电路图全.pdf VIP
- 混凝土热工计算软件.xls VIP
- 小学信息技术教学计划.docx VIP
- 八 观察物体(二)(单元教学设计)苏教版 三年级上册数学2025版.pdf
- 七上语文常考必背重点知识梳理总结(答案版)【2024新版】.pdf VIP
- 最全面总工会招聘考试工会知识模拟试卷及答案(共五套).docx
- 2020年总工会招聘考试工会知识模拟试卷及答案(一).docx VIP
- 2025最新初三英语中考模拟试卷(5套).docx VIP
原创力文档


文档评论(0)