File tree Expand file tree Collapse file tree 5 files changed +9
-15
lines changed
libraries/Servo/src/nrf52 Expand file tree Collapse file tree 5 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ HardwarePWM* HwPWMx[] =
53
53
#endif
54
54
};
55
55
56
+ #if CFG_DEBUG
56
57
bool can_stringify_token (uintptr_t token)
57
58
{
58
59
uint8_t * t = (uint8_t *)&token;
@@ -91,8 +92,7 @@ void HardwarePWM::DebugOutput(Stream& logger)
91
92
}
92
93
logger.printf (" \n " );
93
94
}
94
-
95
-
95
+ #endif // CFG_DEBUG
96
96
97
97
// returns true ONLY when (1) no PWM channel has a pin, and (2) the owner token is nullptr
98
98
bool HardwarePWM::takeOwnership (uintptr_t token)
Original file line number Diff line number Diff line change @@ -76,17 +76,11 @@ class HardwarePWM
76
76
bool releaseOwnership (uintptr_t token);
77
77
78
78
// allows caller to verify that they own the peripheral
79
- __INLINE bool isOwner (uintptr_t token) const __attribute__((__always_inline__))
79
+ __INLINE bool isOwner (uintptr_t token) const
80
+ __attribute__ ((__always_inline__))
80
81
{
81
82
return this ->_owner_token == token;
82
83
}
83
- __INLINE bool takeOwnership (void const * token)
84
- { return takeOwnership ((uintptr_t )token); }
85
- __INLINE bool releaseOwnership (void const * token)
86
- { return releaseOwnership ((uintptr_t )token); }
87
- __INLINE bool isOwner (void const * token) const
88
- __attribute__ ((__always_inline__))
89
- { return isOwner ((uintptr_t )token); }
90
84
91
85
bool addPin (uint8_t pin);
92
86
bool removePin (uint8_t pin);
@@ -122,8 +116,9 @@ class HardwarePWM
122
116
uint8_t usedChannelCount () const ;
123
117
uint8_t freeChannelCount () const ;
124
118
125
- // for debug/validation
119
+ # if CFG_DEBUG
126
120
static void DebugOutput (Stream& logger);
121
+ #endif // CFG_DEBUG
127
122
};
128
123
129
124
extern HardwarePWM HwPWM0;
Original file line number Diff line number Diff line change @@ -41,8 +41,7 @@ Version Modified By Date Comments
41
41
unsigned long int count_duration=0 ;
42
42
volatile bool no_stop = false ;
43
43
uint8_t pin_sound=0 ;
44
- static char const * _toneToken = " Tone" ;
45
-
44
+ static uintptr_t _toneToken = 0x656e6f54 ; // 'T' 'o' 'n' 'e'
46
45
47
46
void tone (uint8_t pin, unsigned int frequency, unsigned long duration)
48
47
{
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ extern "C"
47
47
{
48
48
49
49
static uint8_t _lastAnalogWriteResolution;
50
- static char const * _analogToken = " analog " ;
50
+ static uintptr_t _analogToken = 0x676f6c41 ; // 'A' 'l' 'o' 'g'
51
51
52
52
/* *
53
53
* This will apply to all PWM Hardware currently used by analogWrite(),
Original file line number Diff line number Diff line change 21
21
#include < Arduino.h>
22
22
#include < Servo.h>
23
23
24
- static char const * _servoToken = " Servo " ;
24
+ static uintptr_t _servoToken = 0x76726553 ; // 'S' 'e' 'r' 'v'
25
25
26
26
static servo_t servos[MAX_SERVOS]; // static array of servo structures
27
27
uint8_t ServoCount = 0 ; // the total number of attached servos
You can’t perform that action at this time.
0 commit comments