Skip to content
Snippets Groups Projects
Commit 85a09a27 authored by Arist's avatar Arist
Browse files

add config_size

parent a7d1f72a
No related branches found
No related tags found
No related merge requests found
...@@ -897,8 +897,6 @@ struct max86150_sensor_config { ...@@ -897,8 +897,6 @@ struct max86150_sensor_config {
* Possible values are 10, 20, 50, 84, 100, 200. * Possible values are 10, 20, 50, 84, 100, 200.
*/ */
uint16_t ppg_sample_rate; uint16_t ppg_sample_rate;
/** Always zero. Reserved for future parameters. */
uint8_t _padding[10];
}; };
/** /**
...@@ -920,26 +918,25 @@ struct max86150_sensor_data { ...@@ -920,26 +918,25 @@ struct max86150_sensor_data {
* data from the sensor. You can then retrieve the samples using * data from the sensor. You can then retrieve the samples using
* :c:func:`epic_stream_read`. * :c:func:`epic_stream_read`.
* *
* :param max86150_sensor_config* config: Configuration for this sensor.
* :param size_t config_size: Size of ``config``.
* :returns: A sensor descriptor which can be used with * :returns: A sensor descriptor which can be used with
* :c:func:`epic_stream_read` or a negative error value: * :c:func:`epic_stream_read` or a negative error value:
* *
* - ``-EBUSY``: The MAX86150 driver or I2C bus are currently busy with other tasks
* and could not be acquired for enabling a sensor.
* - ``-ENOMEM``: The MAX86150 driver failed to create a stream queue. * - ``-ENOMEM``: The MAX86150 driver failed to create a stream queue.
* - ``-ENODEV``: The MAX86150 driver failed due to physical connectivity problem (broken wire, unpowered, etc). * - ``-ENODEV``: The MAX86150 driver failed due to physical connectivity problem
* - ``-EINVAL``: config->ppg_sample_rate is not one of 10, 20, 50, 84, 100, 200. * (broken wire, unpowered, etc).
* - ``-EINVAL``: config->ppg_sample_rate is not one of 10, 20, 50, 84, 100, 200
* or config_size is not size of config.
* *
* .. versionadded:: 1.13 * .. versionadded:: 1.13
*/ */
API(API_MAX86150_ENABLE, int epic_max86150_enable_sensor(struct max86150_sensor_config *config)); API(API_MAX86150_ENABLE, int epic_max86150_enable_sensor(struct max86150_sensor_config *config, size_t config_size));
/** /**
* Disable the MAX86150 sensor. * Disable the MAX86150 sensor.
* *
* :returns: 0 in case of success or a negative error value: * :returns: 0 in case of success or forward negative error value from stream_deregister.
*
* - ``-EBUSY``: The MAX86150 driver or I2C bus are currently busy with other tasks and
* could not be acquired for enabling a sensor.
* *
* .. versionadded:: 1.13 * .. versionadded:: 1.13
*/ */
......
...@@ -32,10 +32,15 @@ static struct stream_info max86150_stream; ...@@ -32,10 +32,15 @@ static struct stream_info max86150_stream;
/* Active */ /* Active */
static bool max86150_sensor_active = false; static bool max86150_sensor_active = false;
int epic_max86150_enable_sensor(struct max86150_sensor_config *config) int epic_max86150_enable_sensor(
{ struct max86150_sensor_config *config, size_t config_size
) {
int result = 0; int result = 0;
// if (sizeof(struct max86150_sensor_config) != config_size) {
// return -EINVAL;
// }
mutex_lock(&max86150_mutex); mutex_lock(&max86150_mutex);
hwlock_acquire(HWLOCK_I2C); hwlock_acquire(HWLOCK_I2C);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment