This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Valid NV item Id 我设置的是0x201~0xfff之间
void SampleApp_HandleKeys( uint8 shift, uint8 keys )
{
uint8 Txdata[3]={0xAA,0x55,0xAA};
uint8 Rxdata[3]={0};
uint8 Res;
(void)shift; // Intentionally unreferenced parameter
if ( keys & HAL_ASKKEY_SW_1 ) //判断是哪个按键发生 做处理
{
//艾森测试这里让串口打印 P1.7 IS UP 同时改变LED状态
//HalUARTWrite(0,"P1.7 IS UP\n",11 );
HalUARTWrite(0,Txdata,3 );
Res=osal_nv_item_init( USER_NV_ID, 2, NULL );
HalUARTWrite(0,&Res,1 );
#if 0
Res=osal_nv_item_init( USER_NV_ID, 2, NULL );
osal_nv_read( USER_NV_ID, 0, 3, Rxdata );
HalUARTWrite(0,&Res,1 );
HalUARTWrite(0,Rxdata,3 );
uint8 Txdata[3]={0};
HalUARTWrite(0,"\n",1 );
osal_nv_write( USER_NV_ID, 0, 3,Txdata );
osal_nv_read( USER_NV_ID, 0, 3, Rxdata );
HalUARTWrite(0,"\n",1 );
HalUARTWrite(0,Rxdata,3 );
HalUARTWrite(0,"\n",1 );
#endif
}
}
我这里在按键里面做处理,按下就初始化 ,然后先读一次,再写进去,再读出来。但是一直失败,且失败返回都是 09
NV_ITEM_UNINIT Item is not initialized
您可以使用SYS_OSAL_NV_READ和ZComDef.h中定义的NV ID来检查特定ID的长度和偏移量。