1515#include <pbdrv/clock.h>
1616#include <pbdrv/imu.h>
1717
18- #include <contiki.h>
18+ #include <pbio/busy_count.h>
19+
1920#include <lsm6ds3tr_c_reg.h>
2021
2122#include STM32_HAL_H
2425#include <stm32l4xx_ll_i2c.h>
2526#endif
2627
27- #include "../core.h"
2828#include "./imu_lsm6ds3tr_c_stm32.h"
2929
3030struct _pbdrv_imu_dev_t {
@@ -335,7 +335,7 @@ static pbio_error_t pbdrv_imu_lsm6ds3tr_c_stm32_process_thread(pbio_os_state_t *
335335
336336 PBIO_OS_AWAIT (state , & sub , err = pbdrv_imu_lsm6ds3tr_c_stm32_init (& sub ));
337337
338- pbdrv_init_busy_down ();
338+ pbio_busy_count_down ();
339339
340340 if (err != PBIO_SUCCESS ) {
341341 // The IMU is not essential. It just won't be available if init fails.
@@ -406,19 +406,19 @@ static pbio_error_t pbdrv_imu_lsm6ds3tr_c_stm32_process_thread(pbio_os_state_t *
406406
407407 // Cancellation complete.
408408 pbdrv_imu_lsm6ds3tr_c_stm32_i2c_reset (hi2c );
409- pbdrv_init_busy_down ();
409+ pbio_busy_count_down ();
410410 PBIO_OS_ASYNC_END (PBIO_ERROR_CANCELED );
411411}
412412
413413// internal driver interface implementation
414414
415415void pbdrv_imu_init (void ) {
416- pbdrv_init_busy_up ();
416+ pbio_busy_count_up ();
417417 pbio_os_process_start (& pbdrv_imu_lsm6ds3tr_c_stm32_process , pbdrv_imu_lsm6ds3tr_c_stm32_process_thread , NULL );
418418}
419419
420420void pbdrv_imu_deinit (void ) {
421- pbdrv_init_busy_up ();
421+ pbio_busy_count_up ();
422422 pbio_os_process_make_request (& pbdrv_imu_lsm6ds3tr_c_stm32_process , PBIO_OS_PROCESS_REQUEST_TYPE_CANCEL );
423423}
424424
@@ -428,7 +428,7 @@ pbio_error_t pbdrv_imu_get_imu(pbdrv_imu_dev_t **imu_dev, pbdrv_imu_config_t **c
428428
429429 // When this is called from pbio, driver initialization must have finished
430430 // and the process should be up and running to process sensor data.
431- if (pbdrv_init_busy () || pbdrv_imu_lsm6ds3tr_c_stm32_process .err != PBIO_ERROR_AGAIN ) {
431+ if (pbio_busy_count_busy () || pbdrv_imu_lsm6ds3tr_c_stm32_process .err != PBIO_ERROR_AGAIN ) {
432432 return PBIO_ERROR_FAILED ;
433433 }
434434
0 commit comments