|
|
@@ -9,17 +9,16 @@ typedef struct{
|
|
|
void (*uart_receive)(uint8_t *data, int n); // Start reciving n bytes and store in to data array.
|
|
|
// In interrupt mode.
|
|
|
void (*uart_transmit)(uint8_t *data, int n); // Send n bytes stored n data array
|
|
|
-void (*uart_abort_receive)(); // Abort inomming receive process
|
|
|
void (*led_on)(void); // turn on signaliation LED
|
|
|
void (*led_off)(void); // turn off signaliation LED
|
|
|
void (*led_toggle)(void); // toggle signaliation LED
|
|
|
-void (*timer_uart_start)(int n); // start timer for receiveng b bytes
|
|
|
- // It will be used to detect IDLE state in RX
|
|
|
-void (*timer_uart_stop)(void); // stop timer
|
|
|
+void (*delay_ms)(uint8_t); // blocking delay in ms
|
|
|
+uint8_t (*loop_callback)(void); // application calback for processign events: RX_complete, sensor_data_ready
|
|
|
}nBusPlatformInterface_t;
|
|
|
```
|
|
|
**Communication timer configuration:**
|
|
|
-- Timer used in ``timer_uart_start`` functino have to be preconfigured to time period equivalent to time needed to receive 1 byte. This time depend on selected communication speed of UART interface.
|
|
|
+@deprecated
|
|
|
+- Timer used in ``timer_uart_start`` function have to be preconfigured to time period equivalent to time needed to receive 1 byte. This time depend on selected communication speed of UART interface.
|
|
|
- Timer have to tun in interrupt mode.
|
|
|
|
|
|
In application, the 2 more callback have to be defined:
|
|
|
@@ -35,7 +34,7 @@ static inline void nbus_app_TIM_periodElapsed(){
|
|
|
nbus_cb_TIM_periodElapsed(); // call function in nBus stack
|
|
|
}
|
|
|
```
|
|
|
-### Practical integration
|
|
|
+### Practical integration
|
|
|
|
|
|
**Include file**
|
|
|
Copy file ``nbus_config.h.default`` to your project and rename it to ``nbus_config.h``
|
|
|
@@ -59,14 +58,13 @@ Include following header file to project:
|
|
|
**Create platform driver**
|
|
|
```c
|
|
|
nBusPlatformInterface_t hw_platform ={
|
|
|
- uart_receive_it, // these are pointers to existing functions
|
|
|
+ uart_receive, // these are pointers to existing functions
|
|
|
uart_send,
|
|
|
- uart_abort_receive,
|
|
|
led_on,
|
|
|
led_off,
|
|
|
led_toggle,
|
|
|
- timer_uart_start,
|
|
|
- timer_uart_stop
|
|
|
+ delay_ms,
|
|
|
+ loop_callback
|
|
|
};
|
|
|
```
|
|
|
|
|
|
@@ -100,12 +98,13 @@ nBus_MemoryDriver memory_ec20 = {
|
|
|
DS28EC20_init,
|
|
|
DS28EC20_readData4B,
|
|
|
DS28EC20_readData2B,
|
|
|
- DS28EC20_writeData4B,
|
|
|
- DS28EC20_writeData2B,
|
|
|
- DS28EC20_getId
|
|
|
+ DS28EC20_readData1B,
|
|
|
+ DS28EC20_writeData,
|
|
|
+ DS28EC20_getId,
|
|
|
+ DS28EC20_getCapacity,
|
|
|
};
|
|
|
memory_ec20.init(ONE_WIRE_GPIO_Port, ONE_WIRE_Pin); //applicatin level function call
|
|
|
-nbus_init_memory_driver(&memory_ec20, 16); // pass memory driver to nBus
|
|
|
+nbus_init_memory_driver(&memory_ec20); // pass memory driver to nBus
|
|
|
```
|
|
|
|
|
|
***Run application stack***
|