Theo Havercroft / nRF51822

Dependencies:   nrf51-sdk

Fork of nRF51822 by Lancaster University

Revision:
524:502e53732c75
Parent:
520:8252970f1d1e
Child:
527:180b820e70b6
--- a/source/nordic-sdk/components/drivers_nrf/pstorage/config/pstorage_platform.h	Wed Dec 02 12:58:42 2015 +0000
+++ b/source/nordic-sdk/components/drivers_nrf/pstorage/config/pstorage_platform.h	Wed Dec 02 13:14:17 2015 +0000
@@ -40,25 +40,19 @@
 #define PSTORAGE_PL_H__
 
 #include <stdint.h>
-#include "nrf.h"
 
-static __INLINE uint16_t pstorage_flash_page_size()
-{
-  return (uint16_t)NRF_FICR->CODEPAGESIZE;
-}
+#ifdef __cplusplus
+extern "C" {
+#endif // #ifdef __cplusplus
 
-#define PSTORAGE_FLASH_PAGE_SIZE     pstorage_flash_page_size()          /**< Size of one flash page. */
+#define PSTORAGE_FLASH_PAGE_SIZE    ((uint16_t)NRF_FICR->CODEPAGESIZE)   /**< Size of one flash page. */
 #define PSTORAGE_FLASH_EMPTY_MASK    0xFFFFFFFF                          /**< Bit mask that defines an empty address in flash. */
 
-static __INLINE uint32_t pstorage_flash_page_end()
-{
-   uint32_t bootloader_addr = NRF_UICR->BOOTLOADERADDR;
-  
-   return ((bootloader_addr != PSTORAGE_FLASH_EMPTY_MASK) ?
-           (bootloader_addr/ PSTORAGE_FLASH_PAGE_SIZE) : NRF_FICR->CODESIZE);
-}
+#define PSTORAGE_FLASH_PAGE_END                                     \
+        ((NRF_UICR->BOOTLOADERADDR != PSTORAGE_FLASH_EMPTY_MASK)    \
+        ? (NRF_UICR->BOOTLOADERADDR / PSTORAGE_FLASH_PAGE_SIZE)     \
+        : NRF_FICR->CODESIZE)
 
-#define PSTORAGE_FLASH_PAGE_END     pstorage_flash_page_end()
 
 #define PSTORAGE_MAX_APPLICATIONS   1                                                           /**< Maximum number of applications that can be registered with the module, configurable based on system requirements. */
 #define PSTORAGE_MIN_BLOCK_SIZE     0x0010                                                      /**< Minimum size of block that can be registered with the module. Should be configured based on system requirements, recommendation is not have this value to be at least size of word. */
@@ -86,6 +80,10 @@
 /**@brief Handles Flash Access Result Events. To be called in the system event dispatcher of the application. */
 void pstorage_sys_event_handler (uint32_t sys_evt);
 
+#ifdef __cplusplus
+}
+#endif // #ifdef __cplusplus
+
 #endif // PSTORAGE_PL_H__
 
 /** @} */