当前位置: 首页>>代码示例>>C++>>正文


C++ IO_TAG函数代码示例

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


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

示例1: RCC_ClockCmd

uartPort_t *serialUART5(uint32_t baudRate, portMode_t mode, portOptions_t options)
{
    uartPort_t *s;
    static volatile uint8_t rx5Buffer[UART5_RX_BUFFER_SIZE];
    static volatile uint8_t tx5Buffer[UART5_TX_BUFFER_SIZE];
    NVIC_InitTypeDef NVIC_InitStructure;

    s = &uartPort5;
    s->port.vTable = uartVTable;

    s->port.baudRate = baudRate;

    s->port.rxBufferSize = UART5_RX_BUFFER_SIZE;
    s->port.txBufferSize = UART5_TX_BUFFER_SIZE;
    s->port.rxBuffer = rx5Buffer;
    s->port.txBuffer = tx5Buffer;

    s->USARTx = UART5;

    RCC_ClockCmd(RCC_APB1(UART5), ENABLE);

    serialUARTInit(IOGetByTag(IO_TAG(UART5_TX_PIN)), IOGetByTag(IO_TAG(UART5_RX_PIN)), mode, options, GPIO_AF_5, 5);

    NVIC_InitStructure.NVIC_IRQChannel = UART5_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = NVIC_PRIORITY_BASE(NVIC_PRIO_SERIALUART5);
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = NVIC_PRIORITY_SUB(NVIC_PRIO_SERIALUART5);
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init(&NVIC_InitStructure);

    return s;
}
开发者ID:rayone,项目名称:betaflight-1,代码行数:31,代码来源:serial_uart_stm32f30x.c

示例2: pgResetFn_adcConfig

void pgResetFn_adcConfig(adcConfig_t *adcConfig)
{
    adcConfig->device = ADC_DEV_TO_CFG(adcDeviceByInstance(ADC_INSTANCE));

#ifdef VBAT_ADC_PIN
    adcConfig->vbat.enabled = true;
    adcConfig->vbat.ioTag = IO_TAG(VBAT_ADC_PIN);
#endif

#ifdef EXTERNAL1_ADC_PIN
    adcConfig->external1.enabled = true;
    adcConfig->external1.ioTag = IO_TAG(EXTERNAL1_ADC_PIN);
#endif

#ifdef CURRENT_METER_ADC_PIN
    adcConfig->current.enabled = true;
    adcConfig->current.ioTag = IO_TAG(CURRENT_METER_ADC_PIN);
#endif

#ifdef RSSI_ADC_PIN
    adcConfig->rssi.enabled = true;
    adcConfig->rssi.ioTag = IO_TAG(RSSI_ADC_PIN);
#endif

}
开发者ID:4712,项目名称:cleanflight,代码行数:25,代码来源:adc.c

示例3: resetSonarConfig

void resetSonarConfig(sonarConfig_t *sonarConfig)
{
#if defined(SONAR_TRIGGER_PIN) && defined(SONAR_ECHO_PIN)
    sonarConfig->triggerTag = IO_TAG(SONAR_TRIGGER_PIN);
    sonarConfig->echoTag = IO_TAG(SONAR_ECHO_PIN);
#else
#error Sonar not defined for target
#endif
}
开发者ID:kc10kevin,项目名称:betaflight,代码行数:9,代码来源:config.c

示例4: IOInit

serialPort_t *usbVcpOpen(void)
{
    vcpPort_t *s;

    IOInit(IOGetByTag(IO_TAG(PA11)), OWNER_USB, 0);
    IOInit(IOGetByTag(IO_TAG(PA12)), OWNER_USB, 0);

#if defined(STM32F4)
    usbGenerateDisconnectPulse();

    switch (usbDevConfig()->type) {
#ifdef USE_USB_CDC_HID
    case COMPOSITE:
        USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_HID_CDC_cb, &USR_cb);
        break;
#endif
    default:
        USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb);
        break;
    }
#elif defined(STM32F7)
    usbGenerateDisconnectPulse();

    /* Init Device Library */
    USBD_Init(&USBD_Device, &VCP_Desc, 0);

    /* Add Supported Class */
    switch (usbDevConfig()->type) {
#ifdef USE_USB_CDC_HID
    case COMPOSITE:
    	USBD_RegisterClass(&USBD_Device, USBD_HID_CDC_CLASS);
        break;
#endif
    default:
        USBD_RegisterClass(&USBD_Device, USBD_CDC_CLASS);
        break;
    }

    /* HID Interface doesn't have any callbacks... */
    /* Add CDC Interface Class */
    USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops);

    /* Start Device Process */
    USBD_Start(&USBD_Device);
#else
    Set_System();
    Set_USBClock();
    USB_Init();
    USB_Interrupts_Config();
