2019-2020 Multisensor project using the X_NUCLEO_IKS01A3 sensor platform

Dependencies:   X_NUCLEO_IKS01A3

Revision:
7:4a3b6202963e
Parent:
6:b2e247935342
Child:
8:fa346d946e7e
--- a/main.cpp	Thu Sep 05 13:49:08 2019 +0000
+++ b/main.cpp	Thu Sep 05 15:43:50 2019 +0000
@@ -49,10 +49,12 @@
 #include "stm32l0xx_hal_flash.h"
 
 /* Defines */
-#define LIS2MDL_ODR         50.0    // Output data rate (10, 20, 50 or 100 Hz)
-#define LIS2MDL_LP          1       // Power mode (0 for high-resolution mode, 1 for low-power mode)
-#define LIS2MDL_LPF         0       // Bandwidht (0 for ODR/2, 1 for ODR/4)
-#define FS                  10.0    // Sampling frequency (Hz)      
+#define LIS2MDL_ODR             50.0    // Output data rate (10, 20, 50 or 100 Hz)
+#define LIS2MDL_LP              0       // Power mode (0 for high-resolution mode, 1 for low-power mode)
+#define LIS2MDL_LPF             0       // Bandwidth (0 for ODR/2, 1 for ODR/4)
+#define LIS2MDL_COMP_TEMP_EN    1       // Temperature compensation (0 disabled, 1 enabled)
+#define LIS2MDL_OFF_CANC        1       // Offset cancellation (0 for no offset cancellation, 1 for offset cancellation, 2 for set pulse only at power-on)
+#define FS                      12.5    // Sampling frequency (Hz)      
 
 /* Serial link */
 Serial pc(SERIAL_TX, SERIAL_RX);
@@ -274,6 +276,14 @@
     magnetometer->get_m_lpf(&read_reg_int);
     printf("LIS2MDL LPF = %1d\r\n", read_reg_int);
     
+    magnetometer->set_m_comp_temp_en(LIS2MDL_COMP_TEMP_EN);
+    magnetometer->get_m_comp_temp_en(&read_reg_int);
+    printf("LIS2MDL COMP_TEMP_EN = %1d\r\n", read_reg_int);
+    
+    magnetometer->set_m_off_canc(LIS2MDL_OFF_CANC);
+    magnetometer->get_m_off_canc(&read_reg_int);
+    printf("LIS2MDL OFF_CANC = %1d\r\n", read_reg_int);
+    
     /* Print Flash memory information */
     print_flash_info();