本文整理汇总了C++中readRegister8函数的典型用法代码示例。如果您正苦于以下问题:C++ readRegister8函数的具体用法?C++ readRegister8怎么用?C++ readRegister8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readRegister8函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: readRegister8
boolean Adafruit_DRV2605::init() {
_wire->begin();
uint8_t id = readRegister8(DRV2605_REG_STATUS);
//Serial.print("Status 0x"); Serial.println(id, HEX);
writeRegister8(DRV2605_REG_MODE, 0x00); // out of standby
writeRegister8(DRV2605_REG_RTPIN, 0x00); // no real-time-playback
writeRegister8(DRV2605_REG_WAVESEQ1, 1); // strong click
writeRegister8(DRV2605_REG_WAVESEQ2, 0); // end sequence
writeRegister8(DRV2605_REG_OVERDRIVE, 0); // no overdrive
writeRegister8(DRV2605_REG_SUSTAINPOS, 0);
writeRegister8(DRV2605_REG_SUSTAINNEG, 0);
writeRegister8(DRV2605_REG_BREAK, 0);
writeRegister8(DRV2605_REG_AUDIOMAX, 0x64);
// ERM open loop
// turn off N_ERM_LRA
writeRegister8(DRV2605_REG_FEEDBACK, readRegister8(DRV2605_REG_FEEDBACK) & 0x7F);
// turn on ERM_OPEN_LOOP
writeRegister8(DRV2605_REG_CONTROL3, readRegister8(DRV2605_REG_CONTROL3) | 0x20);
return true;
}
开发者ID:adafruit,项目名称:Adafruit_DRV2605_Library,代码行数:28,代码来源:Adafruit_DRV2605.cpp
示例2: setRange
void ADXL345::clearSettings(void)
{
setRange(ADXL345_RANGE_2G);
setDataRate(ADXL345_DATARATE_100HZ);
writeRegister8(ADXL345_REG_THRESH_TAP, 0x00);
writeRegister8(ADXL345_REG_DUR, 0x00);
writeRegister8(ADXL345_REG_LATENT, 0x00);
writeRegister8(ADXL345_REG_WINDOW, 0x00);
writeRegister8(ADXL345_REG_THRESH_ACT, 0x00);
writeRegister8(ADXL345_REG_THRESH_INACT, 0x00);
writeRegister8(ADXL345_REG_TIME_INACT, 0x00);
writeRegister8(ADXL345_REG_THRESH_FF, 0x00);
writeRegister8(ADXL345_REG_TIME_FF, 0x00);
uint8_t value;
value = readRegister8(ADXL345_REG_ACT_INACT_CTL);
value &= 0b10001000;
writeRegister8(ADXL345_REG_ACT_INACT_CTL, value);
value = readRegister8(ADXL345_REG_TAP_AXES);
value &= 0b11111000;
writeRegister8(ADXL345_REG_TAP_AXES, value);
}
开发者ID:ezef,项目名称:Arduino-ADXL345,代码行数:25,代码来源:ADXL345.cpp
示例3: readRegister8
boolean DRV2605::begin() {
// moved outside - other libs may used the Wire
// Wire.begin();
uint8_t id = readRegister8(DRV2605_REG_STATUS);
writeRegister8(DRV2605_REG_MODE, 0x00); // out of standby
writeRegister8(DRV2605_REG_RTPIN, 0x00); // no real-time-playback
writeRegister8(DRV2605_REG_WAVESEQ1, 1); // strong click
writeRegister8(DRV2605_REG_WAVESEQ2, 0);
writeRegister8(DRV2605_REG_OVERDRIVE, 0); // no overdrive
writeRegister8(DRV2605_REG_SUSTAINPOS, 0);
writeRegister8(DRV2605_REG_SUSTAINNEG, 0);
writeRegister8(DRV2605_REG_BREAK, 0);
writeRegister8(DRV2605_REG_AUDIOMAX, 0x64);
// ERM open loop
// turn off N_ERM_LRA
writeRegister8(DRV2605_REG_FEEDBACK, readRegister8(DRV2605_REG_FEEDBACK) & 0x7F);
// turn on ERM_OPEN_LOOP
writeRegister8(DRV2605_REG_CONTROL3, readRegister8(DRV2605_REG_CONTROL3) | 0x20);
return true;
}
开发者ID:mmmatjaz,项目名称:Multi_DRV2605_lib,代码行数:28,代码来源:DRV2605.cpp
示例4: digitalWrite
bool Adafruit_LIS3DH::begin(uint8_t i2caddr) {
_i2caddr = i2caddr;
if (_cs == -1) {
// i2c
Wire.begin();
} else {
digitalWrite(_cs, HIGH);
pinMode(_cs, OUTPUT);
if (_sck == -1) {
// hardware SPI
SPI.begin();
} else {
// software SPI
pinMode(_sck, OUTPUT);
pinMode(_mosi, OUTPUT);
pinMode(_miso, INPUT);
}
}
/* Check connection */
uint8_t deviceid = readRegister8(LIS3DH_REG_WHOAMI);
if (deviceid != 0x33)
{
/* No LIS3DH detected ... return false */
//Serial.println(deviceid, HEX);
return false;
}
// enable all axes, normal mode
writeRegister8(LIS3DH_REG_CTRL1, 0x07);
// 400Hz rate
setDataRate(LIS3DH_DATARATE_400_HZ);
// High res enabled
writeRegister8(LIS3DH_REG_CTRL4, 0x08);
// DRDY on INT1
writeRegister8(LIS3DH_REG_CTRL3, 0x10);
// Turn on orientation config
//writeRegister8(LIS3DH_REG_PL_CFG, 0x40);
// enable adc & temp sensor
writeRegister8(LIS3DH_REG_TEMPCFG, 0xC0);
for (uint8_t i=0; i<0x30; i++) {
Serial.print("$");
Serial.print(i, HEX); Serial.print(" = 0x");
Serial.println(readRegister8(i), HEX);
}
return true;
}
开发者ID:BrightContrast,项目名称:AssetTracker,代码行数:58,代码来源:AssetTracker.cpp
示例5: readRegister8
uint16_t Adafruit_STMPE610::getVersion() {
uint16_t v;
//Serial.print("get version");
v = readRegister8(0);
v <<= 8;
v |= readRegister8(1);
//Serial.print("Version: 0x"); Serial.println(v, HEX);
return v;
}
开发者ID:KurtE,项目名称:Adafruit_STMPE610,代码行数:9,代码来源:Adafruit_STMPE610.cpp
示例6: readRegister8
void DS3231::forceConversion(void)
{
uint8_t value;
value = readRegister8(DS3231_REG_CONTROL);
value |= 0b00100000;
writeRegister8(DS3231_REG_CONTROL, value);
do {} while ((readRegister8(DS3231_REG_CONTROL) & 0b00100000) != 0);
}
开发者ID:AmmarkoV,项目名称:AmmarServer,代码行数:12,代码来源:DS3231.cpp
示例7: readRegister8
void Adafruit_MMA8451::setRange(mma8451_range_t range)
{
uint8_t reg1 = readRegister8(MMA8451_REG_CTRL_REG1);
writeRegister8(MMA8451_REG_CTRL_REG1, 0x00); // deactivate
writeRegister8(MMA8451_REG_XYZ_DATA_CFG, range & 0x3);
writeRegister8(MMA8451_REG_CTRL_REG1, reg1 | 0x01); // activate
}
开发者ID:samweiller,项目名称:ADA_MMA8451,代码行数:7,代码来源:Adafruit_MMA8451.cpp
示例8: readRegister8
void Adafruit_LIS3DH::setInertialInt(bool state, float thresh, uint8_t timelimit, uint8_t options) {
if (!state) {
//disable int
uint8_t r = readRegister8(LIS3DH_REG_CTRL3);
r &= ~(0x40); // turn off IA1
writeRegister8(LIS3DH_REG_CTRL3, r);
return;
}
// else...
writeRegister8(LIS3DH_REG_CTRL3, 0x40); // turn on int1
writeRegister8(LIS3DH_REG_CTRL5, 0x08); // latch interrupt on int1
uint8_t range = (2 << getRange());
if (thresh < 0) thresh = thresh * -1;
if (thresh > range) thresh = range;
thresh = (thresh * 127 / range);
uint8_t th = (int) thresh;
writeRegister8(LIS3DH_REG_INT1THS, (th & 0x7f)); // arbitrary
writeRegister8(LIS3DH_REG_INT1DUR, (timelimit & 0x7f)); // arbitrary
writeRegister8(LIS3DH_REG_INT1CFG, options); // arbitrary
}
开发者ID:electricimp,项目名称:examples,代码行数:27,代码来源:Adafruit_LIS3DH.cpp
示例9: readRegister8
void Adafruit_LIS3DH::setClick(uint8_t c, uint8_t clickthresh, uint8_t timelimit, uint8_t timelatency, uint8_t timewindow) {
if (!c) {
//disable int
uint8_t r = readRegister8(LIS3DH_REG_CTRL3);
r &= ~(0x80); // turn off I1_CLICK
writeRegister8(LIS3DH_REG_CTRL3, r);
writeRegister8(LIS3DH_REG_CLICKCFG, 0);
return;
}
// else...
writeRegister8(LIS3DH_REG_CTRL3, 0x80); // turn on int1 click
writeRegister8(LIS3DH_REG_CTRL5, 0x08); // latch interrupt on int1
if (c == 1)
writeRegister8(LIS3DH_REG_CLICKCFG, 0x15); // turn on all axes & singletap
if (c == 2)
writeRegister8(LIS3DH_REG_CLICKCFG, 0x2A); // turn on all axes & doubletap
writeRegister8(LIS3DH_REG_CLICKTHS, clickthresh); // arbitrary
writeRegister8(LIS3DH_REG_TIMELIMIT, timelimit); // arbitrary
writeRegister8(LIS3DH_REG_TIMELATENCY, timelatency); // arbitrary
writeRegister8(LIS3DH_REG_TIMEWINDOW, timewindow); // arbitrary
}
开发者ID:leethomason,项目名称:Adafruit_LIS3DH,代码行数:25,代码来源:Adafruit_LIS3DH.cpp
示例10: readRegister8
hmc5883l_mode_t HMC5883L::getMeasurementMode(void)
{
uint8_t value;
value = readRegister8(HMC5883L_REG_MODE);
value &= 0b00000011;
return (hmc5883l_mode_t)value;
}
开发者ID:bartlettc22,项目名称:desertviper,代码行数:9,代码来源:HMC5883L.cpp
示例11: readRegister8
bool Adafruit_MMA8451::begin(uint8_t i2caddr) {
Wire.begin();
_i2caddr = i2caddr;
/* Check connection */
uint8_t deviceid = readRegister8(MMA8451_REG_WHOAMI);
if (deviceid != 0x1A)
{
/* No MMA8451 detected ... return false */
//Serial.println(deviceid, HEX);
return false;
}
writeRegister8(MMA8451_REG_CTRL_REG2, 0x40); // reset
while (readRegister8(MMA8451_REG_CTRL_REG2) & 0x40);
// enable 4G range
writeRegister8(MMA8451_REG_XYZ_DATA_CFG, MMA8451_RANGE_4_G);
// High res
writeRegister8(MMA8451_REG_CTRL_REG2, 0x02);
// Low noise!
writeRegister8(MMA8451_REG_CTRL_REG1, 0x04);
// DRDY on INT1
writeRegister8(MMA8451_REG_CTRL_REG4, 0x01);
writeRegister8(MMA8451_REG_CTRL_REG5, 0x01);
// Turn on orientation config
writeRegister8(MMA8451_REG_PL_CFG, 0x40);
// Activate!
writeRegister8(MMA8451_REG_CTRL_REG1, 0x01); // active, max rate
/*
for (uint8_t i=0; i<0x30; i++) {
Serial.print("$");
Serial.print(i, HEX); Serial.print(" = 0x");
Serial.println(readRegister8(i), HEX);
}
*/
return true;
}
开发者ID:paperclipninja,项目名称:CSE132,代码行数:43,代码来源:Adafruit_MMA8451.cpp
示例12: InitTransaction
boolean Adafruit_STMPE610::begin() {
// hardware SPI
InitTransaction();
// SPI = mraa_spi_init(0); // which buss? will experment here...
SPI = mraa_spi_init_software_cs(0); // which buss? will experment here...
mraa_spi_frequency(SPI, 1000000);
mraa_spi_lsbmode(SPI, false);
mraa_spi_mode(SPI, MRAA_SPI_MODE0);
m_spiMode = MRAA_SPI_MODE0;
_gpioCS = mraa_gpio_init(_cs);
mraa_gpio_dir(_gpioCS, MRAA_GPIO_OUT);
CSHigh();
mraa_spi_write(SPI, 0x00);
// try mode0
if (getVersion() != 0x811) {
//Serial.println("try MODE1");
mraa_spi_frequency(SPI, 1000000);
mraa_spi_lsbmode(SPI, false);
mraa_spi_mode(SPI, MRAA_SPI_MODE1);
m_spiMode = MRAA_SPI_MODE1;
if (getVersion() != 0x811) {
return false;
}
}
writeRegister8(STMPE_SYS_CTRL1, STMPE_SYS_CTRL1_RESET);
delay(10);
for (uint8_t i=0; i<65; i++) {
readRegister8(i);
}
writeRegister8(STMPE_SYS_CTRL2, 0x0); // turn on clocks!
writeRegister8(STMPE_TSC_CTRL, STMPE_TSC_CTRL_XYZ | STMPE_TSC_CTRL_EN); // XYZ and enable!
//Serial.println(readRegister8(STMPE_TSC_CTRL), HEX);
writeRegister8(STMPE_INT_EN, STMPE_INT_EN_TOUCHDET);
writeRegister8(STMPE_ADC_CTRL1, STMPE_ADC_CTRL1_10BIT | (0x6 << 4)); // 96 clocks per conversion
writeRegister8(STMPE_ADC_CTRL2, STMPE_ADC_CTRL2_6_5MHZ);
writeRegister8(STMPE_TSC_CFG, STMPE_TSC_CFG_4SAMPLE | STMPE_TSC_CFG_DELAY_1MS | STMPE_TSC_CFG_SETTLE_5MS);
writeRegister8(STMPE_TSC_FRACTION_Z, 0x6);
writeRegister8(STMPE_FIFO_TH, 1);
writeRegister8(STMPE_FIFO_STA, STMPE_FIFO_STA_RESET);
writeRegister8(STMPE_FIFO_STA, 0); // unreset
writeRegister8(STMPE_TSC_I_DRIVE, STMPE_TSC_I_DRIVE_50MA);
writeRegister8(STMPE_INT_STA, 0xFF); // reset all ints
writeRegister8(STMPE_INT_CTRL, STMPE_INT_CTRL_POL_HIGH | STMPE_INT_CTRL_ENABLE);
return true;
}
开发者ID:wbsimms,项目名称:Edison_Eclipse,代码行数:54,代码来源:Adafruit_STMPE610.cpp
示例13: writeRegister
void DW1000::sendFrame(uint8_t* message, uint16_t length) {
if (length >= 125) length = 125; // check for maximim length a frame can have with 127 Byte frames
writeRegister(DW1000_TX_BUFFER, 0, message, length); // fill buffer
uint8_t backup = readRegister8(DW1000_TX_FCTRL, 1); // put length of frame
length += 2; // including 2 CRC Bytes
length = ((backup & 0xFC) << 8) | (length & 0x03FF);
writeRegister16(DW1000_TX_FCTRL, 0, length);
stopTRX(); // stop receiving
writeRegister8(DW1000_SYS_CTRL, 0, 0x02); // trigger sending process by setting the TXSTRT bit
startRX(); // enable receiver again
}
开发者ID:ykiveish,项目名称:dw1000,代码行数:13,代码来源:dw1000.cpp
示例14: writeRegister
boolean Adafruit_MPR121::begin(uint8_t i2caddr) {
Wire.begin();
_i2caddr = i2caddr;
// soft reset
writeRegister(MPR121_SOFTRESET, 0x63);
delay(1);
for (uint8_t i=0; i<0x7F; i++) {
// Serial.print("$"); Serial.print(i, HEX);
// Serial.print(": 0x"); Serial.println(readRegister8(i));
}
writeRegister(MPR121_ECR, 0x0);
uint8_t c = readRegister8(MPR121_CONFIG2);
if (c != 0x24) return false;
setThreshholds(48,6); //(12, 6); // ylh: THIS IS THE THRESHOLDS FOR ALL KEYS
writeRegister(MPR121_MHDR, 0x01);
writeRegister(MPR121_NHDR, 0x01);
writeRegister(MPR121_NCLR, 0x0E);
writeRegister(MPR121_FDLR, 0x00);
writeRegister(MPR121_MHDF, 0x01);
writeRegister(MPR121_NHDF, 0x05);
writeRegister(MPR121_NCLF, 0x01);
writeRegister(MPR121_FDLF, 0x00);
writeRegister(MPR121_NHDT, 0x00);
writeRegister(MPR121_NCLT, 0x00);
writeRegister(MPR121_FDLT, 0x00);
writeRegister(MPR121_DEBOUNCE, 0);
writeRegister(MPR121_CONFIG1, 0x10); // default, 16uA charge current
writeRegister(MPR121_CONFIG2, 0x20); // 0.5uS encoding, 1ms period
// writeRegister(MPR121_AUTOCONFIG0, 0x8F);
// writeRegister(MPR121_UPLIMIT, 150);
// writeRegister(MPR121_TARGETLIMIT, 100); // should be ~400 (100 shifted)
// writeRegister(MPR121_LOWLIMIT, 50);
// enable all electrodes
writeRegister(MPR121_ECR, 0x8F); // start with first 5 bits of baseline tracking
return true;
}
开发者ID:AbilitySpectrum,项目名称:Sensact,代码行数:51,代码来源:Adafruit_MPR121.cpp
注:本文中的readRegister8函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论