#endif

    s = &vcpPort;
    s->port.vTable = usbVTable;

    return (serialPort_t *)s;
}
开发者ID:4712betaflight,项目名称:betaflight,代码行数:56,代码来源:serial_usb_vcp.c

示例5: i2cInit

void i2cInit(I2CDevice device)
{
    UNUSED(device);

    scl = IOGetByTag(IO_TAG(SOFT_I2C_SCL));
    sda = IOGetByTag(IO_TAG(SOFT_I2C_SDA));

    IOConfigGPIO(scl, IOCFG_OUT_OD);
    IOConfigGPIO(sda, IOCFG_OUT_OD);
}
开发者ID:NZFez,项目名称:betaflight,代码行数:10,代码来源:bus_i2c_soft.c

示例6: mma8451ConfigureInterrupt

static inline void mma8451ConfigureInterrupt(void)
{
#ifdef MMA8451_INT_PIN
    IOInit(IOGetByTag(IO_TAG(MMA8451_INT_PIN)), OWNER_MPU_EXTI, 0);
    // TODO - maybe pullup / pulldown ?
    IOConfigGPIO(IOGetByTag(IO_TAG(MMA8451_INT_PIN)), IOCFG_IN_FLOATING); 
#endif

    i2cWrite(MPU_I2C_INSTANCE, MMA8452_ADDRESS, MMA8452_CTRL_REG3, MMA8452_CTRL_REG3_IPOL); // Interrupt polarity (active HIGH)
    i2cWrite(MPU_I2C_INSTANCE, MMA8452_ADDRESS, MMA8452_CTRL_REG4, MMA8452_CTRL_REG4_INT_EN_DRDY); // Enable DRDY interrupt (unused by this driver)
    i2cWrite(MPU_I2C_INSTANCE, MMA8452_ADDRESS, MMA8452_CTRL_REG5, 0); // DRDY routed to INT2
}
开发者ID:basdelfos,项目名称:betaflight,代码行数:12,代码来源:accgyro_mma845x.c

示例7: updateHardwareRevision

void updateHardwareRevision(void)
{
    if (hardwareRevision != BJF4_REV2) {
        return;
    }
    
    /* 
        if flash exists on PB3 then Rev1
    */
    if (m25p16_init(IO_TAG(PB3))) {
        hardwareRevision = BJF4_REV1;
    } else {
        IOInit(IOGetByTag(IO_TAG(PB3)), OWNER_FREE, RESOURCE_NONE, 0);
    }
}
开发者ID:mmiers,项目名称:betaflight,代码行数:15,代码来源:hardware_revision.c

示例8: selectMPUIntExtiConfigByHardwareRevision

ioTag_t selectMPUIntExtiConfigByHardwareRevision(void)
{

#ifdef AFROMINI
    return IO_TAG(PC13);
#else
    if (hardwareRevision < NAZE32_REV5) {
        // MPU_INT output on rev4 PB13
        return IO_TAG(PB13);
    } else {
        // MPU_INT output on rev5 PC13
        return IO_TAG(PC13);
    }
#endif
}
开发者ID:basdelfos,项目名称:betaflight,代码行数:15,代码来源:hardware_revision.c

示例9: targetConfiguration

// alternative defaults settings for BlueJayF4 targets
void targetConfiguration(void)
{
    if (hardwareRevision == BJF4_REV1 || hardwareRevision == BJF4_REV2) {
        gyroDeviceConfigMutable(0)->align = CW180_DEG;
        beeperDevConfigMutable()->ioTag = IO_TAG(BEEPER_OPT);
    }

    if (hardwareRevision == BJF4_MINI_REV3A || hardwareRevision == BJF4_REV1) {
        blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
    }

    if (hardwareRevision == BJF4_MINI_REV3A) {
        adcConfigMutable()->vbat.ioTag = IO_TAG(PA4);
    }
}
开发者ID:4712betaflight,项目名称:betaflight,代码行数:16,代码来源:config.c

示例10: detectSpiDevice

uint8_t detectSpiDevice(void)
{
#ifdef NAZE_SPI_CS_PIN
    nazeSpiCsPin = IOGetByTag(IO_TAG(NAZE_SPI_CS_PIN));
#endif

    uint8_t out[] = { M25P16_INSTRUCTION_RDID, 0, 0, 0 };
    uint8_t in[4];
    uint32_t flash_id;

    // try autodetect flash chip
    delay(50); // short delay required after initialisation of SPI device instance.
    ENABLE_SPI_CS;
    spiTransfer(NAZE_SPI_INSTANCE, in, out, sizeof(out));
    DISABLE_SPI_CS;

    flash_id = in[1] << 16 | in[2] << 8 | in[3];
    if (flash_id == FLASH_M25P16_ID)
        return SPI_DEVICE_FLASH;


    // try autodetect MPU
    delay(50);
    ENABLE_SPI_CS;
    spiTransferByte(NAZE_SPI_INSTANCE, MPU_RA_WHO_AM_I | MPU6500_BIT_RESET);
    in[0] = spiTransferByte(NAZE_SPI_INSTANCE, 0xff);
    DISABLE_SPI_CS;

    if (in[0] == MPU6500_WHO_AM_I_CONST)
        return SPI_DEVICE_MPU;

    return SPI_DEVICE_NONE;
}
开发者ID:basdelfos,项目名称:betaflight,代码行数:33,代码来源:hardware_revision.c

