當前位置: 首頁>>代碼示例>>C++>>正文


C++ GpioInit函數代碼示例

本文整理匯總了C++中GpioInit函數的典型用法代碼示例。如果您正苦於以下問題:C++ GpioInit函數的具體用法?C++ GpioInit怎麽用?C++ GpioInit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GpioInit函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: UartMcuDeInit

void UartMcuDeInit( Uart_t *obj )
{
    USART_DeInit( USART1 );

    GpioInit( &obj->Tx, obj->Tx.pin, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &obj->Rx, obj->Rx.pin, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
}
開發者ID:BMWLab-Ken,項目名稱:BMW-Lab-Blutech-Sensor-MCU,代碼行數:7,代碼來源:uart-board.c

示例2: SpiInit

void SpiInit( Spi_t *obj, PinNames mosi, PinNames miso, PinNames sclk, PinNames nss )
{
    __HAL_RCC_SPI1_FORCE_RESET( );
    __HAL_RCC_SPI1_RELEASE_RESET( );

    __HAL_RCC_SPI1_CLK_ENABLE( );

    obj->Spi.Instance = ( SPI_TypeDef *) SPI1_BASE;

    GpioInit( &obj->Mosi, mosi, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_DOWN, GPIO_AF5_SPI1 );
    GpioInit( &obj->Miso, miso, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_DOWN, GPIO_AF5_SPI1 );
    GpioInit( &obj->Sclk, sclk, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_DOWN, GPIO_AF5_SPI1 );

    if( nss != NC )
    {
        GpioInit( &obj->Nss, nss, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, GPIO_AF5_SPI1 );
    }
    else
    {
        obj->Spi.Init.NSS = SPI_NSS_SOFT;
    }

    if( nss == NC )
    {
        SpiFormat( obj, SPI_DATASIZE_8BIT, SPI_POLARITY_LOW, SPI_PHASE_1EDGE, 0 );
    }
    else
    {
        SpiFormat( obj, SPI_DATASIZE_8BIT, SPI_POLARITY_LOW, SPI_PHASE_1EDGE, 1 );
    }
    SpiFrequency( obj, 10000000 );

    HAL_SPI_Init( &obj->Spi );
}
開發者ID:ARMmbed,項目名稱:LoRaMac-node,代碼行數:34,代碼來源:spi-board.c

示例3: UartMcuInit

void UartMcuInit( Uart_t *obj, uint8_t uartId, PinNames tx, PinNames rx )
{
    obj->UartId = uartId;

    switch ( obj->UartId )
    {
    case UART_1:
        RCC_APB2PeriphClockCmd( RCC_APB2Periph_USART1, ENABLE );

        USART_DeInit( USART1 );

        GpioInit( &obj->Tx, tx, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
        GpioInit( &obj->Rx, rx, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );

        GPIO_PinAFConfig( obj->Tx.port, ( obj->Tx.pin & 0x0F ), GPIO_AF_USART1 );
        GPIO_PinAFConfig( obj->Rx.port, ( obj->Rx.pin & 0x0F ), GPIO_AF_USART1 );
        break;
    case UART_2:
        RCC_APB1PeriphClockCmd( RCC_APB1Periph_USART2, ENABLE );

        USART_DeInit( USART2 );

        GpioInit( &obj->Tx, tx, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
        GpioInit( &obj->Rx, rx, PIN_ALTERNATE_FCT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );

        GPIO_PinAFConfig( obj->Tx.port, ( obj->Tx.pin & 0x0F ), GPIO_AF_USART2 );
        GPIO_PinAFConfig( obj->Rx.port, ( obj->Rx.pin & 0x0F ), GPIO_AF_USART2 );
        break;
    }
}
開發者ID:davincicloud-kr,項目名稱:im-l200,代碼行數:30,代碼來源:uart-board.c

示例4: BoardInitPeriph

void BoardInitPeriph( void )
{
    /* Init the GPIO extender pins */
//		GpioInit( &IrqMpl3115, IRQ_MPL3115, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//		GpioInit( &IrqMag3110, IRQ_MAG3110, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &GpsPowerEn, GPS_POWER_ON, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &NcIoe3, SPARE_IO_EXT_3, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &NcIoe4, SPARE_IO_EXT_4, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &NcIoe5, SPARE_IO_EXT_5, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &NcIoe6, SPARE_IO_EXT_6, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &NcIoe7, SPARE_IO_EXT_7, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &NIrqSx9500, N_IRQ_SX9500, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &Irq1Mma8451, IRQ_1_MMA8451, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &Irq2Mma8451, IRQ_2_MMA8451, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
//    GpioInit( &TxEnSx9500, TX_EN_SX9500, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 1 );
    GpioInit( &Led1, LED_1, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &Led2, LED_2, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
		GpioInit( &testInterupt, TEST_INTERUPT, PIN_INPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 0 );
		GpioSetInterrupt( &testInterupt, IRQ_RISING_EDGE, IRQ_HIGH_PRIORITY, testIrq[0] );
    //GpioInit( &Led3, LED_3, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );

    // Switch LED 1, 2, 3 OFF
    GpioWrite( &Led1, 0 );
    GpioWrite( &Led2, 0 );
    //GpioWrite( &Led3, 1 );
}
開發者ID:XueZhiQiang123,項目名稱:FloRa,代碼行數:26,代碼來源:board.c

示例5: I2cMcuDeInit

void I2cMcuDeInit( I2c_t *obj )
{
    I2C_DeInit( obj->I2c );

    GpioInit( &obj->Scl, obj->Scl.pin, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &obj->Sda, obj->Sda.pin, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
}
開發者ID:AlessandroLipari,項目名稱:LoRaMac-node,代碼行數:7,代碼來源:i2c-board.c

示例6: SX126xIoInit

void SX126xIoInit( void )
{
    GpioInit( &SX126x.Spi.Nss, RADIO_NSS, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
    GpioInit( &SX126x.BUSY, RADIO_BUSY, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &SX126x.DIO1, RADIO_DIO_1, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &DeviceSel, RADIO_DEVICE_SEL, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
}
開發者ID:Lora-net,項目名稱:LoRaMac-node,代碼行數:7,代碼來源:sx1262dvk1cas-board.c

示例7: SX1272IoDeInit

void SX1272IoDeInit( void )
{
	GpioInit( &SX1272.Spi.Nss, RADIO_NSS, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );

	GpioInit( &SX1272.DIO0, RADIO_DIO_0, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
	GpioInit( &SX1272.DIO1, RADIO_DIO_1, PIN_INPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
}
開發者ID:hollie,項目名稱:LoRaMac-node,代碼行數:7,代碼來源:sx1272-board.c

示例8: I2cMcuDeInit

void I2cMcuDeInit(I2c_t *obj)
{
    I2C_DRV_MasterDeinit(obj->I2c->instance);

    GpioInit(&obj->Scl, obj->Scl.pin, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0);
    GpioInit(&obj->Sda, obj->Sda.pin, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0);
}
開發者ID:AlexanderWiniger,項目名稱:LoRaMac-node,代碼行數:7,代碼來源:i2c-board.c

示例9: SX126xReset

void SX126xReset( void )
{
    DelayMs( 10 );
    GpioInit( &SX126x.Reset, RADIO_RESET, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    DelayMs( 20 );
    GpioInit( &SX126x.Reset, RADIO_RESET, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 ); // internal pull-up
    DelayMs( 10 );
}
開發者ID:Lora-net,項目名稱:LoRaMac-node,代碼行數:8,代碼來源:sx1262dvk1cas-board.c

示例10: SX1272AntSwDeInit

void SX1272AntSwDeInit( void )
{
	#ifdef FLORA_BOARD
		GpioInit( &AntSw, RADIO_ANT_SWITCH, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
	#else
		GpioInit( &AntTx, RADIO_ANT_SWITCH_TX, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
		GpioInit( &AntRx, RADIO_ANT_SWITCH_RX, PIN_ANALOGIC, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
	#endif
}
開發者ID:XueZhiQiang123,項目名稱:FloRa,代碼行數:9,代碼來源:sx1272-board.c

示例11: SX1276AntSwDeInit

void SX1276AntSwDeInit( void )
{
#if defined(SX1276_BOARD_FREEDOM)
    GpioInit(&AntSwitchLf, RADIO_ANT_SWITCH_LF, PIN_OUTPUT, PIN_OPEN_DRAIN, PIN_NO_PULL, 0);
    GpioInit(&AntSwitchHf, RADIO_ANT_SWITCH_HF, PIN_OUTPUT, PIN_OPEN_DRAIN, PIN_NO_PULL, 0);
#elif defined(SX1276_BOARD_EMBED)
    GpioInit(&AntSwitchRxTx, RADIO_ANT_SWITCH_RX_TX, PIN_OUTPUT, PIN_OPEN_DRAIN, PIN_NO_PULL, 0);
#endif
}
開發者ID:AlexanderWiniger,項目名稱:LoRaMac-node,代碼行數:9,代碼來源:sx1276-board.c

示例12: SpiDeInit

void SpiDeInit( Spi_t *obj )
{
    HAL_SPI_DeInit( &obj->Spi );

    GpioInit( &obj->Mosi, obj->Mosi.pin, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &obj->Miso, obj->Miso.pin, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_DOWN, 0 );
    GpioInit( &obj->Sclk, obj->Sclk.pin, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &obj->Nss, obj->Nss.pin, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
}
開發者ID:ARMmbed,項目名稱:LoRaMac-node,代碼行數:9,代碼來源:spi-board.c

示例13: BoardInitPeriph

void BoardInitPeriph( void )
{
    /* Init the GPIO extender pins */
    GpioInit( &Led1, LED_1, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    GpioInit( &Led2, LED_2, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
    // Switch LED 1, 2, 3 OFF
    GpioWrite( &Led1, 1 );
    GpioWrite( &Led2, 1 );
}
開發者ID:2thetop,項目名稱:XRange,代碼行數:9,代碼來源:board.c

示例14: I2cMcuInit

void I2cMcuInit(I2c_t *obj, PinNames scl, PinNames sda)
{
    if (obj->I2c->instance < 0 || obj->I2c->instance > I2C_INSTANCE_COUNT) return;

    GpioInit(&obj->Scl, scl, PIN_ALTERNATE_FCT, PIN_OPEN_DRAIN, PIN_PULL_UP, 0);
    GpioInit(&obj->Sda, sda, PIN_ALTERNATE_FCT, PIN_OPEN_DRAIN, PIN_PULL_UP, 0);

    I2C_DRV_MasterInit(obj->I2c->instance, &obj->I2c->state);
}
開發者ID:AlexanderWiniger,項目名稱:LoRaMac-node,代碼行數:9,代碼來源:i2c-board.c

示例15: SX1272AntSwInit

void SX1272AntSwInit( void )
{
	#ifdef FLORA_BOARD
		// TX by default
		GpioInit( &AntSw, RADIO_ANT_SWITCH, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
	#else
		GpioInit( &AntTx, RADIO_ANT_SWITCH_TX, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 0 );
		GpioInit( &AntRx, RADIO_ANT_SWITCH_RX, PIN_OUTPUT, PIN_PUSH_PULL, PIN_PULL_UP, 1 );
	#endif
}
開發者ID:XueZhiQiang123,項目名稱:FloRa,代碼行數:10,代碼來源:sx1272-board.c


注:本文中的GpioInit函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。