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

C++ PINSEL_ConfigPin函数代码示例

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

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



在下文中一共展示了PINSEL_ConfigPin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:guoger,项目名称:2gen_dcdc_test_util,代码行数:35,代码来源:retrieve_eui64.c


示例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);
}
开发者ID:readermank,项目名称:kico_si5,代码行数:65,代码来源:can_test_bypass_mode.c


示例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);
}
开发者ID:kaiyisg,项目名称:martian-explorer-hope,代码行数:35,代码来源:main.c


示例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);
}
开发者ID:eyeye,项目名称:LPC1788_Demos,代码行数:35,代码来源:hal_usart_lpc1788.c


示例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);
}
开发者ID:RTSYork,项目名称:UltrasoundRobot,代码行数:27,代码来源:serial.c


示例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();
}
开发者ID:Martin-P,项目名称:lpc1768-control-bluetooth-dongle,代码行数:36,代码来源:BluetoothRobot.c


示例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);
}
开发者ID:nedos,项目名称:ddk-arm,代码行数:25,代码来源:uart.c


示例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;
}
开发者ID:MerryTT,项目名称:RTT,代码行数:30,代码来源:sensor_smb380.c


示例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;
}
开发者ID:Meddington,项目名称:deja-ddk-glitch,代码行数:26,代码来源:io.c


示例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);
}
开发者ID:orochigalois,项目名称:TestBox,代码行数:43,代码来源:TouchPanel.c


示例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);
}
开发者ID:huskyDrone,项目名称:huskyDrone,代码行数:32,代码来源:driverGenAdc.c


示例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;
}
开发者ID:lukkezeh,项目名称:hlow-quadcopter,代码行数:30,代码来源:ADC.c


示例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);
}
开发者ID:vpcola,项目名称:LPC1769_NYP,代码行数:26,代码来源:LCD.c


示例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);
 }
开发者ID:bobc,项目名称:R2C2_Firmware,代码行数:35,代码来源:spi.c


示例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);

}
开发者ID:walmis,项目名称:LPC17xx_DFUBoot,代码行数:28,代码来源:main.c


示例16: LED_Init

void LED_Init (void)
{
	PINSEL_CFG_Type PinCfg;

	uint8_t temp;

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 2;
	for (temp = 2; temp <= 6; temp++){
		PinCfg.Pinnum = temp;
		PINSEL_ConfigPin(&PinCfg);
	}

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 1;
	PinCfg.Pinnum = 28;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 29;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 31;
	PINSEL_ConfigPin(&PinCfg);

	// Set direction to output
	GPIO_SetDir(2, LED2_MASK, 1);
	GPIO_SetDir(1, LED1_MASK, 1);

	/* Turn off all LEDs */
	GPIO_ClearValue(2, LED2_MASK);
	GPIO_ClearValue(1, LED1_MASK);
}
开发者ID:Frehner1,项目名称:CMSIS_LPC17xx,代码行数:34,代码来源:main.c


示例17: LED_Init

void LED_Init (void)
{
	PINSEL_CFG_Type PinCfg;

	uint8_t temp;

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 2;
	for (temp = 2; temp <= 6; temp++){
		PinCfg.Pinnum = temp;
		PINSEL_ConfigPin(&PinCfg);
	}

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 1;
	PinCfg.Pinnum = 28;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 29;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 31;
	PINSEL_ConfigPin(&PinCfg);


	// Set direction to output
	LPC_GPIO2->FIODIR |= LED2_MASK;
	LPC_GPIO1->FIODIR |= LED1_MASK;

	/* Turn off all LEDs */
	LPC_GPIO2->FIOCLR = LED2_MASK;
	LPC_GPIO1->FIOCLR = LED1_MASK;
}
开发者ID:Lzyuan,项目名称:STE-LPC1768-,代码行数:35,代码来源:timer_delay_test.c


示例18: uart2_init

void uart2_init(const uint32_t BaudRate, const bool DoubleSpeed)
{
    UART_CFG_Type UARTConfigStruct;
    PINSEL_CFG_Type PinCfg;

    PinCfg.Portnum = UART2_PORTNUM;
    PinCfg.Pinnum = UART2_TX_PINNUM;
    PinCfg.Funcnum = UART2_FUNCNUM;
    PinCfg.OpenDrain = 0;
    PinCfg.Pinmode = 0;
    PINSEL_ConfigPin(&PinCfg);
    PinCfg.Pinnum = UART2_RX_PINNUM;
    PINSEL_ConfigPin(&PinCfg);

    /* Initialize UART Configuration parameter structure to default state:
     * Baudrate = 9600bps
     * 8 data bit
     * 1 Stop bit
     * None parity
     */
    UART_ConfigStructInit(&UARTConfigStruct);
    // Re-configure baudrate
    UARTConfigStruct.Baud_rate = BaudRate;

    // Initialize DEBUG_UART_PORT peripheral with given to corresponding parameter
    UART_Init((LPC_UART_TypeDef *)FPGA_UART_PORT, &UARTConfigStruct);

    // Enable UART Transmit
    UART_TxCmd((LPC_UART_TypeDef *)FPGA_UART_PORT, ENABLE);

    UART_IntConfig((LPC_UART_TypeDef *)FPGA_UART_PORT, UART_INTCFG_RBR, ENABLE);
    NVIC_EnableIRQ(UART2_IRQn);
}
开发者ID:nedos,项目名称:ddk-arm,代码行数:33,代码来源:uart.c


