2222#include "hal/spi/spi.h"
2323
2424#define DRV_DBG (...)
25+ // #define DRV_DBG(...) console_printf(__VA_ARGS__)
2526
2627#define BIT (_idx ) (1 << _idx)
2728#define REG_VAL (_setbits , _clearbits ) \
@@ -297,7 +298,7 @@ static rt_err_t gyro_read_rad(gyro_dev_t gyro_dev, float gyr[3])
297298
298299 // change to NED coordinate
299300 bmi055_rotate_to_frd (gyr , (uint32_t )gyro_dev -> parent .user_data & 0x7F );
300-
301+
301302 return RT_EOK ;
302303}
303304
@@ -532,18 +533,18 @@ const static struct accel_ops __accel_ops = {
532533 accel_read ,
533534};
534535
535- #define GYRO_CONFIG \
536- { \
537- 1000, /* 1K sample rate */ \
538- 92 , /* 256Hz bandwidth */ \
539- GYRO_RANGE_2000DPS , /* +-2000 deg/s */ \
536+ #define GYRO_CONFIG \
537+ { \
538+ 1000, /* 1K sample rate */ \
539+ 92 , /* 256Hz bandwidth */ \
540+ GYRO_RANGE_2000DPS , /* +-2000 deg/s */ \
540541 }
541542
542- #define ACCEL_CONFIG \
543- { \
544- 1000, /* 1K sample rate */ \
545- 125 , /* 125Hz bandwidth */ \
546- ACCEL_RANGE_16G , /* +-16g */ \
543+ #define ACCEL_CONFIG \
544+ { \
545+ 1000, /* 1K sample rate */ \
546+ 125 , /* 125Hz bandwidth */ \
547+ ACCEL_RANGE_16G , /* +-16g */ \
547548 }
548549
549550static struct gyro_device gyro_dev = {
@@ -558,11 +559,11 @@ static struct accel_device accel_dev = {
558559 .bus_type = GYRO_SPI_BUS_TYPE
559560};
560561
561- rt_err_t drv_bmi055_init (const char * spi_device_name , const char * gyro_device_name , const char * accel_device_name , uint32_t dev_flags )
562+ rt_err_t drv_bmi055_init (const char * gyro_spi_device_name , const char * accel_spi_device_name , const char * gyro_device_name , const char * accel_device_name , uint32_t dev_flags )
562563{
563564 /* Initialize gyroscope */
564565
565- gyro_spi_dev = rt_device_find (spi_device_name );
566+ gyro_spi_dev = rt_device_find (gyro_spi_device_name );
566567 RT_ASSERT (gyro_spi_dev != NULL );
567568 /* config spi */
568569 {
@@ -585,7 +586,7 @@ rt_err_t drv_bmi055_init(const char* spi_device_name, const char* gyro_device_na
585586
586587 /* Initialize accelerometer */
587588
588- accel_spi_dev = rt_device_find ("spi1_dev4" );
589+ accel_spi_dev = rt_device_find (accel_spi_device_name );
589590 RT_ASSERT (accel_spi_dev != NULL );
590591 /* config spi */
591592 {
0 commit comments