Simple test of tool chain with OSHChip

Dependencies:   mbed

Committer:
OSHChip
Date:
Tue Mar 22 07:57:23 2016 +0000
Revision:
0:69ded1c7cad0
Child:
1:23b7ed707d25
Initial publication of OSHChip_Blinky

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OSHChip 0:69ded1c7cad0 1 //
OSHChip 0:69ded1c7cad0 2 // OSHChip_Init.cpp
OSHChip 0:69ded1c7cad0 3 //
OSHChip 0:69ded1c7cad0 4 // This function allows OSHChip projects that use the UART for printf()
OSHChip 0:69ded1c7cad0 5 // to work with the target board set to nRF51-DK
OSHChip 0:69ded1c7cad0 6 //
OSHChip 0:69ded1c7cad0 7
OSHChip 0:69ded1c7cad0 8 //
OSHChip 0:69ded1c7cad0 9 // By the time your program gets to main(), the pre-main initialization has
OSHChip 0:69ded1c7cad0 10 // (among other things) setup the UART to use the nRF51-DK UART pins, and a
OSHChip 0:69ded1c7cad0 11 // transmission speed of 9600 Baud, 8N1.
OSHChip 0:69ded1c7cad0 12 //
OSHChip 0:69ded1c7cad0 13 // nRF51-DK
OSHChip 0:69ded1c7cad0 14 // RX_PIN_NUMBER = p11,
OSHChip 0:69ded1c7cad0 15 // TX_PIN_NUMBER = p9,
OSHChip 0:69ded1c7cad0 16 // CTS_PIN_NUMBER = p10,
OSHChip 0:69ded1c7cad0 17 // RTS_PIN_NUMBER = p8,
OSHChip 0:69ded1c7cad0 18 //
OSHChip 0:69ded1c7cad0 19 // For OSHChip, the default is TX on pin 1, RX on pin 2, and no CTS or RTS
OSHChip 0:69ded1c7cad0 20 // because OSHChip has so few I/O pins.
OSHChip 0:69ded1c7cad0 21 //
OSHChip 0:69ded1c7cad0 22 // Due to the default implementation of Serial I/O in mbed, when \n
OSHChip 0:69ded1c7cad0 23 // is set to the UART, all that is actually transmitted is the "newline".
OSHChip 0:69ded1c7cad0 24 // In a Unix/Mac environment this is usually sufficient, but in a
OSHChip 0:69ded1c7cad0 25 // DOS/Windows environment, \n\r needs to be sent.
OSHChip 0:69ded1c7cad0 26 //
OSHChip 0:69ded1c7cad0 27 // If you are using the Serial to USB service on the OSHChip_CMSIS_DAP,
OSHChip 0:69ded1c7cad0 28 // TXD (pin 1 on OSHChip as configured by this function) should be
OSHChip 0:69ded1c7cad0 29 // connected to the pin closest to the corner of the PCB on connector J5,
OSHChip 0:69ded1c7cad0 30 // which is labeled "RX In". RXD (pin 2 on OSHChip as configured by this
OSHChip 0:69ded1c7cad0 31 // function) should be connected to the other pin on J5 which is labeled
OSHChip 0:69ded1c7cad0 32 // "TX Out"
OSHChip 0:69ded1c7cad0 33 //
OSHChip 0:69ded1c7cad0 34
OSHChip 0:69ded1c7cad0 35 #include "nrf51.h"
OSHChip 0:69ded1c7cad0 36 #include "OSHChip_Pin_Names.h"
OSHChip 0:69ded1c7cad0 37
OSHChip 0:69ded1c7cad0 38 void OSHChip_Init(void)
OSHChip 0:69ded1c7cad0 39 {
OSHChip 0:69ded1c7cad0 40 NRF_UART0->PSELTXD = TX_PIN_NUMBER;
OSHChip 0:69ded1c7cad0 41 NRF_UART0->PSELRXD = RX_PIN_NUMBER;
OSHChip 0:69ded1c7cad0 42 NRF_UART0->PSELRTS = 0xFFFFFFFF;
OSHChip 0:69ded1c7cad0 43 NRF_UART0->PSELCTS = 0xFFFFFFFF;
OSHChip 0:69ded1c7cad0 44 }