Basic read/write from flash.
Dependencies: mbed-modifed
Diff: main.cpp
- Revision:
- 2:118a2f154b78
- Parent:
- 1:397846763432
- Child:
- 3:50a42705f3ea
--- a/main.cpp Mon Nov 09 19:17:13 2015 +0000 +++ b/main.cpp Mon Nov 09 19:44:16 2015 +0000 @@ -58,54 +58,9 @@ { ptr[i] = readEEPROMByte(roffset+i); } - roffset += nbytes; return; } -//Found this online and it claims that it resets ADC to work after deepsleep \_O_/ -void resetADC() -{ - RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - RCC_OscInitTypeDef RCC_OscInitStruct = {0}; - - /* Enable Power Control clock */ - __PWR_CLK_ENABLE(); - - /* The voltage scaling allows optimizing the power consumption when the device is - clocked below the maximum system frequency, to update the voltage scaling value - regarding system frequency refer to product datasheet. */ - __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - - /* Poll VOSF bit of in PWR_CSR. Wait until it is reset to 0 */ - while (__HAL_PWR_GET_FLAG(PWR_FLAG_VOS) != RESET) {}; - - /* Get the Oscillators configuration according to the internal RCC registers */ - HAL_RCC_GetOscConfig(&RCC_OscInitStruct); - - /* After wake-up from STOP reconfigure the system clock: Enable HSI and PLL */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; - RCC_OscInitStruct.HSEState = RCC_HSE_ON; - RCC_OscInitStruct.HSIState = RCC_HSI_OFF; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; - RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; - //RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; - RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6; - RCC_OscInitStruct.PLL.PLLDIV = RCC_PLL_DIV2; - if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) - { - //Error_Handler(); - } - - /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 - clocks dividers */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK; - RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; - if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) - { - //Error_Handler(); - } -} - int main(){ resetEEPROM(); pcSerial.printf("testing:\n");