本文整理汇总了C++中PrintStream::printf_P方法的典型用法代码示例。如果您正苦于以下问题:C++ PrintStream::printf_P方法的具体用法?C++ PrintStream::printf_P怎么用?C++ PrintStream::printf_P使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrintStream
的用法示例。
在下文中一共展示了PrintStream::printf_P方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkInput
void Receiver::checkInput()
{
BYTE i;
volatile CHANNEL *pch;
BYTE mask= 1;
#ifdef DEBUG_RECEIVER
pch= &ch[0];
out.printf_P(PSTR("0 LC:%wx V:%wx F:%bx FC:%bx\r\n"), ch->lastChange, ch->value, ch->flags, ch->failedCounter);
pch++;
out.printf_P(PSTR("1 LC:%wx V:%wx F:%bx FC:%bx\r\n"), ch->lastChange, ch->value, ch->flags, ch->failedCounter);
#endif
for( i=0;i < RECEIVER_CHANNELS; i++, mask <<= 1 )
{
pch= &ch[i];
if( pch->flags & _BV( CHF_NEW_PULSE ) )
{
pch->flags &= ~_BV( CHF_NEW_PULSE );
WORD v= pch->value;
if( v > MIN_PULSE_LENGTH && v < MAX_PULSE_LENGTH )
{
pch->failedCounter= 0;
pch->flags |= _BV(CHF_VALID);
if( (SHORT)v < ((SHORT)pch->lastValue - MAX_DERIVATION)
|| (SHORT)v > ((SHORT)pch->lastValue + MAX_DERIVATION) )
{
pch->skipCounter++;
if( pch->skipCounter < MAX_SKIP_COUNTER )
{
continue;
}
}
pch->skipCounter= 0;
pch->lastValue= v;
if( learnStickMinMaxMode & mask )
{
// learn min and max Values
if( v < pch->minValue )
{
pch->minValue= v;
}
if( v > pch->maxValue )
{
pch->maxValue= v;
}
pch->divisor = div16by8(pch->maxValue - pch->minValue, 255);
if( pch->divisor < 16 )
{
pch->divisor= 16;
}
if( pch->divisor > 0x40 )
{
pch->divisor= 0x40;
}
pch->maxValue= pch->minValue + mul8by8( pch->divisor, 255 );
}
else
{
if( v < pch->minValue )
{
v= pch->minValue;
}
if( v > pch->maxValue )
{
v= pch->maxValue;
}
}
v -= pch->minValue;
pch->bValue= div16by8(v, pch->divisor);
if( channelReverse & (1 << (i << 1)) )
{
pch->bValue= ~pch->bValue;
}
}
}
}
}
示例2: readFromEEPROM
void AlgorithmRepository::readFromEEPROM()
{
#ifndef DEBUGGING
WORD addr= 0;
BYTE c1= eeprom_read_byte( (uint8_t *)addr++ );
BYTE c2= eeprom_read_byte( (uint8_t *)addr++ );
BYTE c3= eeprom_read_byte( (uint8_t *)addr++ );
#ifdef DEBUG_EEPROM
out.printf_P( PSTR("EEPROM:%bx %bx %bx"), c1, c2, c3 );
#endif
if( c1 == 'J' && c2 == 'P' && c3 == ((RECEIVER_CHANNELS << 5) | OUTPUT_CHANNELS))
{
BYTE i;
eeprom_read_block( &programArray, (const void *)addr, (size_t)sizeof( programArray ) );
addr += sizeof( programArray );
eeprom_read_block( &inputChannel, (const void *)addr, (size_t)sizeof( inputChannel ) );
addr += sizeof( inputChannel );
for( i = 0; i < RECEIVER_CHANNELS; i++)
{
Receiver::setChannelMin( i, eeprom_read_word( (const uint16_t *)addr ) );
addr += sizeof( WORD );
Receiver::setChannelMax( i, eeprom_read_word( (const uint16_t *)addr ) );
addr += sizeof( WORD );
}
Receiver::setChannelModeByte( eeprom_read_byte( (const uint8_t *) addr) );
addr++;
Adc::setLimit( eeprom_read_word((const uint16_t *) addr) );
#ifdef DEBUG_EEPROM
out.printf_P(PSTR("EEPROM Size: %wx\r\n"), addr);
#endif
for( i=0;i < PWM_CHANNELS;i++ )
{
for( BYTE ii= 0;ii < 2+MAX_SEGMENTS;ii++)
{
if( programArray[i][ii].algorithm >= ALGORITHMS_PWM )
{
programArray[i][ii].algorithm= 0;
}
}
}
for( i=PWM_CHANNELS;i < OUTPUT_CHANNELS;i++ )
{
for( BYTE ii= 0;ii < 2+MAX_SEGMENTS;ii++)
{
if( programArray[i][ii].algorithm >= ALGORITHMS_SWITCH )
{
programArray[i][ii].algorithm= 0;
}
}
}
}
else
{
factoryDefault();
}
#endif
}