nbus_memory.c 875 B

12345678910111213141516171819202122232425262728293031323334
  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 = {nbus_store_param, nbus_read_param,
  10. nbus_memory_id};
  11. nBus_memoryInterface_t *getnbusMemoryInterface(void) {
  12. return &memory_itnerface;
  13. }
  14. void nbus_memory_init(nBus_MemoryDriver *driver) {
  15. memoryImplementation = driver;
  16. }
  17. nBus_memoryState_t nbus_store_param(uint8_t sensor_index, uint8_t param_name,
  18. uint32_t param_value) {
  19. return MEMORY_STORE_OK;
  20. }
  21. uint32_t nbus_read_param(uint8_t sensor_index, uint8_t param_name) {
  22. uint16_t adr = sensor_index + param_name;
  23. return memoryImplementation->read_word(adr);
  24. }
  25. uint8_t nbus_memory_id(uint8_t *data) {
  26. return memoryImplementation->read_id(data);
  27. }