• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ HAL_ERROR1函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HAL_ERROR1函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_ERROR1函数的具体用法?C++ HAL_ERROR1怎么用?C++ HAL_ERROR1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HAL_ERROR1函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: switch

bool RTIMUGD20HM303DLHC::setAccelCTRL4()
{
    unsigned char ctrl4;

    switch (m_settings->m_GD20HM303DLHCAccelFsr) {
    case LSM303DLHC_ACCEL_FSR_2:
        m_accelScale = (RTFLOAT)0.001 / (RTFLOAT)16;
        break;

    case LSM303DLHC_ACCEL_FSR_4:
        m_accelScale = (RTFLOAT)0.002 / (RTFLOAT)16;
        break;

    case LSM303DLHC_ACCEL_FSR_8:
        m_accelScale = (RTFLOAT)0.004 / (RTFLOAT)16;
        break;

    case LSM303DLHC_ACCEL_FSR_16:
        m_accelScale = (RTFLOAT)0.012 / (RTFLOAT)16;
        break;

    default:
        HAL_ERROR1("Illegal LSM303DLHC accel FSR code %d\n", m_settings->m_GD20HM303DLHCAccelFsr);
        return false;
    }

    ctrl4 = 0x80 + (m_settings->m_GD20HM303DLHCAccelFsr << 4);

    return m_settings->HALWrite(m_accelSlaveAddr,  LSM303DLHC_CTRL4_A, ctrl4, "Failed to set LSM303DLHC CTRL4");
}
开发者ID:Delan90,项目名称:RTIMULib2,代码行数:30,代码来源:RTIMUGD20HM303DLHC.cpp


示例2: switch

bool RTIMUMPU9150::setGyroFsr(unsigned char fsr)
{
    switch (fsr) {
    case MPU9150_GYROFSR_250:
        m_gyroFsr = fsr;
        m_gyroScale = RTMATH_PI / (131.0 * 180.0);
        return true;

    case MPU9150_GYROFSR_500:
        m_gyroFsr = fsr;
        m_gyroScale = RTMATH_PI / (62.5 * 180.0);
        return true;

    case MPU9150_GYROFSR_1000:
        m_gyroFsr = fsr;
        m_gyroScale = RTMATH_PI / (32.8 * 180.0);
        return true;

    case MPU9150_GYROFSR_2000:
        m_gyroFsr = fsr;
        m_gyroScale = RTMATH_PI / (16.4 * 180.0);
        return true;

    default:
        HAL_ERROR1("Illegal MPU9150 gyro fsr %d\n", fsr);
        return false;
    }
}
开发者ID:carpe-noctem-cassel,项目名称:cnc-msldriver,代码行数:28,代码来源:RTIMUMPU9150.cpp


示例3: switch

bool RTIMULSM9DS0::setCompassCTRL6()
{
    unsigned char ctrl6;

    //  convert FSR to uT

    switch (m_settings->m_LSM9DS0CompassFsr) {
    case LSM9DS0_COMPASS_FSR_2:
        ctrl6 = 0;
        m_compassScale = (RTFLOAT)0.008;
        break;

    case LSM9DS0_COMPASS_FSR_4:
        ctrl6 = 0x20;
        m_compassScale = (RTFLOAT)0.016;
        break;

    case LSM9DS0_COMPASS_FSR_8:
        ctrl6 = 0x40;
        m_compassScale = (RTFLOAT)0.032;
        break;

    case LSM9DS0_COMPASS_FSR_12:
        ctrl6 = 0x60;
        m_compassScale = (RTFLOAT)0.0479;
        break;

    default:
        HAL_ERROR1("Illegal LSM9DS0 compass FSR code %d\n", m_settings->m_LSM9DS0CompassFsr);
        return false;
    }

    return I2CWrite(m_accelCompassSlaveAddr,  LSM9DS0_CTRL6, ctrl6, "Failed to set LSM9DS0 compass CTRL6");
}
开发者ID:DanielAshley,项目名称:Masters_Thesis,代码行数:34,代码来源:RTIMULSM9DS0.cpp


示例4: switch

bool RTIMUBMX055::setAccelFSR()
{
    unsigned char reg;

    switch(m_settings->m_BMX055AccelFsr) {
    case BMX055_ACCEL_FSR_2:
        reg = 0x03;
        m_accelScale = 0.00098 / 16.0;
        break;

    case BMX055_ACCEL_FSR_4:
        reg = 0x05;
        m_accelScale = 0.00195 / 16.0;
        break;

    case BMX055_ACCEL_FSR_8:
        reg = 0x08;
        m_accelScale = 0.00391 / 16.0;
        break;

    case BMX055_ACCEL_FSR_16:
        reg = 0x0c;
        m_accelScale = 0.00781 / 16.0;
        break;

    default:
        HAL_ERROR1("Illegal BMX055 accel FSR code %d\n", m_settings->m_BMX055AccelFsr);
        return false;
    }
    return (m_settings->HALWrite(m_accelSlaveAddr, BMX055_ACCEL_PMU_RANGE, reg, "Failed to set BMX055 accel rate"));
}
开发者ID:bradleydanielson,项目名称:test_IMULib,代码行数:31,代码来源:RTIMUBMX055.cpp


