logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

readme.md (1526B)


  1. # Non-volatile Memory - Data Repositories
  2. This area is intentionally structured in the following way:
  3. ```
  4. ╰- quantum
  5. ╰- nvm
  6. ├- readme.md
  7. ├- rules.mk
  8. |
  9. ├- nvm_eeconfig.h
  10. ├- nvm_<<system>>.h
  11. |
  12. ├- eeprom
  13. | ├- nvm_eeconfig.c
  14. | ├- nvm_<<system>>.c
  15. | ╰- ...
  16. |
  17. ├- <<another provider>>
  18. | ├- nvm_eeconfig.c
  19. | ├- nvm_<<system>>.c
  20. | ╰- ...
  21. ╰- ...
  22. ```
  23. At the base `nvm` level, for every QMK core system which requires persistence there must be a corresponding `nvm_<<system>>.h` header file. This provides the data repository API to the "owner" system, and allows the underlying data persistence mechanism to be abstracted away from upper code. Any conversion to/from a `.raw` field should occur inside the `nvm_<<system>>.c` layer, with the API using values, such as structs or unions exposed to the rest of QMK.
  24. Each `nvm` "provider" is a corresponding child directory consisting of its name, such as `eeprom`, and corresponding `nvm_<<system>>.c` implementation files which provide the concrete implementation of the upper `nvm_<<system>>.h`.
  25. New systems requiring persistence can add the corresponding `nvm_<<system>>.h` file, and in most circumstances must also implement equivalent `nvm_<<system>>.c` files for every `nvm` provider. If persistence is not possible for that system, a `nvm_<<system>>.c` file with simple stubs which ignore writes and provide sane defaults must be used instead.