mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c

Dependents:   Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay

Fork of mbed-dev by mbed official

Revision:
165:e614a9f1c9e2
Parent:
160:d5399cc887bb
Child:
169:e3b6fe271b81
--- a/targets/TARGET_NORDIC/TARGET_NRF5/i2c_api.c	Wed May 10 12:06:41 2017 +0100
+++ b/targets/TARGET_NORDIC/TARGET_NRF5/i2c_api.c	Fri May 26 12:39:01 2017 +0100
@@ -45,7 +45,7 @@
 #include "mbed_error.h"
 #include "nrf_twi.h"
 #include "nrf_drv_common.h"
-#include "nrf_drv_config.h"
+#include "sdk_config.h"
 #include "app_util_platform.h"
 #include "nrf_gpio.h"
 #include "nrf_delay.h"
@@ -62,6 +62,11 @@
 #endif
 #define TWI_INFO(obj)   (&m_twi_info[TWI_IDX(obj)])
 
+#ifdef TARGET_SDK13
+    #define TWI0_INSTANCE_INDEX 0
+    #define TWI1_INSTANCE_INDEX TWI0_INSTANCE_INDEX+TWI0_ENABLED
+#endif
+
 typedef struct {
     bool                initialized;
     uint32_t            pselsda;
@@ -98,22 +103,22 @@
 
 static const peripheral_handler_desc_t twi_handlers[TWI_COUNT] =
 {
-    #if TWI0_ENABLED
+#if TWI0_ENABLED
     {
         SPI0_TWI0_IRQn,
         (uint32_t) SPI0_TWI0_IRQHandler
     },
-    #endif
-    #if TWI1_ENABLED
+#endif
+#if TWI1_ENABLED
     {
         SPI1_TWI1_IRQn,
         (uint32_t) SPI1_TWI1_IRQHandler
     }
-    #endif
+#endif
 };
 #ifdef NRF51
     #define TWI_IRQ_PRIORITY  APP_IRQ_PRIORITY_LOW
-#elif defined(NRF52)
+#elif defined(NRF52) || defined(NRF52840_XXAA)
     #define TWI_IRQ_PRIORITY  APP_IRQ_PRIORITY_LOWEST
 #endif