mbedmicro/mbed — pull request #643 by xiongyihui (2014-11-04 09:45:47+00:00)
Title: [HAL][NRF51822] enable I/O mapping feature of I2C and SPI

1. to enable any digital I/O of nRF51822 to be used as I2C's SDA/SCL or SPI's MISO/MOSI/SCK.
2. to avoid conflict between I2C and SPI.

The nRF51822's I2C_0 and SPI_0 (I2C_1, SPI_1 and SPIS1) share the same address. They can't be used at the same time. So we use I2C_0 and SPI_1 as default. See nRF51822 address information at nRF51822_PS v2.0.pdf - Table 15 Peripheral instance reference.

If we want to use I2C_1 or SPI_0, we use the following code:

```
I2C i2c1(NRF_I2C_1(p1), p2); // SPI spi0(NRF_SPI_0(p3), p4, p5);
```

The Micro `NRF_I2C_1(pin)` will do `((PinName)((uint32_t)pin | 0x10000))` to set a flag.