29.8.1.2.2 Workflow

  1. Create a buffer to hold a single emulated RWW EEPROM page of memory, and read out logical RWW EEPROM page zero into it.
    uint8_t page_data[RWW_EEPROM_PAGE_SIZE];
    rww_eeprom_emulator_read_page(0, page_data);
    
  2. Toggle the first byte of the read page.
    page_data[0] = !page_data[0];
    
  3. Output the toggled LED state onto the board LED.
    port_pin_set_output_level(LED_0_PIN, page_data[0]);
    
  4. Write the modified page back to logical RWW EEPROM page zero, flushing the internal emulator write cache afterwards to ensure it is immediately written to physical non-volatile memory.
    rww_eeprom_emulator_write_page(0, page_data);
    rww_eeprom_emulator_commit_page_buffer();
    
  5. Modify data and write back to logical EEPROM page zero. The data is not committed and should call rww_eeprom_emulator_commit_page_buffer to ensure that any outstanding cache data is fully written to prevent data loss when detecting a BOD early warning.
    page_data[1]=0x1;
    rww_eeprom_emulator_write_page(0, page_data);