first commit

Dependencies:   mbed

Dependents:   ibeacon

Fork of BLE_WallbotBLE_Challenge by JKSoft

Committer:
tridung141196
Date:
Thu Dec 21 03:40:35 2017 +0000
Revision:
5:984cc7e96073
Parent:
0:76dfa9657d9d
eddystone url

Who changed what in which revision?

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