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.

CC2530: Osal Write/Read example

Part Number: CC2530


Hi,

I wanted to know if there are any examples of code that demonstrate how to save variables into the memory of the CC2530 SampleLight program? I am not familiar with the usage of osal write/read function and I wanted to know what values I would put in the parameters. For example, how would I save the value "x=1" using osal?

  • You can use osal_nv_write() and osal_nv_read() for this purpose. The following code is an example to write/read a byte on NV

    uint8 nv_test=0x78;
    uint16 nv_test_id=0x0401;
    osal_nv_item_init(nv_test_id, 1, NULL);

    osal_nv_write(nv_test_id, 0, 1, &nv_test);
    osal_nv_read(nv_test_id, 0, 1, &nv_test);