Hello,
I need to increase the sampling frequency for the QDEC peripheral (desktop mouse) using the Zephyr sensor module, but the needed function seems to be unimplemented, even in the most recent SDK version (2.6.0)
The following code return error -88:
const struct device *const qdec_dev = DEVICE_DT_GET(DT_ALIAS(qdec0)); struct sensor_value sampl_freq; sampl_freq.val1 = 200; // deafult is 100 per sensor_attr_get() sampl_freq.val2 = 0; int rc = sensor_attr_set(qdec_dev, SENSOR_CHAN_ROTATION, SENSOR_ATTR_SAMPLING_FREQUENCY, &sampl_freq); if (rc != 0) { printk("sensor_attr_set error: %d\n", rc); return 1; }
Which comes from this code in zephyr/drivers/sensor.h:
static inline int z_impl_sensor_attr_set(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val) { const struct sensor_driver_api *api = (const struct sensor_driver_api *)dev->api; if (api->attr_set == NULL) { return -ENOSYS; }
Isn't there really a way to set this attribute in zephyr yet?
Do I have to resort back to the nrfx drivers? If so can you provide a minimal sample?
Around the forum I can find code snippet relevant to it but never a complete, minimal sample.
Thanks.