示例11: max7456Init

void max7456Init(const vcdProfile_t *pVcdProfile)
{
#ifdef MAX7456_SPI_CS_PIN
    max7456CsPin = IOGetByTag(IO_TAG(MAX7456_SPI_CS_PIN));
#endif
    IOInit(max7456CsPin, OWNER_OSD_CS, 0);
    IOConfigGPIO(max7456CsPin, SPI_IO_CS_CFG);

    spiSetDivisor(MAX7456_SPI_INSTANCE, SPI_CLOCK_STANDARD);
    // force soft reset on Max7456
    ENABLE_MAX7456;
    max7456Send(MAX7456ADD_VM0, MAX7456_RESET);
    DISABLE_MAX7456;

    // Setup values to write to registers
    videoSignalCfg = pVcdProfile->video_system;
    hosRegValue = 32 - pVcdProfile->h_offset;
    vosRegValue = 16 - pVcdProfile->v_offset;

#ifdef MAX7456_DMA_CHANNEL_TX
    dmaSetHandler(MAX7456_DMA_IRQ_HANDLER_ID, max7456_dma_irq_handler, NVIC_PRIO_MAX7456_DMA, 0);
#endif

    // Real init will be made later when driver detect idle.
}
开发者ID:DTFUHF,项目名称:betaflight,代码行数:25,代码来源:max7456.c

示例12: m25p16_init

/**
 * Initialize the driver, must be called before any other routines.
 *
 * Attempts to detect a connected m25p16. If found, true is returned and device capacity can be fetched with
 * m25p16_getGeometry().
 */
bool m25p16_init(ioTag_t csTag)
{
    /*
        if we have already detected a flash device we can simply exit

        TODO: change the init param in favour of flash CFG when ParamGroups work is done
        then cs pin can be specified in hardware_revision.c or config.c (dependent on revision).
    */
    if (geometry.sectors) {
        return true;
    }

    if (csTag) {
        m25p16CsPin = IOGetByTag(csTag);
    } else {
#ifdef M25P16_CS_PIN
        m25p16CsPin = IOGetByTag(IO_TAG(M25P16_CS_PIN));
#else
        return false;
#endif
    }
    IOInit(m25p16CsPin, OWNER_FLASH_CS, 0);
    IOConfigGPIO(m25p16CsPin, SPI_IO_CS_CFG);

    DISABLE_M25P16;

#ifndef M25P16_SPI_SHARED
    //Maximum speed for standard READ command is 20mHz, other commands tolerate 25mHz
    spiSetDivisor(M25P16_SPI_INSTANCE, SPI_CLOCK_FAST);
#endif

    return m25p16_readIdentification();
}
开发者ID:AlienWiiBF,项目名称:betaflight,代码行数:39,代码来源:flash_m25p16.c

示例13: sdcardInsertionDetectDeinit

void sdcardInsertionDetectDeinit(void)
{
#ifdef SDCARD_DETECT_PIN
    sdCardDetectPin = IOGetByTag(IO_TAG(SDCARD_DETECT_PIN));
    IOInit(sdCardDetectPin, OWNER_FREE, RESOURCE_NONE, 0);
    IOConfigGPIO(sdCardDetectPin, IOCFG_IN_FLOATING); 
#endif
}
开发者ID:Liquidas,项目名称:betaflight,代码行数:8,代码来源:sdcard.c

示例14: targetConfiguration

// alternative defaults settings for BlueJayF4 targets
void targetConfiguration(master_t *config)
{
    if (hardwareRevision == BJF4_REV1 || hardwareRevision == BJF4_REV2) {
        config->sensorAlignmentConfig.gyro_align = CW180_DEG;
        config->sensorAlignmentConfig.acc_align  = CW180_DEG;
        config->beeperConfig.ioTag = IO_TAG(BEEPER_OPT);
    }
}
开发者ID:mmiers,项目名称:betaflight,代码行数:9,代码来源:config.c

示例15: sdcardInsertionDetectInit

void sdcardInsertionDetectInit(void)
{
#ifdef SDCARD_DETECT_PIN
    sdCardDetectPin = IOGetByTag(IO_TAG(SDCARD_DETECT_PIN));
    IOInit(sdCardDetectPin, OWNER_SDCARD, RESOURCE_INPUT, 0);
    IOConfigGPIO(sdCardDetectPin, IOCFG_IPU); 
#endif
}
开发者ID:Liquidas,项目名称:betaflight,代码行数:8,代码来源:sdcard.c


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