示例5: switch

bool RTIMULSM9DS1::setCompassCTRL2()
{
    unsigned char ctrl2;

    //  convert FSR to uT

    switch (m_settings->m_LSM9DS1CompassFsr) {
    case LSM9DS1_COMPASS_FSR_4:
        ctrl2 = 0;
        m_compassScale = (RTFLOAT)0.014;
        break;

    case LSM9DS1_COMPASS_FSR_8:
        ctrl2 = 0x20;
        m_compassScale = (RTFLOAT)0.029;
        break;

    case LSM9DS1_COMPASS_FSR_12:
        ctrl2 = 0x40;
        m_compassScale = (RTFLOAT)0.043;
        break;

    case LSM9DS1_COMPASS_FSR_16:
        ctrl2 = 0x60;
        m_compassScale = (RTFLOAT)0.058;
        break;

    default:
        HAL_ERROR1("Illegal LSM9DS1 compass FSR code %d\n", m_settings->m_LSM9DS1CompassFsr);
        return false;
    }

    return m_settings->HALWrite(m_magSlaveAddr, LSM9DS1_MAG_CTRL2, ctrl2, "Failed to set LSM9DS1 compass CTRL6");
}
开发者ID:uutzinger,项目名称:RTIMULib2-Teensy,代码行数:34,代码来源:RTIMULSM9DS1.cpp


示例6: HAL_ERROR1

bool RTIMULSM9DS0::setGyroCTRL2()
{
    if ((m_settings->m_LSM9DS0GyroHpf < LSM9DS0_GYRO_HPF_0) || (m_settings->m_LSM9DS0GyroHpf > LSM9DS0_GYRO_HPF_9)) {
        HAL_ERROR1("Illegal LSM9DS0 gyro high pass filter code %d\n", m_settings->m_LSM9DS0GyroHpf);
        return false;
    }
    return I2CWrite(m_gyroSlaveAddr,  LSM9DS0_GYRO_CTRL2, m_settings->m_LSM9DS0GyroHpf, "Failed to set LSM9DS0 gyro CTRL2");
}
开发者ID:DanielAshley,项目名称:Masters_Thesis,代码行数:8,代码来源:RTIMULSM9DS0.cpp


示例7: HAL_ERROR1

bool RTIMUGD20HM303DLHC::setGyroCTRL2()
{
    if ((m_settings->m_GD20HM303DLHCGyroHpf < L3GD20H_HPF_0) || (m_settings->m_GD20HM303DLHCGyroHpf > L3GD20H_HPF_9)) {
        HAL_ERROR1("Illegal L3GD20H high pass filter code %d\n", m_settings->m_GD20HM303DLHCGyroHpf);
        return false;
    }
    return m_settings->HALWrite(m_gyroSlaveAddr,  L3GD20H_CTRL2, m_settings->m_GD20HM303DLHCGyroHpf, "Failed to set L3GD20H CTRL2");
}
开发者ID:Delan90,项目名称:RTIMULib2,代码行数:8,代码来源:RTIMUGD20HM303DLHC.cpp


示例8: HAL_ERROR1

bool RTIMUMPU9150::setCompassRate(int rate)
{
    if ((rate < MPU9150_COMPASSRATE_MIN) || (rate > MPU9150_COMPASSRATE_MAX)) {
        HAL_ERROR1("Illegal compass rate %d\n", rate);
        return false;
    }
    m_compassRate = rate;
    return true;
}
开发者ID:carpe-noctem-cassel,项目名称:cnc-msldriver,代码行数:9,代码来源:RTIMUMPU9150.cpp


示例9: HAL_ERROR1

bool RTIMULSM9DS1::setAccelCTRL6()
{
    unsigned char ctrl6;

    if ((m_settings->m_LSM9DS1AccelSampleRate < 0) || (m_settings->m_LSM9DS1AccelSampleRate > 6)) {
        HAL_ERROR1("Illegal LSM9DS1 accel sample rate code %d\n", m_settings->m_LSM9DS1AccelSampleRate);
        return false;
    }

    ctrl6 = (m_settings->m_LSM9DS1AccelSampleRate << 5);

    if ((m_settings->m_LSM9DS1AccelLpf < 0) || (m_settings->m_LSM9DS1AccelLpf > 3)) {
        HAL_ERROR1("Illegal LSM9DS1 accel low pass fiter code %d\n", m_settings->m_LSM9DS1AccelLpf);
        return false;
    }

    switch (m_settings->m_LSM9DS1AccelFsr) {
    case LSM9DS1_ACCEL_FSR_2:
        m_accelScale = (RTFLOAT)0.000061;
        break;

    case LSM9DS1_ACCEL_FSR_4:
        m_accelScale = (RTFLOAT)0.000122;
        break;

    case LSM9DS1_ACCEL_FSR_8:
        m_accelScale = (RTFLOAT)0.000244;
        break;

    case LSM9DS1_ACCEL_FSR_16:
        m_accelScale = (RTFLOAT)0.000732;
        break;

    default:
        HAL_ERROR1("Illegal LSM9DS1 accel FSR code %d\n", m_settings->m_LSM9DS1AccelFsr);
        return false;
    }

    ctrl6 |= (m_settings->m_LSM9DS1AccelLpf) | (m_settings->m_LSM9DS1AccelFsr << 3);

    return m_settings->HALWrite(m_accelGyroSlaveAddr,  LSM9DS1_CTRL6, ctrl6, "Failed to set LSM9DS1 accel CTRL6");
}
开发者ID:uutzinger,项目名称:RTIMULib2-Teensy,代码行数:42,代码来源:RTIMULSM9DS1.cpp


