Simple test of tool chain with OSHChip

Dependencies:   mbed

Committer:
OSHChip
Date:
Sat Mar 26 07:32:50 2016 +0000
Revision:
1:23b7ed707d25
Parent:
0:69ded1c7cad0
Added code to OSHChip_Init.c to change Baud

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OSHChip 0:69ded1c7cad0 1 //
OSHChip 0:69ded1c7cad0 2 // OSHChip_Blinky.cpp
OSHChip 0:69ded1c7cad0 3 //
OSHChip 0:69ded1c7cad0 4 // Default mbed nRF51822 platforms all have BLE added
OSHChip 0:69ded1c7cad0 5 //
OSHChip 0:69ded1c7cad0 6 // Default UART output on OSHChip pin 1 should be connected to OSHChip_CMSIS_DAP connector J5
OSHChip 0:69ded1c7cad0 7 // which is the 2 pin connector in the corner of the board. Connect to the pin closest to the
OSHChip 0:69ded1c7cad0 8 // corner of the board. If you are going to use serial input, connect the other pin of J5 to
OSHChip 0:69ded1c7cad0 9 // pin 2 of OSHChip. If you are not going to use the UART, OSHChip pins 1 and 2 can be re-assigned
OSHChip 0:69ded1c7cad0 10 //
OSHChip 0:69ded1c7cad0 11
OSHChip 0:69ded1c7cad0 12 #include "mbed.h"
OSHChip 0:69ded1c7cad0 13 #include "OSHChip_Pin_Names.h"
OSHChip 0:69ded1c7cad0 14
OSHChip 0:69ded1c7cad0 15 DigitalOut red_led(PinName LED_RED);
OSHChip 0:69ded1c7cad0 16 DigitalOut green_led(PinName LED_GREEN);
OSHChip 0:69ded1c7cad0 17 DigitalOut blue_led(PinName LED_BLUE);
OSHChip 0:69ded1c7cad0 18
OSHChip 0:69ded1c7cad0 19 #define DELAY (100)
OSHChip 0:69ded1c7cad0 20 #define LED_ON (0)
OSHChip 0:69ded1c7cad0 21 #define LED_OFF (1)
OSHChip 0:69ded1c7cad0 22
OSHChip 0:69ded1c7cad0 23 int main(void)
OSHChip 0:69ded1c7cad0 24 {
OSHChip 0:69ded1c7cad0 25 uint32_t loop_count;
OSHChip 0:69ded1c7cad0 26
OSHChip 0:69ded1c7cad0 27 OSHChip_Init();
OSHChip 0:69ded1c7cad0 28
OSHChip 0:69ded1c7cad0 29 loop_count = 0;
OSHChip 0:69ded1c7cad0 30
OSHChip 0:69ded1c7cad0 31 while(1) {
OSHChip 0:69ded1c7cad0 32 red_led = LED_ON;
OSHChip 0:69ded1c7cad0 33
OSHChip 0:69ded1c7cad0 34 wait_ms(DELAY);
OSHChip 0:69ded1c7cad0 35
OSHChip 0:69ded1c7cad0 36 red_led = LED_OFF;
OSHChip 0:69ded1c7cad0 37
OSHChip 0:69ded1c7cad0 38 wait_ms(DELAY);
OSHChip 0:69ded1c7cad0 39
OSHChip 0:69ded1c7cad0 40 red_led = LED_ON;
OSHChip 0:69ded1c7cad0 41 green_led = LED_ON;
OSHChip 0:69ded1c7cad0 42
OSHChip 0:69ded1c7cad0 43 wait_ms(DELAY);
OSHChip 0:69ded1c7cad0 44
OSHChip 0:69ded1c7cad0 45 red_led = LED_OFF;
OSHChip 0:69ded1c7cad0 46 green_led = LED_OFF;
OSHChip 0:69ded1c7cad0 47 blue_led = LED_ON;
OSHChip 0:69ded1c7cad0 48
OSHChip 0:69ded1c7cad0 49 wait_ms(DELAY);
OSHChip 0:69ded1c7cad0 50
OSHChip 0:69ded1c7cad0 51 blue_led = LED_OFF;
OSHChip 0:69ded1c7cad0 52
OSHChip 0:69ded1c7cad0 53 printf("Loop Count: %8d\r\n", loop_count++);
OSHChip 0:69ded1c7cad0 54 }
OSHChip 0:69ded1c7cad0 55 }