本文整理汇总了C++中RW函数的典型用法代码示例。如果您正苦于以下问题:C++ RW函数的具体用法?C++ RW怎么用?C++ RW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ar9287_olpc_temp_compensation
Static void
ar9287_olpc_temp_compensation(struct athn_softc *sc)
{
const struct ar9287_eeprom *eep = sc->sc_eep;
int8_t pdadc, slope, tcomp;
uint32_t reg;
reg = AR_READ(sc, AR_PHY_TX_PWRCTRL4);
pdadc = MS(reg, AR_PHY_TX_PWRCTRL_PD_AVG_OUT);
DPRINTFN(DBG_RF, sc, "PD Avg Out=%d\n", pdadc);
if (sc->sc_pdadc == 0 || pdadc == 0)
return; /* No frames transmitted yet. */
/* Compute Tx gain temperature compensation. */
if (sc->sc_eep_rev >= AR_EEP_MINOR_VER_2)
slope = eep->baseEepHeader.tempSensSlope;
else
slope = 0;
if (slope != 0) /* Prevents division by zero. */
tcomp = ((pdadc - sc->sc_pdadc) * 4) / slope;
else
tcomp = 0;
DPRINTFN(DBG_RF, sc, "OLPC temp compensation=%d\n", tcomp);
/* Write compensation value for both Tx chains. */
reg = AR_READ(sc, AR_PHY_CH0_TX_PWRCTRL11);
reg = RW(reg, AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, tcomp);
AR_WRITE(sc, AR_PHY_CH0_TX_PWRCTRL11, reg);
reg = AR_READ(sc, AR_PHY_CH1_TX_PWRCTRL11);
reg = RW(reg, AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, tcomp);
AR_WRITE(sc, AR_PHY_CH1_TX_PWRCTRL11, reg);
AR_WRITE_BARRIER(sc);
}
示例2: RW
DWORD CWinRect::CombineOverlapping(LPRECT pRectList, DWORD dwRectListSize, LONG xThreshold, LONG yThreshold, DWORD max, LPDWORD pdwFree)
{_STT();
// Combine overlapping rects
BOOL dwCombined = 0;
for ( DWORD i = 0; i < dwRectListSize; i++ )
for ( DWORD c = i + 1; c < dwRectListSize; c++ )
{ RECT dst;
if ( ( RW( pRectList[ i ] ) != 0 && RH( pRectList[ i ] ) != 0 ) &&
( RW( pRectList[ c ] ) != 0 && RH( pRectList[ c ] ) != 0 ) &&
IsAdjacentRect( &pRectList[ i ], &pRectList[ c ] ) )
if ( UnionRect( &dst, &pRectList[ i ], &pRectList[ c ] ) )
{ dwCombined++;
// Copy the new rect
CopyRect( &pRectList[ i ], &dst );
// Lose the old rect
ZeroMemory( &pRectList[ c ], sizeof( pRectList[ c ] ) );
// Save pointer to blank if needed
if ( dwCombined == 1 && pdwFree != NULL ) *pdwFree = c;
// Punt if user doesn't want any more
if ( !max ) return dwCombined;
i = 0; c = 1; max--;
} // end if
} // end for
return dwCombined;
}
示例3: Prj2Dto3D
Eigen::VectorXd Prj2Dto3D(VectorXd X, VectorXd fx){
Eigen::MatrixXd RW(3,3);
Eigen::VectorXd hRL(3),h(3);
int fku=1.95;
int fkv=1.95;
int u0=162;
int v0=125;
float u,v;
RW(0,0)=0.1;
RW(0,1)=0.1;
RW(0,2)=0.1;
RW(1,0)=0.1;
RW(1,1)=0.1;
RW(1,2)=0.1;
RW(2,0)=0.1;
RW(2,1)=0.1;
RW(2,2)=0.1;
hRL= RW*(fx-X);
u=u0-fku*hRL(0)/hRL(2);
v=v0-fkv*hRL(1)/hRL(2);
h(0)=u;
h(1)=v;
return h;
}
示例4: PSI_EXTENSION
void NITDemuxer::onSection( BYTE *section, SIZE_T len ) {
desc::Demuxer descDemuxer;
desc::MapOfDescriptors netDescriptors;
std::vector<Nit::ElementaryInfo> elements;
SSIZE_T offset = PSI_PAYLOAD_OFFSET;
bool isActualNetwork = (PSI_TABLE(section) == PSI_TID_NIT_ACTUAL);
WORD networkID = PSI_EXTENSION(section);
Version version = PSI_VERSION(section);
// Network descriptors
offset += descDemuxer.parse( netDescriptors, section+offset );
offset += 2; // Transport stream loop length
while (offset < len) {
Nit::ElementaryInfo info;
info.tsID = RW(section,offset);
info.nitID = RW(section,offset);
// Transport Stream Descriptors
offset += descDemuxer.parse( info.descriptors, section+offset );
elements.push_back( info );
}
Nit *nit = new Nit( version, networkID, isActualNetwork, netDescriptors, elements );
_onParsed( nit );
}
示例5: digitalWrite
uint8_t nrf_base::RW_Reg(uint8_t reg,uint8_t value) //¼Ä´æÆ÷·ÃÎʺ¯Êý£ºÓÃÀ´ÉèÖÃ24L01 µÄ¼Ä´æÆ÷µÄÖµ¡£
{
byte status_1;
digitalWrite(_CSN,LOW);
status_1=RW(reg);
RW(value);
digitalWrite(_CSN,HIGH);
return status_1;
}
示例6: CSN_L
/*
*****************************************************************
* 写寄存器
*****************************************************************
*/
uint8_t ANO_NRF::Write_Reg(uint8_t reg, uint8_t value)
{
uint8_t status;
CSN_L(); /* 选通器件 */
status = RW(reg); /* 写寄存器地址 */
RW(value); /* 写数据 */
CSN_H(); /* 禁止该器件 */
return status;
}
示例7: RW
void mwmp::PacketPlayerAnimPlay::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
RW(player->animation.groupname, send);
RW(player->animation.mode, send);
RW(player->animation.count, send);
RW(player->animation.persist, send);
}
示例8: GetWindowRect
void CDlgImgView::SizeDlg()
{
// Ensure window
if ( !::IsWindow( GetSafeHwnd() ) ) return;
if ( RW( m_rect ) <= 32 || RH( m_rect ) <= 32 ) return;
RECT win;
GetWindowRect( &win );
win.right = win.left + RW( m_rect ) + 16;
win.bottom = win.top + RH( m_rect ) + 48;
MoveWindow( &win, TRUE );
Size();
}
示例9: CE_L
void ANO_NRF::Init(u8 model, u8 ch)
{
CE_L();
Write_Buf(NRF_WRITE_REG+RX_ADDR_P0,RX_ADDRESS,RX_ADR_WIDTH); //写RX节点地址
Write_Buf(NRF_WRITE_REG+TX_ADDR,TX_ADDRESS,TX_ADR_WIDTH); //写TX节点地址
Write_Reg(NRF_WRITE_REG+EN_AA,0x01); //使能通道0的自动应答
Write_Reg(NRF_WRITE_REG+EN_RXADDR,0x01); //使能通道0的接收地址
Write_Reg(NRF_WRITE_REG+SETUP_RETR,0x1a); //设置自动重发间隔时间:500us;最大自动重发次数:10次 2M波特率下
Write_Reg(NRF_WRITE_REG+RF_CH,ch); //设置RF通道为CHANAL
Write_Reg(NRF_WRITE_REG+RF_SETUP,0x0f); //设置TX发射参数,0db增益,2Mbps,低噪声增益开启
//Write_Reg(NRF_WRITE_REG+RF_SETUP,0x07); //设置TX发射参数,0db增益,1Mbps,低噪声增益开启
/////////////////////////////////////////////////////////
if(model==1) //RX
{
Write_Reg(NRF_WRITE_REG+RX_PW_P0,RX_PLOAD_WIDTH); //选择通道0的有效数据宽度
Write_Reg(NRF_WRITE_REG + CONFIG, 0x0f); // IRQ收发完成中断开启,16位CRC,主接收
}
else if(model==2) //TX
{
Write_Reg(NRF_WRITE_REG+RX_PW_P0,RX_PLOAD_WIDTH); //选择通道0的有效数据宽度
Write_Reg(NRF_WRITE_REG + CONFIG, 0x0e); // IRQ收发完成中断开启,16位CRC,主发送
}
else if(model==3) //RX2
{
Write_Reg(FLUSH_TX,0xff);
Write_Reg(FLUSH_RX,0xff);
Write_Reg(NRF_WRITE_REG + CONFIG, 0x0f); // IRQ收发完成中断开启,16位CRC,主接收
RW(0x50);
RW(0x73);
Write_Reg(NRF_WRITE_REG+0x1c,0x01);
Write_Reg(NRF_WRITE_REG+0x1d,0x06);
}
else //TX2
{
Write_Reg(NRF_WRITE_REG + CONFIG, 0x0e); // IRQ收发完成中断开启,16位CRC,主发送
Write_Reg(FLUSH_TX,0xff);
Write_Reg(FLUSH_RX,0xff);
RW(0x50);
RW(0x73);
Write_Reg(NRF_WRITE_REG+0x1c,0x01);
Write_Reg(NRF_WRITE_REG+0x1d,0x06);
}
CE_H();
delayms(50);
}
示例10: parse
SSIZE_T parse( BYTE *data, SIZE_T len, Descriptors &descriptors ) {
SSIZE_T offset = 0;
WORD compatibilityLen = RW(data,offset);
if (!compatibilityLen) {
// Ignore if not present
return 2;
}
WORD descriptorCount = RW(data,offset);
printf( "[dsmcc::compatiblity] Compatibility descriptor: dataLen=%ld, descLen=%d, count=%d\n",
len, compatibilityLen, descriptorCount );
// Check if len is ok
if (len < compatibilityLen) {
printf( "[dsmcc::compatiblity] No data available to parse Compatibility descriptor: descLen=%ld, available=%d\n",
len, compatibilityLen );
return compatibilityLen+2;
}
// Parse descriptors
for (WORD desc=0; desc<descriptorCount; desc++) {
Descriptor desc;
desc.type = RB(data,offset);
//BYTE dLen = RB(data,offset);
offset += 1;
desc.specifier = RDW(data,offset);
desc.model = RW(data,offset);
desc.version = RW(data,offset);
// Parse sub descriptors
BYTE subCount = RB(data,offset);
for (BYTE sub=0; sub<subCount; sub++) {
BYTE subType = RB(data,offset);
BYTE subLen = RB(data,offset);
// AdditionalInformation
offset += subLen;
printf( "[dsmcc::compatibility] Warning, subdescriptor not parsed: count=%d, type=%x, len=%x\n", subCount, subType, subLen );
}
descriptors.push_back( desc );
}
return compatibilityLen+2;
}
示例11: GetClientRect
BOOL CPubImgView::Regen( DWORD i )
{
RECT rect;
GetClientRect( &rect );
// Punt if no image list
if ( m_pImgList == NULL || m_pImgList->Size() == 0 )
{ m_video.Destroy(); return TRUE; }
long w = RW( rect );
long h = RH( rect );
// Just allocate what we need
if ( w > h ) rect.right = rect.left + ( h * m_pImgList->Size() );
else rect.bottom = rect.top + ( w + m_pImgList->Size() );
// Create offscreen buffer
if ( !m_video.Create( NULL, &rect ) ) return FALSE;
// Fill in the background
CGrDC::FillSolidRect( m_video, &rect, GetSysColor( COLOR_3DFACE ) );
// Draw the images
if ( !Draw( m_video, &rect ) ) return FALSE;
// Show the changes
Update();
return TRUE;
}
示例12: ExecuteLoop
void ExecuteLoop(void) /* fetch and dispatch loop */
{
register void (**tab)(void);
tab=table;
rep:
while(--nInst>=0)
{
#ifdef TRACE
if (pc>tracelo) DoTrace();
#endif
tab[code=RW(pc++)]();
}
if (doPoll) dosignal();
if(extraFlag)
{
nInst=nInst2;
ExceptionProcessing();
if(nInst>0) goto rep;
}
}
示例13: RW
void mwmp::PacketPlayerCharGen::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
RW(player->charGenState, send);
}
示例14: AddRectToList
BOOL CWinRect::AddRectToList(LPRECT pRect, LPRECT pRectList, DWORD dwRectListSize, LONG xThreshold, LONG yThreshold )
{_STT();
// Add if possible
RECT dst;
DWORD i = 0, blank = MAXDWORD;
for ( i = 0; i < dwRectListSize; i++ )
{
// If valid area
if ( RW( pRectList[ i ] ) != 0 && RH( pRectList[ i ] ) != 0 )
{ if ( IsAdjacentRect( &pRectList[ i ], pRect, xThreshold, yThreshold ) )
if ( UnionRect( &dst, &pRectList[ i ], pRect ) )
{ CopyRect( &pRectList[ i ], &dst ); return TRUE; }
} // end if
// Save blank location
else if ( blank == MAXDWORD )
blank = i;
} // end for
// Any more blank slots?
if ( blank == MAXDWORD )
{
// Attempt to create an empty slot
if ( !CombineOverlapping( pRectList, dwRectListSize, xThreshold, yThreshold, 1, &blank ) )
return FALSE;
} // end if
// Add to slot
CopyRect( &pRectList[ blank ], pRect );
return TRUE;
}
示例15: ar9287_1_3_setup_async_fifo
PUBLIC void
ar9287_1_3_setup_async_fifo(struct athn_softc *sc)
{
uint32_t reg;
/*
* MAC runs at 117MHz (instead of 88/44MHz) when ASYNC FIFO is
* enabled, so the following counters have to be changed.
*/
AR_WRITE(sc, AR_D_GBL_IFS_SIFS, AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR);
AR_WRITE(sc, AR_D_GBL_IFS_SLOT, AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR);
AR_WRITE(sc, AR_D_GBL_IFS_EIFS, AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR);
AR_WRITE(sc, AR_TIME_OUT, AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR);
AR_WRITE(sc, AR_USEC, AR_USEC_ASYNC_FIFO_DUR);
AR_SETBITS(sc, AR_MAC_PCU_LOGIC_ANALYZER,
AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768);
reg = AR_READ(sc, AR_AHB_MODE);
reg = RW(reg, AR_AHB_CUSTOM_BURST, AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL);
AR_WRITE(sc, AR_AHB_MODE, reg);
AR_SETBITS(sc, AR_PCU_MISC_MODE2, AR_PCU_MISC_MODE2_ENABLE_AGGWEP);
AR_WRITE_BARRIER(sc);
}