本文整理汇总了C++中PINSEL_ConfigPin函数的典型用法代码示例。如果您正苦于以下问题:C++ PINSEL_ConfigPin函数的具体用法?C++ PINSEL_ConfigPin怎么用?C++ PINSEL_ConfigPin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PINSEL_ConfigPin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_mac_addr
void get_mac_addr(uint8_t *mac_buf) {
PINSEL_CFG_Type PinCfg;
I2C_M_SETUP_Type transferMCfg;
uint8_t eeprom_addr = EEPROM_ADDR;
/* Configure I2C0 */
PinCfg.OpenDrain = PINSEL_PINMODE_OPENDRAIN;
PinCfg.Pinmode = PINSEL_PINMODE_TRISTATE;
PinCfg.Funcnum = 1;
PinCfg.Pinnum = 27;
PinCfg.Portnum = 0;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 28;
PINSEL_ConfigPin(&PinCfg);
// Initialize Slave I2C peripheral
/* Set up clock and power for I2C0 module */
CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCI2C0, ENABLE);
/* As default, peripheral clock for I2C0 module
* is set to FCCLK / 2 */
CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_I2C0, CLKPWR_PCLKSEL_CCLK_DIV_2);
transferMCfg.sl_addr7bit = I2CDEV_S_ADDR;
transferMCfg.tx_data = &eeprom_addr;
transferMCfg.tx_length = 1;
transferMCfg.rx_data = mac_buf;
transferMCfg.rx_length = MAC_ADDR_SIZE;
transferMCfg.retransmissions_max = 3;
I2C_MasterTransferData(LPC_I2C0, &transferMCfg, I2C_TRANSFER_POLLING);
/** deinitialize I2C0 */
LPC_I2C0->I2CONCLR = I2C_I2CONCLR_I2ENC;
CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCI2C0, DISABLE);
}
示例2: c_entry
/*********************************************************************//**
* @brief c_entry: Main CAN program body
* @param[in] none
* @return int
**********************************************************************/
int c_entry(void) { /* Main Program */
PINSEL_CFG_Type PinCfg;
/* Initialize debug via UART0
* – 115200bps
* – 8 data bit
* – No parity
* – 1 stop bit
* – No flow control
*/
debug_frmwrk_init();
print_menu();
/* Pin configuration
* CAN1: select P0.0 as RD1. P0.1 as TD1
* CAN2: select P2.7 as RD2, P2.8 as RD2
*/
PinCfg.Funcnum = 1;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PinCfg.Pinnum = 0;
PinCfg.Portnum = 0;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 1;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 7;
PinCfg.Portnum = 2;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 8;
PINSEL_ConfigPin(&PinCfg);
//Initialize CAN1 & CAN2
CAN_Init(LPC_CAN1, 125000);
CAN_Init(LPC_CAN2, 125000);
//Enable Interrupt
CAN_IRQCmd(LPC_CAN2, CANINT_RIE, ENABLE);
//Enable CAN Interrupt
NVIC_EnableIRQ(CAN_IRQn);
_DBG_("CAN test Bypass Mode function...");
_DBG_("Press '1' to initialize CAN message...");_DBG_("");
while(_DG !='1');
CAN_SetAFMode(LPC_CANAF,CAN_AccBP);
CAN_InitMessage();
PrintMessage(&TXMsg);
_DBG_("Message ID and data will be increased continuously...");
_DBG_("Press '2' to start CAN operation...");
while(_DG !='2');
/** To test Bypass Mode: we send infinite messages to CAN2 and check
* receive process via COM1
*/
CAN_SendMsg(LPC_CAN1, &TXMsg);
while (1);
}
示例3: init_ssp
static void init_ssp(void)
{
SSP_CFG_Type SSP_ConfigStruct;
PINSEL_CFG_Type PinCfg;
/*
* Initialize SPI pin connect
* P0.7 - SCK;
* P0.8 - MISO
* P0.9 - MOSI
* P2.2 - SSEL - used as GPIO
*/
PinCfg.Funcnum = 2;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PinCfg.Portnum = 0;
PinCfg.Pinnum = 7;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 8;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 9;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Funcnum = 0;
PinCfg.Portnum = 2;
PinCfg.Pinnum = 2;
PINSEL_ConfigPin(&PinCfg);
SSP_ConfigStructInit(&SSP_ConfigStruct);
// Initialize SSP peripheral with parameter given in structure above
SSP_Init(LPC_SSP1, &SSP_ConfigStruct);
// Enable SSP peripheral
SSP_Cmd(LPC_SSP1, ENABLE);
}
示例4: USART_Init
void USART_Init(void)
{
UART_CFG_Type UARTConfigStruct;
UART_FIFO_CFG_Type UARTFIFOConfigStruct;
PINSEL_ConfigPin(0,2,1);
PINSEL_ConfigPin(0,3,1);
UART_ConfigStructInit(&UARTConfigStruct);
UART_Init(USART_ID, &UARTConfigStruct);
UART_FIFOConfigStructInit(&UARTFIFOConfigStruct);
#if USART_FIFO_LEVEL == 1
UARTFIFOConfigStruct.FIFO_Level = UART_FIFO_TRGLEV0;
#elif USART_FIFO_LEVEL == 4
UARTFIFOConfigStruct.FIFO_Level = UART_FIFO_TRGLEV1;
#elif USART_FIFO_LEVEL == 8
UARTFIFOConfigStruct.FIFO_Level = UART_FIFO_TRGLEV2;
#elif USART_FIFO_LEVEL == 14
UARTFIFOConfigStruct.FIFO_Level = UART_FIFO_TRGLEV3;
#endif
UART_FIFOConfig(USART_ID, &UARTFIFOConfigStruct);
UART_TxCmd(USART_ID, ENABLE);
UART_IntConfig(USART_ID, UART_INTCFG_RBR, ENABLE);
UART_IntConfig(USART_ID, UART_INTCFG_RLS, ENABLE);
UART_IntConfig(USART_ID, UART_INTCFG_THRE, ENABLE);
NVIC_SetPriority(USART_IRQ, ((0x01<<3)|0x01));
NVIC_EnableIRQ(USART_IRQ);
}
示例5: serial_init
void serial_init(void) {
PINSEL_CFG_Type PinCfg;
UART_CFG_Type UARTConfigStruct;
UART_FIFO_CFG_Type UARTFIFOConfigStruct;
//Init pins
PinCfg.Funcnum = PINSEL_FUNC_1;
PinCfg.OpenDrain = PINSEL_PINMODE_NORMAL;
PinCfg.Pinmode = PINSEL_PINMODE_PULLUP;
PinCfg.Portnum = PINSEL_PORT_0;
PinCfg.Pinnum = PINSEL_PIN_2;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = PINSEL_PIN_3;
PINSEL_ConfigPin(&PinCfg);
//Init UART Configuration parameter structure to default state: 115200,8,1,N
UART_ConfigStructInit(&UARTConfigStruct);
UARTConfigStruct.Baud_rate = 115200;
//Init FIFOConfigStruct using defaults
UART_FIFOConfigStructInit(&UARTFIFOConfigStruct);
//Start the devices USB serial
UART_Init((LPC_UART_TypeDef *)LPC_UART0, &UARTConfigStruct);
UART_FIFOConfig((LPC_UART_TypeDef *)LPC_UART0, &UARTFIFOConfigStruct);
UART_TxCmd((LPC_UART_TypeDef *)LPC_UART0, ENABLE);
}
示例6: SetupHardware
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
PINSEL_CFG_Type PinCfg;
PinCfg.Funcnum = 0;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PinCfg.Portnum = 2;
PinCfg.Pinnum = 10;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 11;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 12;
PINSEL_ConfigPin(&PinCfg);
/* is Input */
GPIO_SetDir(2, (1<<10), 0);
GPIO_SetDir(2, (1<<11), 0);
GPIO_SetDir(2, (1<<12), 0);
/* Enable system update tick timer */
GPIO_SetDir(LED1_GPIO_PORT_NUM,(1<<LED1_GPIO_BIT_NUM),1); // output
GPIO_SetDir(LED2_GPIO_PORT_NUM,(1<<LED2_GPIO_BIT_NUM),1); // output
init_timer( 0, TIMER0_INTERVAL );
Serial_Init(115200, false);
LEDs_Init();
USB_Init();
/* Create a stdio stream for the serial port for stdin and stdout */
Serial_CreateStream(NULL);
//USB_Init();
}
示例7: uart0_shutdown
void uart0_shutdown(void)
{
puts("");
UART_CFG_Type UARTConfigStruct;
PINSEL_CFG_Type PinCfg;
PinCfg.Portnum = UART0_PORTNUM;
PinCfg.Pinnum = UART0_TX_PINNUM;
PinCfg.Funcnum = 0;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = UART0_RX_PINNUM;
PINSEL_ConfigPin(&PinCfg);
GPIO_SetDir(UART0_PORTNUM, (1<<UART0_TX_PINNUM), 1);
GPIO_SetValue(UART0_PORTNUM, (1<<UART0_TX_PINNUM));
UART_TxCmd((LPC_UART_TypeDef *)CONSOLE_UART_PORT, DISABLE);
UART_IntConfig((LPC_UART_TypeDef *)CONSOLE_UART_PORT, UART_INTCFG_RBR, DISABLE);
NVIC_DisableIRQ(UART0_IRQn);
}
示例8: SMB380_Init
SMB380_Status_t SMB380_Init(void)
{
unsigned char Data[2];
//Init I2C module as master
PINSEL_ConfigPin (2, 14, 2);
PINSEL_ConfigPin (2, 15, 2);
I2C_Init(I2C_1, SMB380_SPEED);
I2C_Cmd(I2C_1,I2C_MASTER_MODE, ENABLE);
Data[0] = 0x14;
SMB380_ReadWrite(&Data[0], 1, NULL, 0);
SMB380_ReadWrite(NULL, 0, &Data[1], 1);
Data[1] &= ~(0x1F<<0);
Data[1] |= (0x08<<0);
//I2C_MasterWrite(SMB380_ADDR, &Data[0], 2);
SMB380_ReadWrite(&Data[0], 2, NULL, 0);
Data[0] = 0x15;
SMB380_ReadWrite(&Data[0], 1, NULL, 0);
SMB380_ReadWrite(NULL, 0, &Data[1], 1);
Data[1] &= ~(3<<1);
Data[1] |= ((1<<5) | (1<<0));
SMB380_ReadWrite(&Data[0], 2, NULL, 0);
return SMB380_PASS;
}
示例9: io_init_fpga_pwrenable
/* enable FPGA EN_CORE and EN_IO */
void io_init_fpga_pwrenable(void)
{
uint32_t i=0;
PinCfg.Funcnum = 0;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
// 1V5 core voltage
PinCfg.Pinnum = FPGA_CORE_EN_PIN;
PinCfg.Portnum = FPGA_CORE_EN_PORT;
PINSEL_ConfigPin(&PinCfg);
GPIO_SetDir(FPGA_CORE_EN_PORT, FPGA_CORE_EN, POUT);
fpga_pwr_enable_core_low();
// 3V3 IO voltage
PinCfg.Pinnum = FPGA_IO_EN_PIN;
PinCfg.Portnum = FPGA_IO_EN_PORT;
PINSEL_ConfigPin(&PinCfg);
GPIO_SetDir(FPGA_IO_EN_PORT, FPGA_IO_EN, POUT);
fpga_pwr_enable_io_low();
return;
}
示例10: TP_Init
/*******************************************************************************
* Function Name : TP_Init
* Description : TSC2046 Initialization
* Input : None
* Output : None
* Return : None
* Attention : None
*******************************************************************************/
void TP_Init(void)
{
SSP_CFG_Type SSP_ConfigStruct;
/*
* Initialize SPI pin connect
* P2.23 - TP_CS - used as GPIO
* P2.22 - SCK
* P2.26 - MISO
* P2.27 - MOSI
*/
PINSEL_ConfigPin(2, 23, 0);
PINSEL_ConfigPin(2, 22, 2);
PINSEL_ConfigPin(2, 26, 2);
PINSEL_ConfigPin(2, 27, 2);
/* P0.16 CS is output */
GPIO_SetDir(TP_CS_PORT_NUM, (1<<TP_CS_PIN_NUM), 1);
GPIO_SetValue(TP_CS_PORT_NUM, (1<<TP_CS_PIN_NUM));
PINSEL_ConfigPin(2, 11, 0);
GPIO_SetDir(2, (1<<11), 0); /* P2.11 TP_INT is input */
/* initialize SSP configuration structure to default */
SSP_ConfigStructInit(&SSP_ConfigStruct);
SSP_ConfigStruct.ClockRate = 250000;
SSP_ConfigStruct.CPHA = SSP_CPHA_FIRST; //SSP_CPHA_SECOND SSP_CPHA_FIRST
SSP_ConfigStruct.CPOL = SSP_CPOL_HI; //SSP_CPOL_LO SSP_CPOL_HI
/* Initialize SSP peripheral with parameter given in structure above */
SSP_Init(LPC_SSP0, &SSP_ConfigStruct);
/* Enable SSP peripheral */
SSP_Cmd(LPC_SSP0, ENABLE);
}
示例11: analogSensorsInit
void analogSensorsInit(void)
{
// pin configuration for AirSpeed Sensor
PINSEL_CFG_Type airPin_intStr;
// pin configuration for UltraSonic Distance Sensor
PINSEL_CFG_Type usonicPin_intStr;
//Setup Air Speed Sensor Pin
airPin_intStr.Funcnum = AIR_PIN_FUNC;
airPin_intStr.OpenDrain = PINSEL_PINMODE_NORMAL;
airPin_intStr.Pinmode = PINSEL_PINMODE_PULLUP;
airPin_intStr.Pinnum = AIR_PIN;
airPin_intStr.Portnum = AIR_PORT;
PINSEL_ConfigPin(&airPin_intStr);
//UltraSonic Sensor Pin
usonicPin_intStr.Funcnum = USON_PIN_FUNC;
usonicPin_intStr.OpenDrain = PINSEL_PINMODE_NORMAL;
usonicPin_intStr.Pinmode = PINSEL_PINMODE_PULLUP;
usonicPin_intStr.Pinnum = USON_PIN;
usonicPin_intStr.Portnum = USON_PORT;
PINSEL_ConfigPin(&usonicPin_intStr);
// set AD Conversion speed
ADC_Init(LPC_ADC, 200000);
// disable the interrupt
ADC_IntConfig (LPC_ADC, ADC_ADGINTEN, SET);
// enable the ADC channels
ADC_ChannelCmd(LPC_ADC, AIR_CHAN, ENABLE);
ADC_ChannelCmd(LPC_ADC, USON_CHAN, ENABLE);
}
示例12: ADC_init
Bool ADC_init()
{
PINSEL_CFG_Type PinCfg1;
PinCfg1.Funcnum = 1;
PinCfg1.OpenDrain = 0;
PinCfg1.Pinmode = 0;
PinCfg1.Pinnum = 25;
PinCfg1.Portnum = 0;
PINSEL_ConfigPin(&PinCfg1);
PINSEL_CFG_Type PinCfg2;
PinCfg2.Funcnum = 1;
PinCfg2.OpenDrain = 0;
PinCfg2.Pinmode = 0;
PinCfg2.Pinnum = 24;
PinCfg2.Portnum = 0;
PINSEL_ConfigPin(&PinCfg2);
PINSEL_CFG_Type PinCfg3;
PinCfg3.Funcnum = 1;
PinCfg3.OpenDrain = 0;
PinCfg3.Pinmode = 0;
PinCfg3.Pinnum = 23;
PinCfg3.Portnum = 0;
PINSEL_ConfigPin(&PinCfg3);
ADC_Init(LPC_ADC, 10000);
return TRUE;
}
示例13: Init_LCD_Pins
void Init_LCD_Pins(void)
{
// Configure other pins used by the ILI9341 LCD
// P0.2 = CS, P0.3 = Reset, P0.21 = DC
PINSEL_CFG_Type LCDPin;
LCDPin.Portnum = LCD_CS_PORT;
LCDPin.Pinnum = LCD_CS_PIN;
LCDPin.Funcnum = PINSEL_FUNC_0; // Use as GPIO
LCDPin.OpenDrain = PINSEL_PINMODE_NORMAL;
LCDPin.Pinmode = PINSEL_PINMODE_PULLUP;
PINSEL_ConfigPin(&LCDPin);
LCDPin.Portnum = LCD_RESET_PORT;
LCDPin.Pinnum = LCD_RESET_PIN;
PINSEL_ConfigPin(&LCDPin);
LCDPin.Portnum = LCD_DC_PORT;
LCDPin.Pinnum = LCD_DC_PIN;
PINSEL_ConfigPin(&LCDPin);
// Declare LCD pins as output, disable pin masking
GPIO_SetDir(LCD_CS_PORT, (1 << LCD_CS_PIN), GPIO_DIR_OUTPUT); // CS
GPIO_SetDir(LCD_RESET_PORT, (1 << LCD_RESET_PIN), GPIO_DIR_OUTPUT); // Reset
GPIO_SetDir(LCD_DC_PORT, (1 << LCD_DC_PIN), GPIO_DIR_OUTPUT); // DC
// Initialize CS to 1
LCD_CS(1);
}
示例14: spi_configure
void spi_configure (tPinDef SClk, tPinDef Mosi, tPinDef Miso, tPinDef SSel)
{
PINSEL_CFG_Type PinCfg;
/*
* Initialize SPI pin connect
*/
/* SSEL as GPIO, pull-up mounted */
PinCfg.Funcnum = PINSEL_FUNC_0;
PinCfg.OpenDrain = PINSEL_PINMODE_NORMAL;
PinCfg.Pinmode = PINSEL_PINMODE_PULLUP;
PinCfg.Portnum = SSel.port;
PinCfg.Pinnum = SSel.pin_number;
GPIO_SetDir(SSel.port, _BV(SSel.pin_number), 1);
PINSEL_ConfigPin(&PinCfg);
/* SCK alternate function 0b10 */
PinCfg.Funcnum = PINSEL_FUNC_2;
PinCfg.Pinmode = PINSEL_PINMODE_PULLDOWN;
PinCfg.Portnum = SClk.port;
PinCfg.Pinnum = SClk.pin_number;
PINSEL_ConfigPin(&PinCfg);
/* MISO */
PinCfg.Pinmode = PINSEL_PINMODE_PULLUP;
PinCfg.Portnum = Miso.port;
PinCfg.Pinnum = Miso.pin_number;
PINSEL_ConfigPin(&PinCfg);
/* MOSI */
PinCfg.Portnum = Mosi.port;
PinCfg.Pinnum = Mosi.pin_number;
PINSEL_ConfigPin(&PinCfg);
}
示例15: uart_init
void uart_init() {
UART_CFG_Type cfg;
UART_FIFO_CFG_Type fifo_cfg;
UART_ConfigStructInit(&cfg);
cfg.Baud_rate = 57600;
PINSEL_CFG_Type PinCfg;
PinCfg.Funcnum = 1;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PinCfg.Pinnum = 2;
PinCfg.Portnum = 0;
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 3;
PINSEL_ConfigPin(&PinCfg);
UART_Init(LPC_UART0, &cfg);
UART_FIFOConfigStructInit(&fifo_cfg);
UART_FIFOConfig(LPC_UART0, &fifo_cfg);
UART_TxCmd(LPC_UART0, ENABLE);
}