Skip to content

Commit

Permalink
sensing: fix doxygen warnings
Browse files Browse the repository at this point in the history
Add missing doxygen comments in various sensing headers.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
  • Loading branch information
lixuzha committed Apr 7, 2024
1 parent 2581228 commit 713cbfa
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 79 deletions.
65 changes: 35 additions & 30 deletions include/zephyr/sensing/sensing.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,20 @@ extern "C" {
*/
struct sensing_sensor_version {
union {
uint32_t value;
uint32_t value; /**< The version represented as a 32-bit value. */
struct {
uint8_t major;
uint8_t minor;
uint8_t hotfix;
uint8_t build;
uint8_t major; /**< The major version number. */
uint8_t minor; /**< The minor version number. */
uint8_t hotfix; /**< The hotfix version number. */
uint8_t build; /**< The build version number. */
};
};
};

/**
* @brief Macro to create a sensor version value.
*
*/
#define SENSING_SENSOR_VERSION(_major, _minor, _hotfix, _build) \
(FIELD_PREP(GENMASK(31, 24), _major) | \
FIELD_PREP(GENMASK(23, 16), _minor) | \
Expand Down Expand Up @@ -83,29 +87,31 @@ struct sensing_sensor_version {
*
*/
enum sensing_sensor_state {
SENSING_SENSOR_STATE_READY = 0,
SENSING_SENSOR_STATE_OFFLINE = 1,
SENSING_SENSOR_STATE_READY = 0, /**< The sensor is ready. */
SENSING_SENSOR_STATE_OFFLINE = 1, /**< The sensor is offline. */
};

/**
* @brief Sensing subsystem sensor config attribute
*
*/
enum sensing_sensor_attribute {
/**< The interval attribute of a sensor configuration. */
SENSING_SENSOR_ATTRIBUTE_INTERVAL = 0,
/**< The sensitivity attribute of a sensor configuration. */
SENSING_SENSOR_ATTRIBUTE_SENSITIVITY = 1,
/**< The latency attribute of a sensor configuration. */
SENSING_SENSOR_ATTRIBUTE_LATENCY = 2,
/**< The maximum number of attributes that a sensor configuration can have. */
SENSING_SENSOR_ATTRIBUTE_MAX,
};


/**
* @brief Define Sensing subsystem sensor handle
*
*/
typedef void *sensing_sensor_handle_t;


/**
* @brief Sensor data event receive callback.
*
Expand Down Expand Up @@ -151,41 +157,40 @@ struct sensing_sensor_info {
*
*/
struct sensing_callback_list {
sensing_data_event_t on_data_event;
void *context;
sensing_data_event_t on_data_event; /**< Callback function for a sensor data event. */
void *context; /**< Associated context with on_data_event */
};
/**
* @struct sensing_sensor_config
* @brief Sensing subsystem sensor configure, including interval, sensitivity, latency
*
*/
struct sensing_sensor_config {
enum sensing_sensor_attribute attri;
enum sensing_sensor_attribute attri; /**< Attribute of the sensor configuration. */

/** \ref SENSING_SENSITIVITY_INDEX_ALL */
int8_t data_field;
int8_t data_field; /**< Data field of the sensor configuration. */

union {
uint32_t interval;
uint32_t sensitivity;
uint64_t latency;
uint32_t interval; /**< Interval of the sensor configuration. */
uint32_t sensitivity; /**< Sensitivity of the sensor configuration. */
uint64_t latency; /**< Latency of the sensor configuration. */
};
};


/**
* @brief Get all supported sensor instances' information.
*
* This API just returns read only information of sensor instances, pointer info will
* directly point to internal buffer, no need for caller to allocate buffer,
* no side effect to sensor instances.
*
* @param num_sensors Get number of sensor instances.
*
* @param info For receiving sensor instances' information array pointer.
*
* @return 0 on success or negative error value on failure.
*/
/**
* @brief Get all supported sensor instances' information.
*
* This API just returns read only information of sensor instances, pointer info will
* directly point to internal buffer, no need for caller to allocate buffer,
* no side effect to sensor instances.
*
* @param num_sensors Get number of sensor instances.
*
* @param info For receiving sensor instances' information array pointer.
*
* @return 0 on success or negative error value on failure.
*/
int sensing_get_sensors(int *num_sensors, const struct sensing_sensor_info **info);

/**
Expand Down
35 changes: 19 additions & 16 deletions include/zephyr/sensing/sensing_datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
* system/chre/chre_api/include/chre_api/chre/sensor_types.h
*/
struct sensing_sensor_value_header {
/** base timestamp of this data readings, unit is micro seconds */
/** Base timestamp of this data readings, unit is micro seconds */
uint64_t base_timestamp;
/** count of this data readings */
/** Count of this data readings */
uint16_t reading_count;
};

Expand All @@ -65,19 +65,20 @@ struct sensing_sensor_value_header {
* q31 version
*/
struct sensing_sensor_value_3d_q31 {
/**< Header of the sensor value data structure. */
struct sensing_sensor_value_header header;
int8_t shift;
int8_t shift; /**< Shift value of the sensor value data structure. */
struct {
uint32_t timestamp_delta;
uint32_t timestamp_delta; /**< Timestamp delta of the reading. */
union {
q31_t v[3];
q31_t v[3]; /**< 3D vector of the reading represented as an array. */
struct {
q31_t x;
q31_t y;
q31_t z;
q31_t x; /**< X value of the 3D vector. */
q31_t y; /**< Y value of the 3D vector. */
q31_t z; /**< Z value of the 3D vector. */
};
};
} readings[1];
} readings[1]; /**< Array of readings. */
};

/**
Expand All @@ -86,11 +87,12 @@ struct sensing_sensor_value_3d_q31 {
* uint32_t version
*/
struct sensing_sensor_value_uint32 {
/**< Header of the sensor value data structure. */
struct sensing_sensor_value_header header;
struct {
uint32_t timestamp_delta;
uint32_t v;
} readings[1];
uint32_t timestamp_delta; /**< Timestamp delta of the reading. */
uint32_t v; /**< Value of the reading. */
} readings[1]; /**< Array of readings. */
};

/**
Expand All @@ -99,12 +101,13 @@ struct sensing_sensor_value_uint32 {
* q31 version
*/
struct sensing_sensor_value_q31 {
/**< Header of the sensor value data structure. */
struct sensing_sensor_value_header header;
int8_t shift;
int8_t shift; /**< Shift value of the sensor value data structure. */
struct {
uint32_t timestamp_delta;
q31_t v;
} readings[1];
uint32_t timestamp_delta; /**< Timestamp delta of the reading. */
q31_t v; /**< Value of the reading. */
} readings[1]; /**< Array of readings. */
};


Expand Down
Loading

0 comments on commit 713cbfa

Please sign in to comment.