Browse Source

add memory layer (first, non-functional)

Juraj Ďuďák 2 years ago
parent
commit
2fb3ae3fb1
3 changed files with 12 additions and 9 deletions
  1. 10 7
      Core/Src/main.c
  2. 1 1
      Modules/nbus
  3. 1 1
      Modules/one-wire-memory

+ 10 - 7
Core/Src/main.c

@@ -23,9 +23,6 @@
 /* USER CODE BEGIN Includes */
 #include "nbus_app.h"
 #include "app_dummy.h"
-#include "one_wire.h"
-#include "one_wire.h"
-#include "memory_ec20.h"
 /* USER CODE END Includes */
 
 /* Private typedef -----------------------------------------------------------*/
@@ -120,13 +117,19 @@ int main(void)
   periph.led = &Led;
   periph.rtc = &hrtc;
 
-  Ec20_MemoryDriver *memory = getEc20MemoryDriver();
-  memory->init(ONE_WIRE_GPIO_Port, ONE_WIRE_Pin);
-
-
   nBusAppInterface_t *dummy = getDummyDriver();
   nbus_init(&periph, dummy);
   nbus_init_app(periph.adc, NULL);
+
+  nBus_MemoryDriver memory_ec20 = {
+  		DS28EC20_init,
+  		DS28EC20_readData4B,
+  		DS28EC20_readData2B,
+  		DS28EC20_writeData4B,
+  		DS28EC20_writeData2B
+  };
+  memory_ec20.init(ONE_WIRE_GPIO_Port, ONE_WIRE_Pin);
+  nbus_init_memory_driver(&memory_ec20,16);
   nbus_stack();
 
   /* USER CODE END 2 */

+ 1 - 1
Modules/nbus

@@ -1 +1 @@
-Subproject commit 93290cf1273272823d9cda2e1a324eeb57bade93
+Subproject commit fda3d79fea05edbb62ad986798c1d1fc1003d205

+ 1 - 1
Modules/one-wire-memory

@@ -1 +1 @@
-Subproject commit 47ae5d8fc2a309bf9ecf94970020e6403856dfc7
+Subproject commit 2ee821dd1921fc27748236d881ee82cd4f8ac336