修改示例代码simplePeriphel中的performPeriodicTask函数写flash,每隔1s触发一次:如下
static void performPeriodicTask( void ) {
。。。。
uint8 rgbValue[4]={0};
rgbValue[0] = gRed;
rgbValue[1] = gGreen;
rgbValue[2] = gBlue;
rgbValue[3] = gAlpha;
ret1 = osal_snv_write(0x80, 4, (uint8*)&rgbValue[0]);
。。。。。
。。。。。
}
iphone连接不上的错误提示是CBErrorDomain。
mark_xu:
1、note:the NV memory function is called and operated may take several milliseconds to complete, in addition,interrupts may be disabled for several milliseconds.It is best to execute these functions at times when they do not conflict with other timing-critical operations. and you operate the functions so frequently, maybe it destroy the work of ble protocol
2、maybe there are other reasons ,and I hope the note can inspires you to do something ,may you luck! and please share your way if you find a solution or an answer to it.thank you!
Roger Zhang:
回复 mark_xu:
mark, 你好, 我之前也测试过在写之前将EA置为0, 写之后将EA置为1来屏蔽其它所有中断,仍然会存在这个问题。
请问对于什么时候写flash对BLE流程影响小,您有什么好建议呢?
mark_xu:
回复 Roger Zhang:
一般在未连接时操作会好些