EEPROM for SX1272
Dependencies: X_NUCLEO_IKS01A1 driver_mbed_TH02 LoRaWAN-lib-v1_0_1 SX1272Lib mbed
Fork of Canada-SX1272-LoRaWAN-Bootcamp by
Revision 9:4c8f32a4044d, committed 2018-02-14
- Comitter:
- terence304
- Date:
- Wed Feb 14 01:16:06 2018 +0000
- Parent:
- 8:bca4f3d51eaa
- Commit message:
- Update to support NUCLEO_L073RZ
Changed in this revision
app/eeprom.cpp | Show annotated file Show diff for this revision Revisions of this file |
app/eeprom.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/app/eeprom.cpp Wed Jan 24 18:22:00 2018 +0000 +++ b/app/eeprom.cpp Wed Feb 14 01:16:06 2018 +0000 @@ -2,11 +2,11 @@ #include "eeprom.h" #if defined( TARGET_NUCLEO_L476RG ) -#define DATA_EEPROM_BASE ( ( uint32_t )0x0807F800U ) -#define DATA_EEPROM_END ( ( uint32_t )DATA_EEPROM_BASE + 2048 ) -#elif defined( TARGET_NUCLEO_L152RE ) -#define DATA_EEPROM_BASE ( ( uint32_t )0x08080000U ) -#define DATA_EEPROM_END ( ( uint32_t )0x080807FFU ) +#define EEPROM_BASE ( ( uint32_t )0x0807F800U ) +#define EEPROM_END ( ( uint32_t )DATA_EEPROM_BASE + 2048 ) +#elif defined( TARGET_NUCLEO_L152RE ) || defined( TARGET_NUCLEO_L073RZ ) +#define EEPROM_BASE ( ( uint32_t )0x08080000U ) +#define EEPROM_END ( ( uint32_t )0x080807FFU ) #else #error "Please define EEPROM base address and size for your board " #endif @@ -15,11 +15,11 @@ { assert_param( buffer != NULL ); - // assert_param( addr >= DATA_EEPROM_BASE ); + // assert_param( addr >= EEPROM_BASE ); assert_param( buffer != NULL ); - assert_param( size < ( DATA_EEPROM_END - DATA_EEPROM_BASE ) ); + assert_param( size < ( EEPROM_END - EEPROM_BASE ) ); - memcpy( buffer, ( uint8_t* )DATA_EEPROM_BASE, size ); + memcpy( buffer, ( uint8_t* )EEPROM_BASE, size ); return SUCCESS; } @@ -30,13 +30,13 @@ uint32_t *flash = ( uint32_t* )buffer; assert_param( buffer != NULL ); - assert_param( size < ( DATA_EEPROM_END - DATA_EEPROM_BASE ) ); + assert_param( size < ( EEPROM_END - EEPROM_BASE ) ); HAL_FLASH_Unlock( ); for( uint32_t i = 0; i < n; i++ ) { - HAL_FLASH_Program( 0x02U, DATA_EEPROM_BASE + \ + HAL_FLASH_Program( 0x02U, EEPROM_BASE + \ ( 4 * i ), flash[i] ); }
--- a/app/eeprom.h Wed Jan 24 18:22:00 2018 +0000 +++ b/app/eeprom.h Wed Feb 14 01:16:06 2018 +0000 @@ -1,8 +1,6 @@ #ifndef EEPROM_H #define EEPROM_H -#include "stm32l1xx_hal_flash.h" - /*! * \brief Initialises the contents of EepromData */