The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Kojto
Date:
Wed Oct 29 11:02:04 2014 +0000
Revision:
91:031413cf7a89
Release 91 of the mbed library

Changes:

- RBLAB_NANO - new target addition
- NRF51_DK - new target addition
- NRF51_DONGLE - new target addition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 91:031413cf7a89 1 #ifndef _NRF_DELAY_H
Kojto 91:031413cf7a89 2 #define _NRF_DELAY_H
Kojto 91:031413cf7a89 3
Kojto 91:031413cf7a89 4 // #include "nrf.h"
Kojto 91:031413cf7a89 5
Kojto 91:031413cf7a89 6 /*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */
Kojto 91:031413cf7a89 7 #if defined ( __CC_ARM )
Kojto 91:031413cf7a89 8 static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
Kojto 91:031413cf7a89 9 {
Kojto 91:031413cf7a89 10 loop
Kojto 91:031413cf7a89 11 SUBS R0, R0, #1
Kojto 91:031413cf7a89 12 NOP
Kojto 91:031413cf7a89 13 NOP
Kojto 91:031413cf7a89 14 NOP
Kojto 91:031413cf7a89 15 NOP
Kojto 91:031413cf7a89 16 NOP
Kojto 91:031413cf7a89 17 NOP
Kojto 91:031413cf7a89 18 NOP
Kojto 91:031413cf7a89 19 NOP
Kojto 91:031413cf7a89 20 NOP
Kojto 91:031413cf7a89 21 NOP
Kojto 91:031413cf7a89 22 NOP
Kojto 91:031413cf7a89 23 NOP
Kojto 91:031413cf7a89 24 BNE loop
Kojto 91:031413cf7a89 25 BX LR
Kojto 91:031413cf7a89 26 }
Kojto 91:031413cf7a89 27 #elif defined ( __ICCARM__ )
Kojto 91:031413cf7a89 28 static void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
Kojto 91:031413cf7a89 29 {
Kojto 91:031413cf7a89 30 __ASM (
Kojto 91:031413cf7a89 31 "loop:\n\t"
Kojto 91:031413cf7a89 32 " SUBS R0, R0, #1\n\t"
Kojto 91:031413cf7a89 33 " NOP\n\t"
Kojto 91:031413cf7a89 34 " NOP\n\t"
Kojto 91:031413cf7a89 35 " NOP\n\t"
Kojto 91:031413cf7a89 36 " NOP\n\t"
Kojto 91:031413cf7a89 37 " NOP\n\t"
Kojto 91:031413cf7a89 38 " NOP\n\t"
Kojto 91:031413cf7a89 39 " NOP\n\t"
Kojto 91:031413cf7a89 40 " NOP\n\t"
Kojto 91:031413cf7a89 41 " NOP\n\t"
Kojto 91:031413cf7a89 42 " NOP\n\t"
Kojto 91:031413cf7a89 43 " NOP\n\t"
Kojto 91:031413cf7a89 44 " NOP\n\t"
Kojto 91:031413cf7a89 45 " BNE loop\n\t");
Kojto 91:031413cf7a89 46 }
Kojto 91:031413cf7a89 47 #elif defined ( __GNUC__ )
Kojto 91:031413cf7a89 48 static void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
Kojto 91:031413cf7a89 49 {
Kojto 91:031413cf7a89 50 do
Kojto 91:031413cf7a89 51 {
Kojto 91:031413cf7a89 52 __ASM volatile (
Kojto 91:031413cf7a89 53 "NOP\n\t"
Kojto 91:031413cf7a89 54 "NOP\n\t"
Kojto 91:031413cf7a89 55 "NOP\n\t"
Kojto 91:031413cf7a89 56 "NOP\n\t"
Kojto 91:031413cf7a89 57 "NOP\n\t"
Kojto 91:031413cf7a89 58 "NOP\n\t"
Kojto 91:031413cf7a89 59 "NOP\n\t"
Kojto 91:031413cf7a89 60 "NOP\n\t"
Kojto 91:031413cf7a89 61 "NOP\n\t"
Kojto 91:031413cf7a89 62 "NOP\n\t"
Kojto 91:031413cf7a89 63 "NOP\n\t"
Kojto 91:031413cf7a89 64 "NOP\n\t"
Kojto 91:031413cf7a89 65 "NOP\n\t"
Kojto 91:031413cf7a89 66 "NOP\n\t"
Kojto 91:031413cf7a89 67 );
Kojto 91:031413cf7a89 68 } while (--number_of_us);
Kojto 91:031413cf7a89 69 }
Kojto 91:031413cf7a89 70 #endif
Kojto 91:031413cf7a89 71
Kojto 91:031413cf7a89 72 void nrf_delay_ms(uint32_t volatile number_of_ms);
Kojto 91:031413cf7a89 73
Kojto 91:031413cf7a89 74 #endif