|
|
@@ -79,7 +79,7 @@ void Icm20948::icm20948_device_reset()
|
|
|
}
|
|
|
|
|
|
|
|
|
-void Icm20948::Wakeup()
|
|
|
+void Icm20948::Wakeup(void)
|
|
|
{
|
|
|
uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_0, B0_PWR_MGMT_1);
|
|
|
new_val &= 0xBF;
|
|
|
@@ -88,7 +88,13 @@ void Icm20948::Wakeup()
|
|
|
HAL_Delay(100);
|
|
|
}
|
|
|
|
|
|
-void Icm20948::Sleep()
|
|
|
+uint8_t Icm20948::IsSleep(void)
|
|
|
+{
|
|
|
+ uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_0, B0_PWR_MGMT_1);
|
|
|
+ return new_val & 0x40;
|
|
|
+}
|
|
|
+
|
|
|
+void Icm20948::Sleep(void)
|
|
|
{
|
|
|
uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_0, B0_PWR_MGMT_1);
|
|
|
new_val |= 0x40;
|
|
|
@@ -354,6 +360,16 @@ void Sensor::SetScaleFactor(float sf){
|
|
|
_scaleFactor = sf;
|
|
|
}
|
|
|
|
|
|
+uint8_t Sensor::GetLowPassFilter(void){
|
|
|
+ return 0xFF;
|
|
|
+}
|
|
|
+
|
|
|
+uint8_t Sensor::GetSampleRate(void)
|
|
|
+{
|
|
|
+ return 0xFF;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
bool SensorGyro::Read(axises* data)
|
|
|
{
|
|
|
|
|
|
@@ -452,6 +468,7 @@ axises *SensorMag::GetData()
|
|
|
return &this->data;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
void SensorAccel::SetRange(accel_full_scale full_scale)
|
|
|
{
|
|
|
uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_2, B2_ACCEL_CONFIG);
|
|
|
@@ -510,6 +527,12 @@ void SensorGyro::SetRange(gyro_full_scale full_scale)
|
|
|
_spi->write_single_reg(_activeDevice, ub_2, B2_GYRO_CONFIG_1, new_val);
|
|
|
}
|
|
|
|
|
|
+uint8_t SensorGyro::GetLowPassFilter(void)
|
|
|
+{
|
|
|
+ uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_2, B2_GYRO_CONFIG_1);
|
|
|
+ return (new_val>>1) & 0x03;
|
|
|
+}
|
|
|
+
|
|
|
void SensorGyro::SetLowPassFilter(gyro_dlp_cfg config)
|
|
|
{
|
|
|
uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_2, B2_GYRO_CONFIG_1);
|
|
|
@@ -532,12 +555,22 @@ void SensorAccel::SetLowPassFilter(accel_dlp_cfg config)
|
|
|
_spi->write_single_reg(_activeDevice, ub_2, B2_GYRO_CONFIG_1, new_val);
|
|
|
}
|
|
|
|
|
|
+uint8_t SensorAccel::GetLowPassFilter(void)
|
|
|
+{
|
|
|
+ uint8_t new_val = _spi->read_single_reg(_activeDevice, ub_2, B2_ACCEL_CONFIG);
|
|
|
+ return (new_val>>1) & 0x03 ;
|
|
|
+}
|
|
|
|
|
|
void SensorGyro::SetSampleRate(gyro_samplerate divider)
|
|
|
{
|
|
|
_spi->write_single_reg(_activeDevice, ub_2, B2_GYRO_SMPLRT_DIV, divider);
|
|
|
}
|
|
|
|
|
|
+uint8_t SensorGyro::GetSampleRate(void)
|
|
|
+{
|
|
|
+ return _spi->read_single_reg(_activeDevice, ub_2, B2_GYRO_SMPLRT_DIV);
|
|
|
+}
|
|
|
+
|
|
|
void SensorAccel::SetSampleRate(accel_samplerate smplrt)
|
|
|
{
|
|
|
uint8_t divider_1 = (uint8_t)(smplrt >> 8);
|
|
|
@@ -547,4 +580,10 @@ void SensorAccel::SetSampleRate(accel_samplerate smplrt)
|
|
|
_spi->write_single_reg(_activeDevice, ub_2, B2_ACCEL_SMPLRT_DIV_2, divider_2);
|
|
|
}
|
|
|
|
|
|
+uint8_t SensorAccel::GetSampleRate(void)
|
|
|
+{
|
|
|
+ uint8_t d1 = _spi->read_single_reg(_activeDevice, ub_2, B2_ACCEL_SMPLRT_DIV_1);
|
|
|
+ uint8_t d2 = _spi->read_single_reg(_activeDevice, ub_2, B2_ACCEL_SMPLRT_DIV_2);
|
|
|
+ return (d1<<8 | d2);
|
|
|
+}
|
|
|
|