drivers/sensors: ism330dhcx: use endop bit in shub wait_completed

Use the endop bit in the status register (instead of using a k_sleep)
to wait until the current shub operation is completed.

Please note that the recent changes to k_sleep() API was also
breaking the compilation.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2020-04-01 14:17:24 +02:00 committed by Kumar Gala
commit fb815c65eb

View file

@ -419,10 +419,12 @@ static struct ism330dhcx_shub_slist {
static inline void ism330dhcx_shub_wait_completed(struct ism330dhcx_data *data) static inline void ism330dhcx_shub_wait_completed(struct ism330dhcx_data *data)
{ {
u16_t freq; ism330dhcx_status_master_t status;
freq = (data->accel_freq == 0) ? 26 : data->accel_freq; do {
k_sleep((2000U / freq) + 1); k_msleep(1);
ism330dhcx_sh_status_get(data->ctx, &status);
} while (status.sens_hub_endop == 0);
} }
static inline void ism330dhcx_shub_embedded_en(struct ism330dhcx_data *data, bool on) static inline void ism330dhcx_shub_embedded_en(struct ism330dhcx_data *data, bool on)