Nicely teardown peripheral's before StandBy

This commit is contained in:
Paul Warren 2017-01-01 21:34:04 +11:00
parent 9308765f6e
commit 3ecebbd2e1
3 changed files with 4653 additions and 4635 deletions

File diff suppressed because it is too large Load diff

View file

@ -57,7 +57,7 @@
#include "stm32f7xx_hal_i2c.h" #include "stm32f7xx_hal_i2c.h"
#include "stm32f7xx_hal_i2c_ex.h" #include "stm32f7xx_hal_i2c_ex.h"
#include "stm32f7xx_hal_tim_ex.h" #include "stm32f7xx_hal_tim_ex.h"
#include "stm32f7xx_hal_pwr.h"
#endif #endif

View file

@ -291,6 +291,19 @@ void setupPeripheralPower()
__I2C2_CLK_ENABLE(); __I2C2_CLK_ENABLE();
} }
void teardownPeripheralPower()
{
__GPIOA_CLK_DISABLE();
__GPIOB_CLK_DISABLE();
__GPIOC_CLK_DISABLE();
__GPIOD_CLK_DISABLE();
__GPIOE_CLK_DISABLE();
__DMA1_CLK_DISABLE();
__DMA2_CLK_DISABLE();
__I2C2_CLK_DISABLE();
}
void configDMA(SPI_HandleTypeDef *hspi) void configDMA(SPI_HandleTypeDef *hspi)
{ {
// static DMA_HandleTypeDef hdma_tx; // static DMA_HandleTypeDef hdma_tx;
@ -1275,6 +1288,7 @@ void updateMenu()
encoderPos = getPos(); encoderPos = getPos();
if(encoderPos != encoderLastPos) if(encoderPos != encoderLastPos)
{ {
teardownPeripheralPower();
shutDown(); shutDown();
} }
break; break;