示例10: while

bool RTIMUHal::HALRead(unsigned char slaveAddr, unsigned char length,
                    unsigned char *data, const char *errorMsg)
{
    int tries, result, total;
    unsigned char rxBuff[MAX_READ_LEN + 1];
    struct spi_ioc_transfer rdIOC;

    if (m_busIsI2C) {
        if (!I2CSelectSlave(slaveAddr, errorMsg))
            return false;

        total = 0;
        tries = 0;

        while ((total < length) && (tries < 5)) {
            result = read(m_I2C, data + total, length - total);

            if (result < 0) {
                if (strlen(errorMsg) > 0)
                    HAL_ERROR2("I2C read error from %d - %s\n", slaveAddr, errorMsg);
                return false;
            }

            total += result;

            if (total == length)
                break;

            delayMs(10);
            tries++;
        }

        if (total < length) {
            if (strlen(errorMsg) > 0)
                HAL_ERROR2("I2C read from %d failed - %s\n", slaveAddr, errorMsg);
            return false;
        }
    } else {
        memset(&rdIOC, 0, sizeof(rdIOC));
        rdIOC.tx_buf = 0;
        rdIOC.rx_buf = (unsigned long) rxBuff;
        rdIOC.len = length;

        if (ioctl(m_SPI, SPI_IOC_MESSAGE(1), &rdIOC) < 0) {
            if (strlen(errorMsg) > 0)
                HAL_ERROR1("SPI read error from - %s\n", errorMsg);
            return false;
        }
        memcpy(data, rxBuff, length);
    }
    return true;
}
开发者ID:suyashkumar,项目名称:BME464_Tremor,代码行数:52,代码来源:RTIMUHal.cpp


示例11: HAL_ERROR1

bool RTIMUHal::HALRead(unsigned char slaveAddr, unsigned char length,
                    unsigned char *data, const char *errorMsg)
{
    if (m_busIsI2C) {
        if (I2Cdev::readBytes(slaveAddr, length, data, 10) == length)
             return true;
        if (strlen(errorMsg) > 0)
            HAL_ERROR1("I2C read failed - %s\n", errorMsg);
        return false;
    } else {
        SPI.beginTransaction(m_SPISettings);
        digitalWrite(m_SPISelect, LOW);
        for (int i = 0; i < length; i++)
            data[i] = SPI.transfer(0);
        digitalWrite(m_SPISelect, HIGH);
        SPI.endTransaction();
        return true;
    }
}
开发者ID:uutzinger,项目名称:RTIMULib2-Teensy,代码行数:19,代码来源:RTIMUHal.cpp


示例12: switch

bool RTIMUMPU9255::setAccelLpf(unsigned char lpf)
{
    switch (lpf) {
    case MPU9255_ACCEL_LPF_1130:
    case MPU9255_ACCEL_LPF_460:
    case MPU9255_ACCEL_LPF_184:
    case MPU9255_ACCEL_LPF_92:
    case MPU9255_ACCEL_LPF_41:
    case MPU9255_ACCEL_LPF_20:
    case MPU9255_ACCEL_LPF_10:
    case MPU9255_ACCEL_LPF_5:
        m_accelLpf = lpf;
        return true;

    default:
        HAL_ERROR1("Illegal MPU9255 accel lpf %d\n", lpf);
        return false;
    }
}
开发者ID:uutzinger,项目名称:RTIMULib2-Teensy,代码行数:19,代码来源:RTIMUMPU9255.cpp


示例13: HAL_ERROR1

bool RTIMUHal::I2CSelectSlave(unsigned char slaveAddr, const char *errorMsg)
{
    if (m_currentSlave == slaveAddr)
        return true;

    if (!HALOpen()) {
        HAL_ERROR1("Failed to open I2C port - %s\n", errorMsg);
        return false;
    }

    if (ioctl(m_I2C, I2C_SLAVE, slaveAddr) < 0) {
        HAL_ERROR2("I2C slave select %d failed - %s\n", slaveAddr, errorMsg);
        return false;
    }

    m_currentSlave = slaveAddr;

    return true;
}
开发者ID:dnewmanca,项目名称:RTIMULib,代码行数:19,代码来源:RTIMUHal.cpp



注:本文中的HAL_ERROR1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HAL_EXIT_CRITICAL_SECTION函数代码示例发布时间:2022-05-30
下一篇:
C++ HAL_ENTER_CRITICAL_SECTION函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap