mbed-os github
Dependencies: ADS1015 Faulhaber HTU21D_mod MS5837_potless Sensor_Head_RevB_3 USBDevice_dfu Utilsdfu beep
Fork of ARNSRS_testDFU by
Diff: main.cpp
- Revision:
- 39:65ff3c4f9675
- Parent:
- 38:fe77b68eec37
- Child:
- 40:32d89e04ead1
diff -r fe77b68eec37 -r 65ff3c4f9675 main.cpp --- a/main.cpp Mon Mar 19 18:55:49 2018 +0000 +++ b/main.cpp Wed Mar 21 07:07:50 2018 +0000 @@ -143,7 +143,8 @@ bool EN_MODE_SECU = false; //Test des alim -DigitalIn V_USB(PA_0); +//DigitalIn V_USB(PA_0, PullUp); + DigitalIn V_PILES_2(PC_3); AnalogIn V_PILES(PA_1); @@ -190,11 +191,15 @@ if (GO > 1) NVIC_SystemReset(); } +//Pas nécessaire +/* void retour_alim() { DEBUG("-------------- interruption retour alim en cours ---------------\r\n"); NVIC_SystemReset(); } +*/ + //Passage en mode SECU void Mode_SECU() @@ -226,7 +231,6 @@ //Pos = Servo_Fuite.getPulses(); //UTILS::Store_A_Val((float)Pos, "Servo_Fuite"); //DEBUG(" position volet fuite sauvegardée = %d pulse(s)\r\n", Pos); - UTILS::UnMount_Flash(); Servo_Poumon.Sleep(); } @@ -234,6 +238,9 @@ void Stop_Sequence() { Mode_SECU(); + //ejection de la flash pour pas crasher le system de fichiers + UTILS::UnMount_Flash(); + DEBUG("----------------ARRET DE L'APPAREIL--------------------\r\n"); // préparation deepsleep @@ -258,23 +265,26 @@ DEBUG("\n\r Deepsleep méthode offensive !\n"); + /* HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN2); // pour PC_13 // Clear wake up Flag __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF2); // Enable wakeup pin WKUP2 HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2_LOW); // low parce qu'on veut que ça redémarre avec le user button TODO à passer sur High pour que ça redémarrage avec l'arrivée du hus sur l'USB - /* + */ + HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1); // pour PA_0 // Clear wake up Flag __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF1); // Enable wakeup pin WKUP2 - HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_HIGH); // high car on veut que ça redémarre à l'arrivée du jus - */ + HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1); // high est la valeur par défaut + // Set RTC back-up register RTC_BKP31R to indicate //later on that system has entered shutdown mode WRITE_REG( RTC->BKP31R, 0x1 ); //Enter shutdown mode DEBUG("\n\r Attention c'est du brutal ! bouton bleu pour ressort.... ZZZZZZZ ZZZZZ !!!\n"); + HAL_PWREx_EnterSHUTDOWNMode(); } @@ -609,14 +619,14 @@ HAL_Init(); - V_USB.mode(PullDown); // on force à zero tant que l'alim par les piles n'est pas en place + //V_USB.mode(PullDown); // on force à zero tant que l'alim par les piles n'est pas en place button.fall(&pressed); - vpile_off_on.rise (&retour_alim); + //vpile_off_on.rise (&retour_alim); __HAL_RCC_PWR_CLK_ENABLE(); HAL_PWR_EnableBkUpAccess(); - + int count = 0; while (1) {