本文整理汇总了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 );
}
示例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 );
}
示例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;
}
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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);
}
示例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 );
}
示例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
}
示例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
}
示例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 );
}
示例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 );
}
示例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);
}
示例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
}