2019-2020 LPS22HH Altimeter Project

Dependencies:   X_NUCLEO_IKS01A3

Committer:
martlefebvre94
Date:
Thu Sep 05 13:49:08 2019 +0000
Revision:
6:b2e247935342
Parent:
5:7c883cce2bc4
Child:
7:4a3b6202963e
Program for LIS2MDL magnetometer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cparata 0:535249dc4bf5 1 /**
cparata 0:535249dc4bf5 2 ******************************************************************************
cparata 0:535249dc4bf5 3 * @file main.cpp
cparata 0:535249dc4bf5 4 * @author SRA
cparata 0:535249dc4bf5 5 * @version V1.0.0
cparata 0:535249dc4bf5 6 * @date 5-March-2019
cparata 5:7c883cce2bc4 7 * @brief Simple Example application for using the X_NUCLEO_IKS01A3
cparata 0:535249dc4bf5 8 * MEMS Inertial & Environmental Sensor Nucleo expansion board.
cparata 0:535249dc4bf5 9 ******************************************************************************
cparata 0:535249dc4bf5 10 * @attention
cparata 0:535249dc4bf5 11 *
cparata 0:535249dc4bf5 12 * <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
cparata 0:535249dc4bf5 13 *
cparata 0:535249dc4bf5 14 * Redistribution and use in source and binary forms, with or without modification,
cparata 0:535249dc4bf5 15 * are permitted provided that the following conditions are met:
cparata 0:535249dc4bf5 16 * 1. Redistributions of source code must retain the above copyright notice,
cparata 0:535249dc4bf5 17 * this list of conditions and the following disclaimer.
cparata 0:535249dc4bf5 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
cparata 0:535249dc4bf5 19 * this list of conditions and the following disclaimer in the documentation
cparata 0:535249dc4bf5 20 * and/or other materials provided with the distribution.
cparata 0:535249dc4bf5 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
cparata 0:535249dc4bf5 22 * may be used to endorse or promote products derived from this software
cparata 0:535249dc4bf5 23 * without specific prior written permission.
cparata 0:535249dc4bf5 24 *
cparata 0:535249dc4bf5 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
cparata 0:535249dc4bf5 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
cparata 0:535249dc4bf5 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
cparata 0:535249dc4bf5 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
cparata 0:535249dc4bf5 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
cparata 0:535249dc4bf5 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
cparata 0:535249dc4bf5 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
cparata 0:535249dc4bf5 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
cparata 0:535249dc4bf5 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
cparata 0:535249dc4bf5 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cparata 0:535249dc4bf5 35 *
cparata 0:535249dc4bf5 36 ******************************************************************************
cparata 5:7c883cce2bc4 37 */
cparata 0:535249dc4bf5 38
martlefebvre94 6:b2e247935342 39 /*
martlefebvre94 6:b2e247935342 40 LELEC2811 Magnetometer LIS2MDL Project
martlefebvre94 6:b2e247935342 41 M. Lefebvre - 2019
martlefebvre94 6:b2e247935342 42 */
martlefebvre94 6:b2e247935342 43
cparata 0:535249dc4bf5 44 /* Includes */
martlefebvre94 6:b2e247935342 45 #include <stdlib.h>
cparata 0:535249dc4bf5 46 #include "mbed.h"
cparata 0:535249dc4bf5 47 #include "XNucleoIKS01A3.h"
martlefebvre94 6:b2e247935342 48 #include "stm32l073xx.h"
martlefebvre94 6:b2e247935342 49 #include "stm32l0xx_hal_flash.h"
martlefebvre94 6:b2e247935342 50
martlefebvre94 6:b2e247935342 51 /* Defines */
martlefebvre94 6:b2e247935342 52 #define LIS2MDL_ODR 50.0 // Output data rate (10, 20, 50 or 100 Hz)
martlefebvre94 6:b2e247935342 53 #define LIS2MDL_LP 1 // Power mode (0 for high-resolution mode, 1 for low-power mode)
martlefebvre94 6:b2e247935342 54 #define LIS2MDL_LPF 0 // Bandwidht (0 for ODR/2, 1 for ODR/4)
martlefebvre94 6:b2e247935342 55 #define FS 10.0 // Sampling frequency (Hz)
martlefebvre94 6:b2e247935342 56
martlefebvre94 6:b2e247935342 57 /* Serial link */
martlefebvre94 6:b2e247935342 58 Serial pc(SERIAL_TX, SERIAL_RX);
martlefebvre94 6:b2e247935342 59
martlefebvre94 6:b2e247935342 60 /* Button */
martlefebvre94 6:b2e247935342 61 InterruptIn button1(USER_BUTTON);
martlefebvre94 6:b2e247935342 62 volatile bool button1_pressed = false; // Used in the main loop
martlefebvre94 6:b2e247935342 63 volatile bool button1_enabled = true; // Used for debouncing
martlefebvre94 6:b2e247935342 64 Timeout button1_timeout; // Used for debouncing
cparata 0:535249dc4bf5 65
cparata 0:535249dc4bf5 66 /* Instantiate the expansion board */
cparata 0:535249dc4bf5 67 static XNucleoIKS01A3 *mems_expansion_board = XNucleoIKS01A3::instance(D14, D15, D4, D5, A3, D6, A4);
cparata 0:535249dc4bf5 68
cparata 0:535249dc4bf5 69 /* Retrieve the composing elements of the expansion board */
cparata 0:535249dc4bf5 70 static LIS2MDLSensor *magnetometer = mems_expansion_board->magnetometer;
cparata 0:535249dc4bf5 71 static HTS221Sensor *hum_temp = mems_expansion_board->ht_sensor;
cparata 0:535249dc4bf5 72 static LPS22HHSensor *press_temp = mems_expansion_board->pt_sensor;
cparata 0:535249dc4bf5 73 static LSM6DSOSensor *acc_gyro = mems_expansion_board->acc_gyro;
cparata 0:535249dc4bf5 74 static LIS2DW12Sensor *accelerometer = mems_expansion_board->accelerometer;
cparata 0:535249dc4bf5 75 static STTS751Sensor *temp = mems_expansion_board->t_sensor;
cparata 0:535249dc4bf5 76
martlefebvre94 6:b2e247935342 77 /* Erase content of Flash memory */
martlefebvre94 6:b2e247935342 78 bool erase_flash(bool verbose)
cparata 0:535249dc4bf5 79 {
martlefebvre94 6:b2e247935342 80 printf("Erasing Flash memory...\r\n");
martlefebvre94 6:b2e247935342 81
martlefebvre94 6:b2e247935342 82 // Unlock Flash memory
martlefebvre94 6:b2e247935342 83 HAL_FLASH_Unlock();
cparata 0:535249dc4bf5 84
martlefebvre94 6:b2e247935342 85 // Erase Flash memory
martlefebvre94 6:b2e247935342 86 FLASH_EraseInitTypeDef eraser;
martlefebvre94 6:b2e247935342 87 uint32_t Flash_addr = FLASH_BANK2_BASE;
martlefebvre94 6:b2e247935342 88 uint32_t page_error = 0;
martlefebvre94 6:b2e247935342 89 int32_t page = 1;
martlefebvre94 6:b2e247935342 90
martlefebvre94 6:b2e247935342 91 while (Flash_addr < FLASH_BANK2_END) {
martlefebvre94 6:b2e247935342 92 eraser.TypeErase = FLASH_TYPEERASE_PAGES;
martlefebvre94 6:b2e247935342 93 eraser.PageAddress = Flash_addr;
martlefebvre94 6:b2e247935342 94 eraser.NbPages = 1;
martlefebvre94 6:b2e247935342 95 if(HAL_OK != HAL_FLASHEx_Erase(&eraser, &page_error)) {
martlefebvre94 6:b2e247935342 96 if (verbose) {printf("Flash erase failed!\r\n");}
martlefebvre94 6:b2e247935342 97 printf("Error 0x%X\r\n", page_error);
martlefebvre94 6:b2e247935342 98 HAL_FLASH_Lock();
martlefebvre94 6:b2e247935342 99 return false;
martlefebvre94 6:b2e247935342 100 }
martlefebvre94 6:b2e247935342 101 if (verbose) {printf("Erased page %d at address: 0x%X\r\n", page, Flash_addr);}
martlefebvre94 6:b2e247935342 102 Flash_addr += FLASH_PAGE_SIZE;
martlefebvre94 6:b2e247935342 103 page++;
martlefebvre94 6:b2e247935342 104 }
martlefebvre94 6:b2e247935342 105
martlefebvre94 6:b2e247935342 106 if (verbose) {printf("Flash erase succesful!\r\n");}
martlefebvre94 6:b2e247935342 107 return true;
martlefebvre94 6:b2e247935342 108 }
cparata 0:535249dc4bf5 109
martlefebvre94 6:b2e247935342 110 /* Write Flash memory */
martlefebvre94 6:b2e247935342 111 bool write_flash(uint32_t Flash_addr, uint32_t Flash_wdata, bool verbose)
martlefebvre94 6:b2e247935342 112 {
martlefebvre94 6:b2e247935342 113 // Unlock Flash memory
martlefebvre94 6:b2e247935342 114 HAL_FLASH_Unlock();
martlefebvre94 6:b2e247935342 115
martlefebvre94 6:b2e247935342 116 // Write Flash memory
martlefebvre94 6:b2e247935342 117 if (HAL_OK != HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, Flash_addr, Flash_wdata)) {
martlefebvre94 6:b2e247935342 118 if (verbose) {printf("Flash write failed!\r\n");}
martlefebvre94 6:b2e247935342 119 HAL_FLASH_Lock();
martlefebvre94 6:b2e247935342 120 return false;
martlefebvre94 6:b2e247935342 121 }
martlefebvre94 6:b2e247935342 122 if (verbose) {printf("Flash write succesful!\r\n");}
martlefebvre94 6:b2e247935342 123 HAL_FLASH_Lock();
martlefebvre94 6:b2e247935342 124 return true;
martlefebvre94 6:b2e247935342 125 }
cparata 0:535249dc4bf5 126
martlefebvre94 6:b2e247935342 127 /* Read Flash memory */
martlefebvre94 6:b2e247935342 128 void read_flash(uint32_t Flash_addr, uint32_t* Flash_rdata, uint32_t n_bytes)
martlefebvre94 6:b2e247935342 129 {
martlefebvre94 6:b2e247935342 130 memcpy(Flash_rdata, (uint32_t*) Flash_addr, n_bytes);
martlefebvre94 6:b2e247935342 131 }
cparata 0:535249dc4bf5 132
martlefebvre94 6:b2e247935342 133 /* Print Flash memory info */
martlefebvre94 6:b2e247935342 134 void print_flash_info()
martlefebvre94 6:b2e247935342 135 {
martlefebvre94 6:b2e247935342 136 printf("**************************************************\n\r");
martlefebvre94 6:b2e247935342 137 printf("/***** Flash memory info *****/\r\n");
martlefebvre94 6:b2e247935342 138 printf("Flash size: %d [B]\r\n", FLASH_SIZE);
martlefebvre94 6:b2e247935342 139 printf("Flash page size: %d [B]\r\n", FLASH_PAGE_SIZE);
martlefebvre94 6:b2e247935342 140 printf("Flash nb of pages: %d \r\n", FLASH_SIZE/FLASH_PAGE_SIZE);
martlefebvre94 6:b2e247935342 141 printf("Flash bank 1 base address: 0x%X\r\n", FLASH_BASE);
martlefebvre94 6:b2e247935342 142 printf("Flash bank 1 end address: 0x%X\r\n", FLASH_BANK1_END);
martlefebvre94 6:b2e247935342 143 printf("Flash bank 2 base address: 0x%X\r\n", FLASH_BANK2_BASE);
martlefebvre94 6:b2e247935342 144 printf("Flash bank 2 end address: 0x%X\r\n", FLASH_BANK2_END);
martlefebvre94 6:b2e247935342 145 printf("**************************************************\n\r");
martlefebvre94 6:b2e247935342 146 }
cparata 0:535249dc4bf5 147
martlefebvre94 6:b2e247935342 148 /* Enables button when bouncing is over */
martlefebvre94 6:b2e247935342 149 void button1_enabled_cb(void)
martlefebvre94 6:b2e247935342 150 {
martlefebvre94 6:b2e247935342 151 button1_enabled = true;
cparata 0:535249dc4bf5 152 }
cparata 0:535249dc4bf5 153
martlefebvre94 6:b2e247935342 154 /* ISR handling button pressed event */
martlefebvre94 6:b2e247935342 155 void button1_onpressed_cb(void)
martlefebvre94 6:b2e247935342 156 {
martlefebvre94 6:b2e247935342 157 if (button1_enabled) { // Disabled while the button is bouncing
martlefebvre94 6:b2e247935342 158 button1_enabled = false;
martlefebvre94 6:b2e247935342 159 button1_pressed = true; // To be read by the main loop
martlefebvre94 6:b2e247935342 160 button1_timeout.attach(callback(button1_enabled_cb), 0.3); // Debounce time 300 ms
martlefebvre94 6:b2e247935342 161 }
martlefebvre94 6:b2e247935342 162 }
martlefebvre94 6:b2e247935342 163
martlefebvre94 6:b2e247935342 164 /* Acquisition task */
martlefebvre94 6:b2e247935342 165 bool acquisition_task(uint32_t* Flash_addr)
martlefebvre94 6:b2e247935342 166 {
martlefebvre94 6:b2e247935342 167 int32_t m_axes[3];
martlefebvre94 6:b2e247935342 168
martlefebvre94 6:b2e247935342 169 while (*Flash_addr < FLASH_BANK2_END) {
martlefebvre94 6:b2e247935342 170 // Read magnetometer data
martlefebvre94 6:b2e247935342 171 magnetometer->get_m_axes(m_axes);
martlefebvre94 6:b2e247935342 172
martlefebvre94 6:b2e247935342 173 // Save data to Flash memory
martlefebvre94 6:b2e247935342 174 for (int i=0; i<3; i++) {
martlefebvre94 6:b2e247935342 175 //printf("Writing to address: 0x%X\r\n", *Flash_addr);
martlefebvre94 6:b2e247935342 176 write_flash(*Flash_addr, (uint32_t) m_axes[i], false);
martlefebvre94 6:b2e247935342 177 *Flash_addr += 4;
martlefebvre94 6:b2e247935342 178 }
martlefebvre94 6:b2e247935342 179
martlefebvre94 6:b2e247935342 180 // Print data in terminal
martlefebvre94 6:b2e247935342 181 //printf("LIS2MDL [mag/mgauss]: %6d, %6d, %6d\r\n", ((uint32_t) m_axes[0]), ((uint32_t) m_axes[1]), ((uint32_t) m_axes[2]));
martlefebvre94 6:b2e247935342 182
martlefebvre94 6:b2e247935342 183 // Wait for acquisition period
martlefebvre94 6:b2e247935342 184 wait(1/FS);
martlefebvre94 6:b2e247935342 185
martlefebvre94 6:b2e247935342 186 // Stop saving data when button is pushed
martlefebvre94 6:b2e247935342 187 if (button1_pressed) {
martlefebvre94 6:b2e247935342 188 button1_pressed = false;
martlefebvre94 6:b2e247935342 189 printf("Data acquisition stopped\r\n");
martlefebvre94 6:b2e247935342 190 printf("Press 'R' to read the data\r\n");
martlefebvre94 6:b2e247935342 191
martlefebvre94 6:b2e247935342 192 // Save last address in Flash memory
martlefebvre94 6:b2e247935342 193 write_flash(FLASH_BANK2_BASE, *Flash_addr, false);
martlefebvre94 6:b2e247935342 194 return false;
martlefebvre94 6:b2e247935342 195 }
martlefebvre94 6:b2e247935342 196 }
martlefebvre94 6:b2e247935342 197 return false;
martlefebvre94 6:b2e247935342 198 }
martlefebvre94 6:b2e247935342 199
martlefebvre94 6:b2e247935342 200 /* Read task */
martlefebvre94 6:b2e247935342 201 void read_task()
martlefebvre94 6:b2e247935342 202 {
martlefebvre94 6:b2e247935342 203 char pc_input;
martlefebvre94 6:b2e247935342 204 uint32_t Flash_rdata[3];
martlefebvre94 6:b2e247935342 205 uint32_t Flash_addr;
martlefebvre94 6:b2e247935342 206
martlefebvre94 6:b2e247935342 207 // Read terminal input
martlefebvre94 6:b2e247935342 208 if (pc.readable()) {
martlefebvre94 6:b2e247935342 209 pc_input = pc.getc();
martlefebvre94 6:b2e247935342 210 //printf("Read character: %c\r\n", pc_input);
martlefebvre94 6:b2e247935342 211 }
martlefebvre94 6:b2e247935342 212 else {
martlefebvre94 6:b2e247935342 213 pc_input = 'a';
martlefebvre94 6:b2e247935342 214 }
martlefebvre94 6:b2e247935342 215
martlefebvre94 6:b2e247935342 216 // Read Flash memory if 'R' is pressed
martlefebvre94 6:b2e247935342 217 if ((pc_input == 'r') || (pc_input == 'R')) {
martlefebvre94 6:b2e247935342 218 // Read last written Flash address in Flash memory
martlefebvre94 6:b2e247935342 219 read_flash(FLASH_BANK2_BASE, &Flash_addr, 4);
martlefebvre94 6:b2e247935342 220
martlefebvre94 6:b2e247935342 221 // Data names
martlefebvre94 6:b2e247935342 222 printf("mag_X\tmag_Y\tmag_Z\r\n");
martlefebvre94 6:b2e247935342 223
martlefebvre94 6:b2e247935342 224 // Read Flash data
martlefebvre94 6:b2e247935342 225 uint32_t Flash_addr_temp = FLASH_BANK2_BASE + 4;
martlefebvre94 6:b2e247935342 226 while (Flash_addr_temp < Flash_addr) {
martlefebvre94 6:b2e247935342 227 //printf("Reading from address: 0x%X\r\n", Flash_addr_temp);
martlefebvre94 6:b2e247935342 228 read_flash(Flash_addr_temp, &Flash_rdata[0], 12);
martlefebvre94 6:b2e247935342 229 Flash_addr_temp += 12;
martlefebvre94 6:b2e247935342 230 printf("%6d\t%6d\t%6d\r\n", Flash_rdata[0], Flash_rdata[1], Flash_rdata[2]);
martlefebvre94 6:b2e247935342 231 }
martlefebvre94 6:b2e247935342 232 }
martlefebvre94 6:b2e247935342 233 }
martlefebvre94 6:b2e247935342 234
martlefebvre94 6:b2e247935342 235 /* Main */
cparata 5:7c883cce2bc4 236 int main()
cparata 5:7c883cce2bc4 237 {
cparata 5:7c883cce2bc4 238 uint8_t id;
martlefebvre94 6:b2e247935342 239 float read_reg;
martlefebvre94 6:b2e247935342 240 uint8_t read_reg_int;
martlefebvre94 6:b2e247935342 241
martlefebvre94 6:b2e247935342 242 bool save_data = false;
martlefebvre94 6:b2e247935342 243 uint32_t Flash_addr = FLASH_BANK2_BASE;
cparata 5:7c883cce2bc4 244
martlefebvre94 6:b2e247935342 245 /* Serial link configuration */
martlefebvre94 6:b2e247935342 246 pc.baud(115200);
martlefebvre94 6:b2e247935342 247
martlefebvre94 6:b2e247935342 248 /* Button configuration */
martlefebvre94 6:b2e247935342 249 button1.fall(callback(button1_onpressed_cb)); // Attach ISR to handle button press event
martlefebvre94 6:b2e247935342 250
martlefebvre94 6:b2e247935342 251 // Reset message
martlefebvre94 6:b2e247935342 252 printf("\n\r**************************************************\n\r");
martlefebvre94 6:b2e247935342 253 printf("LELEC2811 LIS2MDL Magnetometer Program\n\r");
martlefebvre94 6:b2e247935342 254 printf("**************************************************\n\r");
cparata 0:535249dc4bf5 255
martlefebvre94 6:b2e247935342 256 /* Enable LIS2MDL magnetometer sensor */
martlefebvre94 6:b2e247935342 257 magnetometer->enable();
martlefebvre94 6:b2e247935342 258
martlefebvre94 6:b2e247935342 259 /* LIS2MDL magnetometer sensor configuration */
martlefebvre94 6:b2e247935342 260 printf("/***** LIS2MDL magnetometer configuration *****/\r\n");
martlefebvre94 6:b2e247935342 261
martlefebvre94 6:b2e247935342 262 magnetometer->read_id(&id);
martlefebvre94 6:b2e247935342 263 printf("LIS2MDL magnetometer = 0x%X\r\n", id);
martlefebvre94 6:b2e247935342 264
martlefebvre94 6:b2e247935342 265 magnetometer->set_m_odr(LIS2MDL_ODR);
martlefebvre94 6:b2e247935342 266 magnetometer->get_m_odr(&read_reg);
martlefebvre94 6:b2e247935342 267 printf("LIS2MDL ODR = %1.1f [Hz]\r\n", read_reg);
martlefebvre94 6:b2e247935342 268
martlefebvre94 6:b2e247935342 269 magnetometer->set_m_lp(LIS2MDL_LP);
martlefebvre94 6:b2e247935342 270 magnetometer->get_m_lp(&read_reg_int);
martlefebvre94 6:b2e247935342 271 printf("LIS2MDL LP = %1d\r\n", read_reg_int);
martlefebvre94 6:b2e247935342 272
martlefebvre94 6:b2e247935342 273 magnetometer->set_m_lpf(LIS2MDL_LPF);
martlefebvre94 6:b2e247935342 274 magnetometer->get_m_lpf(&read_reg_int);
martlefebvre94 6:b2e247935342 275 printf("LIS2MDL LPF = %1d\r\n", read_reg_int);
martlefebvre94 6:b2e247935342 276
martlefebvre94 6:b2e247935342 277 /* Print Flash memory information */
martlefebvre94 6:b2e247935342 278 print_flash_info();
martlefebvre94 6:b2e247935342 279
martlefebvre94 6:b2e247935342 280 /* Information for the user */
martlefebvre94 6:b2e247935342 281 printf("Press blue button to start data acquisition\r\n");
martlefebvre94 6:b2e247935342 282 printf("Press 'R' to read previously measured data\r\n");
martlefebvre94 6:b2e247935342 283
martlefebvre94 6:b2e247935342 284 /* Acquisition loop */
martlefebvre94 6:b2e247935342 285 while(1) {
martlefebvre94 6:b2e247935342 286 // Start saving data when button is pushed
martlefebvre94 6:b2e247935342 287 if (button1_pressed) {
martlefebvre94 6:b2e247935342 288 button1_pressed = false;
martlefebvre94 6:b2e247935342 289 save_data = true;
martlefebvre94 6:b2e247935342 290 erase_flash(false);
martlefebvre94 6:b2e247935342 291 printf("Acquiring data...\r\n");
martlefebvre94 6:b2e247935342 292 printf("Press blue button to stop data acquisition\r\n");
martlefebvre94 6:b2e247935342 293 Flash_addr = FLASH_BANK2_BASE + 4;
martlefebvre94 6:b2e247935342 294 }
martlefebvre94 6:b2e247935342 295
martlefebvre94 6:b2e247935342 296 if (save_data) {
martlefebvre94 6:b2e247935342 297 // Acquisition task
martlefebvre94 6:b2e247935342 298 save_data = acquisition_task(&Flash_addr);
martlefebvre94 6:b2e247935342 299 }
martlefebvre94 6:b2e247935342 300 else {
martlefebvre94 6:b2e247935342 301 // Read task
martlefebvre94 6:b2e247935342 302 read_task();
martlefebvre94 6:b2e247935342 303 }
cparata 5:7c883cce2bc4 304 }
martlefebvre94 6:b2e247935342 305 }