Skip to content

Commit

Permalink
Removed conditional compilation blocks and added citation
Browse files Browse the repository at this point in the history
  • Loading branch information
satishgn committed Apr 21, 2014
1 parent 0276f5c commit fb2e45a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
11 changes: 0 additions & 11 deletions inc/spark_wiring_eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"

//#define CC3000_NVMEM_EEPROM_EMULATION
#define INTERNAL_FLASH_EEPROM_EMULATION

#if defined (CC3000_NVMEM_EEPROM_EMULATION)

//To Do

#elif defined (INTERNAL_FLASH_EEPROM_EMULATION)

/* Internal Flash Page size = 1KByte */
#define PAGE_SIZE (uint16_t)0x400

Expand Down Expand Up @@ -78,8 +69,6 @@ uint16_t EEPROM_Init(void);
uint16_t EEPROM_ReadVariable(uint16_t EepromAddress, uint16_t *EepromData);
uint16_t EEPROM_WriteVariable(uint16_t EepromAddress, uint16_t EepromData);

#endif

/* Arduino Compatibility Class -----------------------------------------------*/
class EEPROMClass
{
Expand Down
24 changes: 4 additions & 20 deletions src/spark_wiring_eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* @version V1.0.0
* @date 10-April-2014
* @brief This file provides all the EEPROM emulation functions.
* Based on ST Application Note for STM32: AN2594
* http://www.st.com/st-web-ui/static/active/en/resource/
* technical/document/application_note/CD00165693.pdf
******************************************************************************
Copyright (c) 2013-14 Spark Labs, Inc. All rights reserved.
Expand All @@ -26,12 +29,6 @@
/* Includes ------------------------------------------------------------------*/
#include "spark_wiring_eeprom.h"

#if defined (CC3000_NVMEM_EEPROM_EMULATION)

//To Do

#elif defined (INTERNAL_FLASH_EEPROM_EMULATION)

/* Global variable used to store variable value in read sequence */
uint16_t EepromDataVar = 0;

Expand Down Expand Up @@ -613,47 +610,34 @@ static uint16_t EEPROM_PageTransfer(uint16_t EepromAddress, uint16_t EepromData)
return FlashStatus;
}

#endif

/* Arduino Compatibility EEPROM methods */
EEPROMClass::EEPROMClass()
{
#if defined (CC3000_NVMEM_EEPROM_EMULATION)
//To Do
#elif defined (INTERNAL_FLASH_EEPROM_EMULATION)
EEPROM_Init();
for (uint16_t i = 0 ; i < EEPROM_SIZE ; i++)
{
EepromAddressTab[i] = i;
}
#endif
}

uint8_t EEPROMClass::read(int address)
{
#if defined (CC3000_NVMEM_EEPROM_EMULATION)
//To Do
#elif defined (INTERNAL_FLASH_EEPROM_EMULATION)
uint16_t data;

if ((address < EEPROM_SIZE) && (EEPROM_ReadVariable(EepromAddressTab[address], &data) == 0))
{
return data;
}
#endif

return 0xFF;
}

void EEPROMClass::write(int address, uint8_t value)
{
#if defined (CC3000_NVMEM_EEPROM_EMULATION)
//To Do
#elif defined (INTERNAL_FLASH_EEPROM_EMULATION)
if (address < EEPROM_SIZE)
{
EEPROM_WriteVariable(EepromAddressTab[address], value);
}
#endif
}

EEPROMClass EEPROM;

0 comments on commit fb2e45a

Please sign in to comment.