本文整理汇总了C++中TICKS_LOW函数的典型用法代码示例。如果您正苦于以下问题:C++ TICKS_LOW函数的具体用法?C++ TICKS_LOW怎么用?C++ TICKS_LOW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TICKS_LOW函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MATCH
u16 MATCH(u16 measured, u16 desired) {
SerialPrint(UART,"Testing: ");
SerialPrint(UART,TICKS_LOW(desired), DEC);
SerialPrint(UART," <= ");
SerialPrint(UART,measured, DEC);
SerialPrint(UART," <= ");
SerialPrintln(TICKS_HIGH(desired), DEC);
return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);
}
示例2: MATCH
int MATCH(int measured, int desired) {
Serial.print("Testing: ");
Serial.print(TICKS_LOW(desired), DEC);
Serial.print(" <= ");
Serial.print(measured, DEC);
Serial.print(" <= ");
Serial.println(TICKS_HIGH(desired), DEC);
return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);
}
示例3: MATCH
//+=============================================================================
// The match functions were (apparently) originally MACROs to improve code speed
// (although this would have bloated the code) hence the names being CAPS
// A later release implemented debug output and so they needed to be converted
// to functions.
// I tried to implement a dual-compile mode (DEBUG/non-DEBUG) but for some
// reason, no matter what I did I could not get them to function as macros again.
// I have found a *lot* of bugs in the Arduino compiler over the last few weeks,
// and I am currently assuming that one of these bugs is my problem.
// I may revisit this code at a later date and look at the assembler produced
// in a hope of finding out what is going on, but for now they will remain as
// functions even in non-DEBUG mode
//
int MATCH (int measured, int desired)
{
DBG_PRINT("Testing: ");
DBG_PRINT(TICKS_LOW(desired), DEC);
DBG_PRINT(" <= ");
DBG_PRINT(measured, DEC);
DBG_PRINT(" <= ");
DBG_PRINTLN(TICKS_HIGH(desired), DEC);
return ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
}
示例4: MATCH_SPACE
int MATCH_SPACE(int measured_ticks, int desired_us) {
Serial.print("Testing space ");
Serial.print(measured_ticks * USECPERTICK, DEC);
Serial.print(" vs ");
Serial.print(desired_us, DEC);
Serial.print(": ");
Serial.print(TICKS_LOW(desired_us - MARK_EXCESS), DEC);
Serial.print(" <= ");
Serial.print(measured_ticks, DEC);
Serial.print(" <= ");
Serial.println(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS);
}
示例5: MATCH_SPACE
u16 MATCH_SPACE(u16 measured_ticks, u16 desired_us) {
SerialPrint(UART,"Testing space ");
SerialPrint(UART,measured_ticks * USECPERTICK, DEC);
SerialPrint(UART," vs ");
SerialPrint(UART,desired_us, DEC);
SerialPrint(UART,": ");
SerialPrint(UART,TICKS_LOW(desired_us - MARK_EXCESS), DEC);
SerialPrint(UART," <= ");
SerialPrint(UART,measured_ticks, DEC);
SerialPrint(UART," <= ");
SerialPrintln(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS);
}
示例6: MATCH_SPACE
int MATCH_SPACE(int measured_ticks, int desired_us) {
#ifdef DEBUG
Serial.print("Testing space ");
Serial.print(measured_ticks * USECPERTICK, DEC);
Serial.print(" vs ");
Serial.print(desired_us, DEC);
Serial.print(": ");
Serial.print(TICKS_LOW(desired_us - MARK_EXCESS), DEC);
Serial.print(" <= ");
Serial.print(measured_ticks, DEC);
Serial.print(" <= ");
Serial.println(TICKS_HIGH(desired_us + MARK_EXCESS), DEC); // SH 071112 - -> +
#endif
return measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS) && measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS); // SH 071112 - -> + in TICKS_HIGH
}
示例7: MATCH_SPACE
//+========================================================
// Due to sensor lag, when received, Spaces tend to be 100us too short
//
int MATCH_SPACE (int measured_ticks, int desired_us)
{
DBG_PRINT("Testing space ");
DBG_PRINT(measured_ticks * USECPERTICK, DEC);
DBG_PRINT(" vs ");
DBG_PRINT(desired_us, DEC);
DBG_PRINT(": ");
DBG_PRINT(TICKS_LOW(desired_us - MARK_EXCESS), DEC);
DBG_PRINT(" <= ");
DBG_PRINT(measured_ticks, DEC);
DBG_PRINT(" <= ");
DBG_PRINTLN(TICKS_HIGH(desired_us - MARK_EXCESS), DEC);
return ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
&& (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
}
示例8: MATCH
//+=============================================================================
// The match functions were (apparently) originally MACROs to improve code speed
// (although this would have bloated the code) hence the names being CAPS
// A later release implemented debug output and so they needed to be converted
// to functions.
// I tried to implement a dual-compile mode (DEBUG/non-DEBUG) but for some
// reason, no matter what I did I could not get them to function as macros again.
// I have found a *lot* of bugs in the Arduino compiler over the last few weeks,
// and I am currently assuming that one of these bugs is my problem.
// I may revisit this code at a later date and look at the assembler produced
// in a hope of finding out what is going on, but for now they will remain as
// functions even in non-DEBUG mode
//
int MATCH (int measured, int desired)
{
DBG_PRINT(F("Testing: "));
DBG_PRINT(TICKS_LOW(desired), DEC);
DBG_PRINT(F(" <= "));
DBG_PRINT(measured, DEC);
DBG_PRINT(F(" <= "));
DBG_PRINT(TICKS_HIGH(desired), DEC);
bool passed = ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
if (passed)
DBG_PRINTLN(F("?; passed"));
else
DBG_PRINTLN(F("?; FAILED"));
return passed;
}
示例9: MATCH_SPACE
//+========================================================
// Due to sensor lag, when received, Spaces tend to be 100us too short
//
int MATCH_SPACE (int measured_ticks, int desired_us)
{
DBG_PRINT(F("Testing space (actual vs desired): "));
DBG_PRINT(measured_ticks * USECPERTICK, DEC);
DBG_PRINT(F("us vs "));
DBG_PRINT(desired_us, DEC);
DBG_PRINT("us");
DBG_PRINT(": ");
DBG_PRINT(TICKS_LOW(desired_us - MARK_EXCESS) * USECPERTICK, DEC);
DBG_PRINT(F(" <= "));
DBG_PRINT(measured_ticks * USECPERTICK, DEC);
DBG_PRINT(F(" <= "));
DBG_PRINT(TICKS_HIGH(desired_us - MARK_EXCESS) * USECPERTICK, DEC);
bool passed = ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
&& (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
if (passed)
DBG_PRINTLN(F("?; passed"));
else
DBG_PRINTLN(F("?; FAILED"));
return passed;
}
示例10: MATCH
uint8_t MATCH(const uint16_t measured, const uint16_t desired)
{
return measured >= TICKS_LOW(desired) && measured <= TICKS_HIGH(desired);
}