nbus_memory.c 795 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * nbus_memory.c
  3. *
  4. * Created on: Nov 4, 2023
  5. * Author: juraj
  6. */
  7. #include "nbus_memory.h"
  8. nBus_MemoryDriver *memoryImplementation;
  9. nBus_memoryInterface_t memory_itnerface = {
  10. nbus_store_param,
  11. nbus_read_param,
  12. nbus_memory_id
  13. };
  14. nBus_memoryInterface_t *getnbusMemoryInterface(void){
  15. return &memory_itnerface;
  16. }
  17. void nbus_memory_init(nBus_MemoryDriver *driver){
  18. memoryImplementation = driver;
  19. }
  20. nBus_memoryState_t nbus_store_param(uint8_t sensor_index, uint8_t param_name, uint32_t param_value){
  21. return MEMORY_STORE_OK;
  22. }
  23. uint32_t nbus_read_param(uint8_t sensor_index, uint8_t param_name){
  24. uint16_t adr = sensor_index + param_name;
  25. return memoryImplementation->read_word(adr);
  26. }
  27. uint8_t nbus_memory_id(uint8_t* data) {
  28. return memoryImplementation->read_id(data);
  29. }