| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef _NBUS_APPDRV_H_
- #define _NBUS_APPDRV_H_
- /**
- * @brief Implementation of nbus app driver
- * Embed NBus driver.
- */
- #include <stdint.h>
- #include "app_bridge.h"
- #include <stdbool.h>
- #include "master_config.h"
- #include "data_acquirer/data_acquirer.h"
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- ///////////////////////////////////////// Extended functionality of driver //////////////////////////////////////////
- /**
- * @brief Constructor of appdrv Driver.
- * @param: data buffer for measures
- * @return: pointer to interface
- */
- nBusAppInterface_t *getAppdrvDriver();
- ///////////////////////////////////////// Implementation of nBusAppInterface_t ////////////////////////////////////////
- void appdrv_init(void *hw_interface, void *hw_config);
- void appdrv_reset();
- nBus_sensorType_t appdrv_getType(uint8_t sensor_index);
- nBus_sensorCount_t appdrv_getSensorCount();
- uint8_t appdrv_getData(uint8_t sensor_index, uint8_t *data);
- nBus_statusType_t appdrv_setData(uint8_t *data, uint8_t count, uint8_t *response);
- uint8_t appdrv_hasParam(uint8_t sensor_index, nBus_param_t param_name);
- int32_t appdrv_getParam(uint8_t sensor_index, nBus_param_t param_name);
- nBus_statusType_t appdrv_setParam(uint8_t sensor_index, nBus_param_t param_name, int32_t param_value);
- nBus_statusType_t appdrv_start(void);
- nBus_statusType_t appdrv_stop(void);
- void appdrv_read(void);
- uint8_t appdrv_store(void);
- nBus_statusType_t appdrv_calibrate(uint8_t sensor_index);
- nBus_sensorFormat_t appdrv_getSensorFormat(uint8_t sensor_index);
- nBus_statusType_t appdrv_find(uint8_t enable);
- uint8_t appdrv_device_ready();
- #ifdef __cplusplus
- }
- #endif
- //////////////////////////////////////////////// Helper Functions //////////////////////////////////////////////////
- /**
- * @brief Write sensor values into data buffer.
- * @param data_out output byte buffer
- * @param offset_out buffer offset
- * @param sid sensor id
- * @param values sensor values to write
- * @param size number of values to write
- */
- uint16_t _write_sensor_values(uint8_t *data_out, uint16_t offset_out, uint8_t sid, int16_t *values, uint16_t size);
- /**
- * @brief Logic or for 3 operands. Equivalent to x == a || x == b.
- * @param x testing value
- * @param a option 1 (sensor ID)
- * @param b option 2 (sensor ID)
- * @return logic value
- */
- bool _or(uint8_t x, app_sid_t a, app_sid_t b);
- /**
- * @brief Logic or for 4 operands. Equivalent to x == a || x == b || x == c.
- * @param x testing value
- * @param a option 1 (sensor ID)
- * @param b option 2 (sensor ID)
- * @param b option 3 (sensor ID)
- * @return logic value
- */
- bool _or(uint8_t x, app_sid_t a, app_sid_t b, app_sid_t c);
- #endif // _NBUS_APPDRV_H_
|