本文整理汇总了C++中readReg函数的典型用法代码示例。如果您正苦于以下问题:C++ readReg函数的具体用法?C++ readReg怎么用?C++ readReg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readReg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: readReg
void CMCP23017::dumpReg(const uint8_t nRegAddr)
{
uint8_t nRegVal = readReg(nRegAddr);
Serial.print("********** ");
Serial.print(getRegName(nRegAddr));
Serial.print(" = ");
Serial.print(nRegVal, BIN);
Serial.println(" **********");
}
开发者ID:boylesg,项目名称:MCP23017-library-for-Arduino,代码行数:9,代码来源:MCP23017.cpp
示例2: writeReg
// should be called immediately after reception in case sender wants ACK
void RFM69::sendACK(const void* buffer, uint8_t bufferSize) {
uint8_t sender = SENDERID;
int16_t _RSSI = RSSI; // save payload received RSSI value
writeReg(REG_PACKETCONFIG2, (readReg(REG_PACKETCONFIG2) & 0xFB) | RF_PACKET2_RXRESTART); // avoid RX deadlocks
uint32_t now = millis();
while (!canSend() && millis() - now < RF69_CSMA_LIMIT_MS) receiveDone();
sendFrame(sender, buffer, bufferSize, false, true);
RSSI = _RSSI; // restore payload RSSI
}
开发者ID:aarlaud,项目名称:ArduinoLibraries,代码行数:10,代码来源:RFM69.cpp
示例3: get_rx_queue_num_pkts_dropped_bad
unsigned int get_rx_queue_num_pkts_dropped_bad(nf2device* nf2, unsigned char port) {
unsigned int retval = 0;
switch(port) {
case 0:
readReg(nf2, MAC_GRP_0_RX_QUEUE_NUM_PKTS_DROPPED_BAD_REG, &retval);
break;
case 1:
readReg(nf2, MAC_GRP_1_RX_QUEUE_NUM_PKTS_DROPPED_BAD_REG, &retval);
break;
case 2:
readReg(nf2, MAC_GRP_2_RX_QUEUE_NUM_PKTS_DROPPED_BAD_REG, &retval);
break;
case 3:
readReg(nf2, MAC_GRP_3_RX_QUEUE_NUM_PKTS_DROPPED_BAD_REG, &retval);
break;
}
return retval;
}
开发者ID:chinghanyu,项目名称:cornell_ngrp_scone,代码行数:18,代码来源:or_netfpga.c
示例4: writeReg
int8_t RFM69OOK::readRSSI(bool forceTrigger) {
if (forceTrigger)
{
// RSSI trigger not needed if DAGC is in continuous mode
writeReg(REG_RSSICONFIG, RF_RSSI_START);
while ((readReg(REG_RSSICONFIG) & RF_RSSI_DONE) == 0x00); // Wait for RSSI_Ready
}
return -(readReg(REG_RSSIVALUE) >> 1);
}
开发者ID:kobuki,项目名称:RFM69OOK,代码行数:9,代码来源:RFM69OOK.cpp
示例5: read_info
/*
* Read the version info from the board
*/
void read_info( struct nf2device *nf2 )
{
int i;
// Read the version and revision
readReg(nf2, DEV_ID_DEVICE_ID, &nf2->info.nf2_device_id);
readReg(nf2, DEV_ID_REVISION, &nf2->info.nf2_revision);
// Read the version string
for (i = 0; i < DEVICE_STR_NUM_REGS; i++)
{
readReg(nf2, DEV_ID_DEV_STR_0 + i * 4, (unsigned *)(nf2->info.nf2_device_str + i * 4));
// Perform byte swapping if necessary
*(unsigned *)(nf2->info.nf2_device_str + i * 4) = ntohl(*(unsigned *)(nf2->info.nf2_device_str + i * 4));
}
nf2->info.nf2_device_str[DEVICE_STR_LEN - 1] = '\0';
}
开发者ID:alexanderkatovsky,项目名称:bir,代码行数:21,代码来源:nf2util.c
示例6: writeReg
bool Acceleration_Sensor::init()
{
const unsigned char activeModeWith100Hz = (1 << 0) | (3 << 3); // Active Mode @ 100Hz
writeReg(Ctrl_Reg1, activeModeWith100Hz);
const char whoAmIReg = readReg(WhoAmI);
return (mWhoAmIExpectedValue == whoAmIReg);
}
开发者ID:liveusr,项目名称:selfdriving,代码行数:9,代码来源:io_source.cpp
示例7: readRam
unsigned short readRam (unsigned char reg)
{
//read ram space address
unsigned char hi,lo;
while (readReg (RAMSTAT)&0x01);//wait for indirect registers
writeReg(RAMADDR,reg) ;
while (readReg (RAMSTAT)&0x01);//wait for indirect registers
hi = readReg(RAMHI);
lo = readReg(RAMLO);
return (SixteenBit (hi,lo));
}
开发者ID:b3rnik,项目名称:dsl-n55u-bender,代码行数:18,代码来源:dual_i2o.c
示例8: update
void update()//中断服务函数
{
uint8_t Asr_Count=0;
if((readReg(0x2b) & 0x10) && readReg(0xb2)==0x21 && readReg(0xbf)==0x35)//如果有语音识别中断、DSP闲、ASR正常结束
{
writeReg(0x29,0) ;///////////关中断
writeReg(0x02,0) ;/////////////关FIFO中断
Asr_Count = readReg(0xba);//读中断辅助信息
if(Asr_Count>0 && Asr_Count<4) //////如果有识别结果
{
readnum=readReg(0xc5);
readflag=1;
}
writeReg(0x2b,0);//////清楚中断编号
writeReg(0x1C,0);////////貌似关麦克风啊~~为毛
}
readReg(0x06);
delay(10);
readReg(0x06);
writeReg(0x89, 0x03);
delay(5);
writeReg(0xcf, 0x43);
delay(5);
writeReg(0xcb, 0x02);
writeReg(0x11, PLL_11);
writeReg(0x1e,0x00);
writeReg(0x19, PLL_ASR_19);
writeReg(0x1b, PLL_ASR_1B);
writeReg(0x1d, PLL_ASR_1D);
delay(10);
writeReg(0xcd, 0x04);
writeReg(0x17, 0x4c);
delay(5);
writeReg(0xcf, 0x4f);
writeReg(0xbd, 0x00);
writeReg(0x17, 0x48);
delay(10);
writeReg(0x3c, 0x80);
writeReg(0x3e, 0x07);
writeReg(0x38, 0xff);
writeReg(0x3a, 0x07);
writeReg(0x40, 0);
writeReg(0x42, 8);
writeReg(0x44, 0);
writeReg(0x46, 8);
delay(1);
writeReg(0x1c, 0x09);////////麦克风设置保留
writeReg(0xbd, 0x20);/////////保留设置
writeReg(0x08, 0x01);///////////→清除FIFO_DATA
delay( 1);
writeReg(0x08, 0x00);////////////清除指定FIFO后再写入一次00H
delay( 1);
writeReg(0xb2, 0xff);////////给0xB2写FF
writeReg(0x37, 0x06);////////开始识别
delay( 5 );
writeReg(0x1c, g_Mic);////////选择麦克风
writeReg(0x29, 0x10);////////开同步中断
writeReg(0xbd, 0x00);/////////启动为语音识别
}
开发者ID:563886019,项目名称:voiceRecognition1.1,代码行数:59,代码来源:VoiceRecognition.cpp
示例9: cc1101Init
/*
* initialize CC1101
*/
void cc1101Init(uint8_t mode100k) {
cli();
bitSet(DDR_SPI, PIN_SPI_SS); // set B2(SS) as Output
bitSet(DDR_SPI, PIN_SPI_MOSI); // set B3(MOSI) as Output
bitClear(DDR_SPI, PIN_SPI_MISO); // set B4(MISO) as Input
bitSet(DDR_SPI, PIN_SPI_SCK); // set B5(SCK) as Output
bitClear(DDR_GDO0, PIN_GDO0); // set B2(SS) as Input
bitSet(PORT_SPI, PIN_SPI_SS); // set SS high
bitSet(PORT_SPI, PIN_SPI_SCK); // set SCK high
bitClear(PORT_SPI, PIN_SPI_MOSI); // set MOSI high
SPCR = _BV(SPE) | _BV(MSTR); // SPI speed = CLK/4
cc1101_Deselect(); // some deselect and selects to initialize the TRX868modul
_delay_us(30);
cc1101_Select();
_delay_us(30);
cc1101_Deselect();
_delay_us(45);
cmdStrobe(CC1101_SRES); // send reset
_delay_us(100);
for (uint8_t i=0; i<sizeof(initVal); i += 2) { // write initialize value to cc1101
writeReg(pgm_read_byte(&initVal[i]), pgm_read_byte(&initVal[i+1]));
}
if (mode100k) { // switch to 100k mode
for (uint8_t i=0; i<sizeof(initValUpdate); i += 2) { // write initialize value to cc1101
writeReg(
pgm_read_byte(&initValUpdate[i]),
pgm_read_byte(&initValUpdate[i+1])
);
}
}
cmdStrobe(CC1101_SCAL); // calibrate frequency synthesizer and turn it off
_delay_ms(4);
do {
cmdStrobe(CC1101_SRX);
} while (readReg(CC1101_MARCSTATE, CC1101_STATUS) != 0x0D);
writeReg(CC1101_PATABLE, PA_MaxPower); // configure PATABLE
cmdStrobe(CC1101_SRX); // flush the RX buffer
cmdStrobe(CC1101_SWORRST); // reset real time clock
_delay_ms(3);
sei();
}
开发者ID:Koenma413,项目名称:Asksin_OTA_Bootloader,代码行数:59,代码来源:cc.c
示例10: startrx
static void startrx (u1_t rxmode) {
ASSERT( (readReg(RegOpMode) & OPMODE_MASK) == OPMODE_SLEEP );
if(getSf(LMIC.rps) == FSK) { // FSK modem
rxfsk(rxmode);
} else { // LoRa modem
rxlora(rxmode);
}
// the radio will go back to STANDBY mode as soon as the RX is finished
// or timed out, and the corresponding IRQ will inform us about completion.
}
开发者ID:kaaLabs15,项目名称:arduino-lmic-v1.5,代码行数:10,代码来源:radio.cpp
示例11: if
void nRF24L01p::irqFunction(byte _mask,boolean _onoff){
byte buf=readReg(CONFIG);
if(_onoff==true){
buf|=0x70;
buf&=(~_mask | 0x0F);
}else if(_onoff==false){
buf|=(_mask & 0x70);
}
writeReg(CONFIG,buf);
}
开发者ID:WaiakeaRobotics,项目名称:Robotics-Libraries,代码行数:10,代码来源:LOCAL_nRF24L01p.cpp
示例12: starttx
// start transmitter (buf=LMIC.frame, len=LMIC.dataLen)
static void starttx () {
ASSERT( (readReg(RegOpMode) & OPMODE_MASK) == OPMODE_SLEEP );
if(getSf(LMIC.rps) == FSK) { // FSK modem
txfsk();
} else { // LoRa modem
txlora();
}
// the radio will go back to STANDBY mode as soon as the TX is finished
// the corresponding IRQ will inform us about completion.
}
开发者ID:kaaLabs15,项目名称:arduino-lmic-v1.5,代码行数:11,代码来源:radio.cpp
示例13:
uint8_t EM2874Device::readReg (const uint8_t idx)
{
uint8_t val;
if(!readReg (idx, &val)) {
#ifdef DEBUG
*log << "readReg(" << (unsigned)idx << ") failed.";
#endif
}
return val;
}
开发者ID:airmack,项目名称:recfsusb2n,代码行数:10,代码来源:em2874-core.cpp
示例14: cardSize
/**
* Determine the size of a standard SD flash memory card
* \return The number of 512 byte data blocks in the card
*/
uint32_t SdCard::cardSize(void)
{
uint16_t c_size;
csd_t csd;
if (!readReg(CMD9, (uint8_t *)&csd)) return 0;
uint8_t read_bl_len = csd.read_bl_len;
c_size = (csd.c_size_high << 10) | (csd.c_size_mid << 2) | csd.c_size_low;
uint8_t c_size_mult = (csd.c_size_mult_high << 1) | csd.c_size_mult_low;
return (uint32_t)(c_size+1) << (c_size_mult + read_bl_len - 7);
}
开发者ID:enderdsus7,项目名称:arduino-fermentation-controller,代码行数:14,代码来源:SdCard.cpp
示例15: getPort
void CMCP23017::setOutput(const uint8_t nPin)
{
// Get value from MCP23017 port A if nPin is between 8 and 15 or from port B if nPin is between 0 and 7
uint8_t nPort = getPort(nPin, IODIRA, IODIRB),
nPortVal = readReg(nPort);
// Preserve all the bits except for the one corresponding to the pin that we are changing to input mode (1)
nPortVal &= ~getPinMask(nPin);
writeReg(nPort, nPortVal);
}
开发者ID:boylesg,项目名称:MCP23017-library-for-Arduino,代码行数:10,代码来源:MCP23017.cpp
示例16: writeReg
// should be called immediately after reception in case sender wants ACK
void RFM69::sendACK(const void* buffer, uint8_t bufferSize) {
ACK_REQUESTED = 0; // TWS added to make sure we don't end up in a timing race and infinite loop sending Acks
uint8_t sender = SENDERID;
int16_t _RSSI = RSSI; // save payload received RSSI value
writeReg(REG_PACKETCONFIG2, (readReg(REG_PACKETCONFIG2) & 0xFB) | RF_PACKET2_RXRESTART); // avoid RX deadlocks
uint32_t now = millis();
while (!canSend() && millis() - now < RF69_CSMA_LIMIT_MS) { delayMicroseconds(MICROSLEEP_LENGTH); /* printf(".");*/ receiveDone();}
sendFrame(sender, buffer, bufferSize, false, true);
RSSI = _RSSI; // restore payload RSSI
}
开发者ID:abouillot,项目名称:HomeAutomation,代码行数:11,代码来源:rfm69.cpp
示例17: writeReg
void Player_AD::writeReg(int r, int v) {
if (r >= 0 && r < ARRAYSIZE(_registerBackUpTable)) {
_registerBackUpTable[r] = v;
}
// Handle volume scaling depending on the sound type.
if (r >= 0x40 && r <= 0x55) {
const int operatorOffset = r - 0x40;
const int channel = _operatorOffsetToChannel[operatorOffset];
if (channel != -1) {
const bool twoOPOutput = (readReg(0xC0 + channel) & 0x01) != 0;
int scale = Audio::Mixer::kMaxChannelVolume;
// We only scale the volume of operator 2 unless both operators
// are set to directly produce sound.
if (twoOPOutput || operatorOffset == _operatorOffsetTable[channel * 2 + 1]) {
if (_hwChannels[channel].sfxOwner) {
scale = _sfxVolume;
} else {
scale = _musicVolume;
}
}
int vol = 0x3F - (v & 0x3F);
vol = vol * scale / Audio::Mixer::kMaxChannelVolume;
v &= 0xC0;
v |= (0x3F - vol);
}
}
// Since AdLib's lowest volume level does not imply that the sound is
// completely silent we ignore key on in such a case.
// We also ignore key on for music whenever we do seeking.
if (r >= 0xB0 && r <= 0xB8) {
const int channel = r - 0xB0;
bool mute = false;
if (_hwChannels[channel].sfxOwner) {
if (!_sfxVolume) {
mute = true;
}
} else {
if (!_musicVolume) {
mute = true;
} else {
mute = _isSeeking;
}
}
if (mute) {
v &= ~0x20;
}
}
_opl2->writeReg(r, v);
}
开发者ID:ilookha,项目名称:scummvm,代码行数:55,代码来源:player_ad.cpp
示例18: readReg
/**
* \brief begin function - must be called before using other functions
*
* This function enables the magnetometer.
* The magnetometer is an I2C device so we initialise the I2C communications,
* make contact with the magnetometer, and check that it's what we think it is.
*
* We set the sampling rate to 10Hz, but where the values are from a heavily
* oversampled set of values
*/
void EngduinoMagnetometerClass::begin()
{ uint8_t reg;
// Join I2C bus as master
//
Wire.begin();
// Check to see that the device is there
//
Wire.beginTransmission(FXMS3110_IIC_ADDRESS);
int error = Wire.endTransmission();
if (error != 0) {
Serial.println("Error: I2C device not found");
return;
}
// Check that it's the device we think it is
//
readReg(FXMS3110_WHO_AM_I, ®);
if (reg != FXMS3110) {
Serial.println("Error: Not an FXMS3110");
return;
}
// Set this to raw mode - no user correction
// and automatically enable reset to deal with big magnetic
// fields
readReg(FXMS3110_CTRL_REG2, ®);
reg |= AUTO_MRST_EN_MASK | RAW_MASK;
writeReg(FXMS3110_CTRL_REG2, ®);
standby(); // Stop the magnetometer
// Set 10Hz data rate = 1280 Hz ADC with 128 times oversampling
readReg(FXMS3110_CTRL_REG1, ®);
reg &= ~(DR_MASK | OS_MASK);
reg |= DATA_RATE_1280_128;
writeReg(FXMS3110_CTRL_REG1, ®);
activate(); // And start it again
}
开发者ID:calugo,项目名称:OpenPlant-Electrophysiology,代码行数:52,代码来源:EngduinoMagnetometer.cpp
示例19: ace_interrupt
/*
* Audio engine interrupt service routine
* To wake up ae wait queue
*/
static irqreturn_t ace_interrupt(int irq, void *dev)
{
volatile int ae_out_mode_reg = 0;
//status 0x24
ae_out_mode_reg = readReg(AE_STATUS_REG);
ae_interrupt_value = ae_out_mode_reg;
if(ae_out_mode_reg & 0x04){
writeReg(AE_INT_EN_REG,readReg(AE_INT_EN_REG)&(~0x0f));
}
ae_out_mode_reg &= 0x0f;
writeReg(AE_STATUS_REG,ae_out_mode_reg);
ae_interrupt_sta = 1;
ae_out_mode_reg = readReg(AE_STATUS_REG);//ûÓà ²âÊÔÊÇ·ñ¿ÉÒÔdel
wake_up_interruptible(&wait_ae);
return IRQ_HANDLED;
}
开发者ID:godark,项目名称:A10-Linux-2.6.36,代码行数:24,代码来源:sun4i_dev_ace.c
示例20:
// TODO: finish this
ULONG Ez80::readRegister(const char *tname)
{
const char *name=aDefaultStringHelper.removeSpaces2(aDefaultStringHelper.toLower(tname));
if(!strcmp(name,"a")) { return a; }
if(!strcmp(name,"s")) { return sp; }
if(!strcmp(name,"sp")) { return sp; }
if(!strcmp(name,"f")) { return f; }
if(!strcmp(name,"ix")) { return ix; }
if(!strcmp(name,"iy")) { return iy; }
if(!strcmp(name,"b")) { return b; }
if(!strcmp(name,"c")) { return c; }
if(!strcmp(name,"d")) { return d; }
if(!strcmp(name,"e")) { return e; }
if(!strcmp(name,"h")) { return h; }
if(!strcmp(name,"l")) { return l; }
if(!strcmp(name,"bc")) { return readReg(Ez80_REG_BC,Ez80_SIZE_WORD); }
if(!strcmp(name,"de")) { return readReg(Ez80_REG_DE,Ez80_SIZE_WORD); }
if(!strcmp(name,"hl")) { return readReg(Ez80_REG_HL,Ez80_SIZE_WORD); }
return 0;
}
开发者ID:laulandne,项目名称:src,代码行数:21,代码来源:Ez80.cpp
注:本文中的readReg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论