Skip to content

Commit

Permalink
add method to get the actual size of the flash
Browse files Browse the repository at this point in the history
  • Loading branch information
ficeto authored and ficeto committed May 18, 2015
1 parent 18349b2 commit ba65783
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ uint32_t EspClass::getFlashChipId(void)
return spi_flash_get_id();
}

uint32_t EspClass::getFlashChipRealSize(void)
{
return (1 << ((spi_flash_get_id() >> 16) & 0xFF));
}

uint32_t EspClass::getFlashChipSize(void)
{
uint32_t data;
Expand Down
3 changes: 3 additions & 0 deletions cores/esp8266/Esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class EspClass {
uint8_t getCpuFreqMHz(void);

uint32_t getFlashChipId(void);
//gets the actual chip size based on the flash id
uint32_t getFlashChipRealSize(void);
//gets the size of the flash as set by the compiler
uint32_t getFlashChipSize(void);
uint32_t getFlashChipSpeed(void);
FlashMode_t getFlashChipMode(void);
Expand Down

0 comments on commit ba65783

Please sign in to comment.