Tutorial 2 - SOS: This is an embedded program which controls LED1 in order to show a blinking SOS pattern. The tutorial starts to organize helper functions like "morse" in a brick library which will grow and grow with each tutorial. Platform specifics are identified in "bricks/platform.h" by setting proper defines (like LED_INVERTED), which are used to achieve platform independent behaviour. The program has been tested on Nordic nRF51-DK and STM NUCLEO-F303K8, NUCLEO-F401RE and NUCLEO-L476RG.

Dependencies:   mbed

Committer:
hux
Date:
Sat Dec 10 18:34:23 2016 +0000
Revision:
1:10299215b49e
Some fine tuning; readme file added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hux 1:10299215b49e 1 T02_SOS - Blinking LED according to Morse SOS pattern
hux 1:10299215b49e 2
hux 1:10299215b49e 3 This demo program runs a repeated SOS morse pattern on LED1.
hux 1:10299215b49e 4 Helper function morse() is implemented as part of the bricks library (files
hux 1:10299215b49e 5 bricks/blink.cpp, bricks/blink.h and bricks/target.h.
hux 1:10299215b49e 6
hux 1:10299215b49e 7 We need a special header target.h with platformtarget specific definitions.
hux 1:10299215b49e 8 For example on a NUCLEO board LED1 needs to be assigned with a value of 1 for ON
hux 1:10299215b49e 9 and 0 for OFF. On a nRF51 board it is exactly the oposite.
hux 1:10299215b49e 10
hux 1:10299215b49e 11 In order to achieve opposite behavour the header target.h defines conditionally
hux 1:10299215b49e 12 the define LED_INVERTED (only if nRF51 platform board is selected), which is
hux 1:10299215b49e 13 processed in blink.cpp to proper definitions for LED_ON and LED_OFF.
hux 1:10299215b49e 14
hux 1:10299215b49e 15 See blink.cpp:
hux 1:10299215b49e 16
hux 1:10299215b49e 17 #ifndef LED_INVERTED
hux 1:10299215b49e 18 # define LED_ON 1
hux 1:10299215b49e 19 # define LED_OFF 0
hux 1:10299215b49e 20 #else
hux 1:10299215b49e 21 # define LED_ON 0
hux 1:10299215b49e 22 # define LED_OFF 1
hux 1:10299215b49e 23 #endif
hux 1:10299215b49e 24
hux 1:10299215b49e 25 To make it running the libraries BLE_API and X_NUCLEO_IDB0XA1 have to be
hux 1:10299215b49e 26 updated (e.g. to be copied from a working NUCLEO BLE program).
hux 1:10299215b49e 27
hux 1:10299215b49e 28 Tested Boards:
hux 1:10299215b49e 29 NUCLEO-L476RG, NUCLEO-F303K8, NUCLEO-F401RE
hux 1:10299215b49e 30 nRF51-DK
hux 1:10299215b49e 31