示例19: sio_init

void sio_init(void)
{
	//LPC_USART_3
	PINSEL_CFG_Type PinSelCfg;
	UART_CFG_Type UartCFG_Struct;
	UART_FIFO_CFG_Type UART_FIFO_CFG_Struct;


	// P4_28
	PinSelCfg.Portnum = PINSEL_PORT_4;
	PinSelCfg.Pinnum = PINSEL_PIN_28;
	PinSelCfg.Funcnum = PINSEL_FUNC_3;
	PinSelCfg.OpenDrain = PINSEL_PINMODE_NORMAL;
	PinSelCfg.Pinmode = PINSEL_PINMODE_PULLUP;
	PINSEL_ConfigPin(&PinSelCfg);
	// P4_29
	PinSelCfg.Pinnum = PINSEL_PIN_29;
	PINSEL_ConfigPin(&PinSelCfg);

	uartDataToSend.currPtr = 0;
	uartDataToSend.lastPtr = 0;
	/* Initialize UART Configuration parameter structure to default state:
	 * Baudrate = 9600bps
	 * 8 data bit
	 * 1 Stop bit
	 * None parity
	*/
	UART_ConfigStructInit(&UartCFG_Struct);

	/* Set Baudrate to 115200 */
	UartCFG_Struct.Baud_rate = 115200;

	/* Initialize UART3 peripheral with given to corresponding parameter */
	UART_Init(SERIAL_USART, &UartCFG_Struct);

	/* Initialize FIFOConfigStruct to default state:
	 * 				- FIFO_DMAMode = DISABLE
	 * 				- FIFO_Level = UART_FIFO_TRGLEV0
	 * 				- FIFO_ResetRxBuf = ENABLE
	 * 				- FIFO_ResetTxBuf = ENABLE
	 * 				- FIFO_State = ENABLE
	 */
	UART_FIFOConfigStructInit(&UART_FIFO_CFG_Struct);

	/* Initialize FIFO for UART3 peripheral */
	UART_FIFOConfig(SERIAL_USART, &UART_FIFO_CFG_Struct);

	/*  Enable UART Transmit */
	UART_TxCmd(SERIAL_USART, ENABLE);

	UART_IntConfig(SERIAL_USART, UART_INTCFG_THRE, ENABLE);

	NVIC_SetPriorityGrouping(UART3_PriorGrup);
	NVIC_SetPriority(UART3_IRQn, UART3_Prior);

	NVIC_EnableIRQ(UART3_IRQn);


}
开发者ID:lnls-dig,项目名称:bpm-ipmi,代码行数:59,代码来源:sio_usart.c


示例20: c_entry

/*********************************************************************//**
 * @brief		c_entry: Main program body
 * @param[in]	None
 * @return 		int
 **********************************************************************/
int c_entry (void)
{
	PINSEL_CFG_Type PinCfg;
	TIM_TIMERCFG_Type TIM_ConfigStruct;
	TIM_MATCHCFG_Type TIM_MatchConfigStruct;

	// Conifg P1.28 as MAT0.0
	PinCfg.Funcnum = 3;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 1;
	PinCfg.Pinnum = 28;
	PINSEL_ConfigPin(&PinCfg);

	/* P3.26 as STCLK */
	PinCfg.Funcnum = 1;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 3;
	PinCfg.Pinnum = 26;
	PINSEL_ConfigPin(&PinCfg);

	// Initialize timer 0, prescale count time of 10uS
	TIM_ConfigStruct.PrescaleOption = TIM_PRESCALE_USVAL;
	TIM_ConfigStruct.PrescaleValue	= 10;

	// use channel 0, MR0
	TIM_MatchConfigStruct.MatchChannel = 0;
	// Disable interrupt when MR0 matches the value in TC register
	TIM_MatchConfigStruct.IntOnMatch   = TRUE;
	//Enable reset on MR0: TIMER will reset if MR0 matches it
	TIM_MatchConfigStruct.ResetOnMatch = TRUE;
	//Stop on MR0 if MR0 matches it
	TIM_MatchConfigStruct.StopOnMatch  = FALSE;
	//Toggle MR0.0 pin if MR0 matches it
	TIM_MatchConfigStruct.ExtMatchOutputType =TIM_EXTMATCH_TOGGLE;
	// Set Match value, count value of 10 (10 * 10uS = 100uS --> 10KHz)
	TIM_MatchConfigStruct.MatchValue   = 10;

	TIM_Init(LPC_TIM0, TIM_TIMER_MODE,&TIM_ConfigStruct);
	TIM_ConfigMatch(LPC_TIM0,&TIM_MatchConfigStruct);
	TIM_Cmd(LPC_TIM0,ENABLE);

	GPIO_SetDir(0, (1<<0), 1); //Set P0.0 as output

	//Use P0.0 to test System Tick interrupt
	/* Initialize System Tick with 10ms time interval
	 * Frequency input = 10kHz /2 = 5kHz
	 * Time input = 10ms
	 */
	SYSTICK_ExternalInit(5000, 10);
	//Enable System Tick interrupt
	SYSTICK_IntCmd(ENABLE);
	//Enable System Tick Counter
	SYSTICK_Cmd(ENABLE);

	while(1);
	return 1;
}
开发者ID:readermank,项目名称:kico_si5,代码行数:64,代码来源:systick_stclk.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PIN_AddFiniFunction函数代码示例发布时间:2022-05-30
下一篇:
C++ PINFO函数代码示例发布时间: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