Changed TARGET_NRF51822 target directory names to TARGET_MCU_NRF51822
Removed NRF51822 names to extra_label of target.py
Added MCU_NRF51822 names to extra_label of target.py
Tested with blinky example for NRF51822, HRM1017, ARCH_BLE and
RBLAB_NRF51822 target
Subsequently, the Peripheral Pin Definitions were added to the file called PeripheralPins.c to accommodate the removal of the definitions from the main xxx_api.c files and added it to each respective Target folder;
Added PeripheralPin.h to point to the PeripheralPin.c files in the target directories.
I commented out the non useful SPI pins and Serial pins from our hardware build;
For pwmout, I removed the non useful pins and added two more pins that are part of our hardware build.
LPC1114 has no semihosting and also no localfilesystem. I took the
liberty of guessing the LPC11Cxx also don't have those.
Sleep code did nothing outside of locking up the microcontroller
(because semihosting was enabled). Code seems to be copied from
LPC11u24, but the LPC1114 is fundamentally different. (For example
deep-sleep bit is now the deep-powerdown bit, which you dont want).
Aditionally it keeps current peripheral state during deepsleep and when
waking up. Datasheet rates LPC1114 at 6uA in deepsleep, I measured it at
3.7uA. That makes me a happy panda.
* The TXDATCTL register was used even if only the control signals were
modified which caused extra data to be transmitted.
* The RXDAT register does not only contain the received data, but also
control information in bits 16 to 20. The old code did not mask out
the control information and in rare cases that would cause the returned
data to include too much information (i.e. received 0xaa as data but the
function returned 0x300aa).
* The LPC1549 uses a Switch Matric (SWM) to allow any pin to have any
function. This is not used in the old code which simply assigned
the first instance of the SPI class to SPI0 and the second instance to
SPI1. The third instance would result in a call to error().
This behaviour is not at all working with real world examples where the
SPI bus contains more than two peripherals. The third peripheral would
cause the platform to end up in error().
The solution is to modify the get_available_spi() function to first see
if the MISO/MOSI/SCLK and SSEL pins are already configured for use as
either SPI0 or SPI1. If the exact same pins are already used then the
SPIx will be reused. If one or more pins are different then another
SPIx will be used (or if both are alredy in use then error()). With this
change it is now possible to do this:
MyFlash f(D11,D12,D13); // Will use SPI0
MyTemp t(D11,D12,D13); // Will use SPI0
SDFileSystem s(D11,D12,D13,"sd"); // Will use SPI0
MyDisplay d(D11,D12,D13); // Will use SPI0
The old/existing code would have resulted in this
MyFlash f(D11,D12,D13); // Will use SPI0
MyTemp t(D11,D12,D13); // Will use SPI1
SDFileSystem s(D11,D12,D13,"sd"); // error()
MyDisplay d(D11,D12,D13); // Will never be called
In fb90157c9a, asserts were introduced
changing the error checking style in large portions of the code base
from `if(error_condition) fail();` to `assert(!error_condition);`. In
doing so, not all boolean conditions were negated properly. This commit
restores the original semantics of the error checks as they were before
fb90157, (unless an error check has been changed upstream, in which
case it is ignored).
The practical effects of this commit is that it should restore proper
I2C and SPI functionality on the LPC15XX and nRF51822, respectively.