@@ -342,7 +342,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
342
342
// / @param power_mode The power mode
343
343
// / @param ec The error code to set if an error occurs
344
344
// / @return True if the power mode was set successfully, false otherwise
345
- bool set_accelerometer_power_mode (AccelerometerPowerMode power_mode, std::error_code &ec) {
345
+ bool set_accelerometer_power_mode (const AccelerometerPowerMode & power_mode, std::error_code &ec) {
346
346
uint8_t bitmask = 0x03 ;
347
347
set_bits_in_register_by_mask (static_cast <uint8_t >(Register::PWR_MGMT0), bitmask,
348
348
static_cast <uint8_t >(power_mode) & bitmask, ec);
@@ -353,7 +353,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
353
353
// / @param power_mode The power mode
354
354
// / @param ec The error code to set if an error occurs
355
355
// / @return True if the power mode was set successfully, false otherwise
356
- bool set_gyroscope_power_mode (GyroscopePowerMode power_mode, std::error_code &ec) {
356
+ bool set_gyroscope_power_mode (const GyroscopePowerMode & power_mode, std::error_code &ec) {
357
357
uint8_t bitmask = 0x03 ;
358
358
set_bits_in_register_by_mask (static_cast <uint8_t >(Register::PWR_MGMT0), bitmask << 2 ,
359
359
(static_cast <uint8_t >(power_mode) & bitmask) << 2 , ec);
@@ -364,7 +364,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
364
364
// / @param bw The filter bandwidth
365
365
// / @param ec The error code to set if an error occurs
366
366
// / @return True if the filter bandwidth was set successfully, false otherwise
367
- bool set_accelerometer_filter (SensorFilterBandwidth bw, std::error_code &ec) {
367
+ bool set_accelerometer_filter (const SensorFilterBandwidth & bw, std::error_code &ec) {
368
368
// ACCEL_FILT_BW is bits 2-0 in ACCEL_CONFIG1
369
369
uint8_t mask = 0x07 ;
370
370
uint8_t data = static_cast <uint8_t >(bw) & mask;
@@ -376,7 +376,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
376
376
// / @param bw The filter bandwidth
377
377
// / @param ec The error code to set if an error occurs
378
378
// / @return True if the filter bandwidth was set successfully, false otherwise
379
- bool set_gyroscope_filter (SensorFilterBandwidth bw, std::error_code &ec) {
379
+ bool set_gyroscope_filter (const SensorFilterBandwidth & bw, std::error_code &ec) {
380
380
// GYRO_FILT_BW is bits 2-0 in GYRO_CONFIG1
381
381
uint8_t mask = 0x07 ;
382
382
uint8_t data = static_cast <uint8_t >(bw) & mask;
@@ -412,7 +412,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
412
412
// / @param ec The error code to set if an error occurs
413
413
// / @return True if the DMP output data rate was set successfully, false
414
414
// / otherwise
415
- bool set_dmp_odr (DmpODR odr, std::error_code &ec) {
415
+ bool set_dmp_odr (const DmpODR & odr, std::error_code &ec) {
416
416
// DMP ODR is bits 1-0 in APEX_CONFIG1
417
417
uint8_t mask = 0x03 ;
418
418
uint8_t data = static_cast <uint8_t >(odr) & mask;
@@ -504,7 +504,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
504
504
// / @param bypassed True if the FIFO is bypassed, false otherwise
505
505
// / @param ec The error code to set if an error occurs
506
506
// / @return True if the FIFO buffer was configured successfully, false otherwise
507
- bool configure_fifo (FifoMode mode, bool bypassed, std::error_code &ec) {
507
+ bool configure_fifo (const FifoMode & mode, bool bypassed, std::error_code &ec) {
508
508
// FIFO_MODE is bit 1, FIFO_BYPASS is bit 0
509
509
uint8_t data = (static_cast <uint8_t >(mode) << 1 ) | (bypassed ? 1 : 0 );
510
510
write_u8_to_register (static_cast <uint8_t >(Register::FIFO_CONFIG1), data, ec);
@@ -559,14 +559,8 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
559
559
}
560
560
561
561
// / Get the FIFO data
562
- // / @param data The buffer to store the FIFO data
563
- // / @param size The size of the buffer
564
562
// / @param ec The error code to set if an error occurs
565
- // / @return The number of bytes read
566
- size_t fifo_data (uint8_t *data, size_t size, std::error_code &ec) {
567
- return read (static_cast <uint8_t >(Register::FIFO_DATA), data, size, ec);
568
- }
569
-
563
+ // / @return The FIFO data
570
564
std::vector<uint8_t > fifo_data (std::error_code &ec) {
571
565
// get the count
572
566
uint16_t count = fifo_count (ec);
@@ -578,7 +572,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
578
572
std::vector<uint8_t > buffer (count);
579
573
580
574
// read the data
581
- size_t read_count = fifo_data ( buffer.data (), count, ec);
575
+ size_t read_count = read ( static_cast < uint8_t >(Register::FIFO_DATA), buffer.data (), count, ec);
582
576
if (ec) {
583
577
return {};
584
578
}
@@ -830,7 +824,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
830
824
z_extension; // /< Z-axis extension data (accelz [3:0] high nibble + gyroz [3:0] low nibble)
831
825
};
832
826
833
- static float accelerometer_range_to_sensitivty (AccelerometerRange range) {
827
+ static float accelerometer_range_to_sensitivty (const AccelerometerRange & range) {
834
828
switch (range) {
835
829
case AccelerometerRange::RANGE_16G:
836
830
return ACCEL_FS_16G_SENS;
@@ -845,7 +839,7 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
845
839
}
846
840
}
847
841
848
- static float gyroscope_range_to_sensitivty (GyroscopeRange range) {
842
+ static float gyroscope_range_to_sensitivty (const GyroscopeRange & range) {
849
843
switch (range) {
850
844
case GyroscopeRange::RANGE_2000DPS:
851
845
return GYRO_FS_2000_SENS;
@@ -881,8 +875,8 @@ class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Int
881
875
};
882
876
}
883
877
884
- ImuConfig imu_config_; // /< IMU configuration
885
- }; // class Icm42607
878
+ ImuConfig imu_config_{} ; // /< IMU configuration
879
+ }; // class Icm42607
886
880
} // namespace espp
887
881
888
882
// for libfmt printing of relevant imu types and structs
0 commit comments