Finish conversion back to uintptr_t token

This commit is contained in:
Henry Gabryjelski committed 2020-07-28 23:05:11 -07:00
1 parent a6e0d2c925
commit 0acacf67b8
5 files changed
+9 -15

No files matched your search

+2 -2
View File
@@ -53,6 +53,7 @@ HardwarePWM* HwPWMx[] =
#endif
};
#if CFG_DEBUG
bool can_stringify_token(uintptr_t token)
{
uint8_t * t = (uint8_t *)&token;
@@ -91,8 +92,7 @@ void HardwarePWM::DebugOutput(Stream& logger)
}
logger.printf("\n");
}
#endif // CFG_DEBUG
// returns true ONLY when (1) no PWM channel has a pin, and (2) the owner token is nullptr
bool HardwarePWM::takeOwnership(uintptr_t token)
+4 -9
View File
@@ -76,17 +76,11 @@ class HardwarePWM
bool releaseOwnership(uintptr_t token);
// allows caller to verify that they own the peripheral
__INLINE bool isOwner(uintptr_t token) const __attribute__((__always_inline__))
__INLINE bool isOwner(uintptr_t token) const
__attribute__ ((__always_inline__))
{
return this->_owner_token == token;
}
__INLINE bool takeOwnership (void const * token)
{ return takeOwnership((uintptr_t)token); }
__INLINE bool releaseOwnership(void const * token)
{ return releaseOwnership((uintptr_t)token); }
__INLINE bool isOwner (void const * token) const
__attribute__ ((__always_inline__))
{ return isOwner((uintptr_t)token); }
bool addPin (uint8_t pin);
bool removePin (uint8_t pin);
@@ -122,8 +116,9 @@ class HardwarePWM
uint8_t usedChannelCount() const;
uint8_t freeChannelCount() const;
// for debug/validation
#if CFG_DEBUG
static void DebugOutput(Stream& logger);
#endif // CFG_DEBUG
};
extern HardwarePWM HwPWM0;
+1 -2
View File
@@ -41,8 +41,7 @@ Version Modified By Date Comments
unsigned long int count_duration=0;
volatile bool no_stop = false;
uint8_t pin_sound=0;
static char const * _toneToken = "Tone";
static uintptr_t _toneToken = 0x656e6f54; // 'T' 'o' 'n' 'e'
void tone(uint8_t pin, unsigned int frequency, unsigned long duration)
{
+1 -1
View File
@@ -47,7 +47,7 @@ extern "C"
{
static uint8_t _lastAnalogWriteResolution;
static char const * _analogToken = "analog";
static uintptr_t _analogToken = 0x676f6c41; // 'A' 'l' 'o' 'g'
/**
* This will apply to all PWM Hardware currently used by analogWrite(),
+1 -1
View File
@@ -21,7 +21,7 @@
#include <Arduino.h>
#include <Servo.h>
static char const * _servoToken = "Servo";
static uintptr_t _servoToken = 0x76726553; // 'S' 'e' 'r' 'v'
static servo_t servos[MAX_SERVOS]; // static array of servo structures
uint8_t ServoCount = 0; // the total number of attached servos