コード例 #1
0
ファイル: leds_daniel.c プロジェクト: GCagliero/danielgarcia
void inicia_led(void)
{

	Chip_GPIO_Init(LPC_GPIO_PORT);
	//led R
	Chip_SCU_PinMux(2, 0, MD_PLN, FUNC4);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 5 , 1 , 1);
	//led G
	Chip_SCU_PinMux(2, 1, MD_PLN, FUNC4);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 5 , 1<<1 , 1);
	//led B
	Chip_SCU_PinMux(2, 2, MD_PLN, FUNC4);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 5 , 1<<2 , 1);

	//led 1 Amarillo
	Chip_SCU_PinMux(2, 10, MD_PLN, FUNC0);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 0 , 1<<14 , 1);

	//led 2 Rojo
	Chip_SCU_PinMux(2, 11, MD_PLN, FUNC0);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 1 , 1<<11 , 1);

	//led 3 Verde
	Chip_SCU_PinMux(2, 12, MD_PLN, FUNC0);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 1 , 1<<12 , 1);//salida

	//Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 0 , 14);

	//Gpio 5, BIT "1" pin P2_1(es solo un Nombre que se le da a un PIn del uC) Pagina397


	//Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 5 , 1);

}
コード例 #2
0
ファイル: main.c プロジェクト: VtsBlack/Lpc11u67_Prototype
/**
 * [InitTask description]
 */
__task void InitTask(void)
{
	
	int msg_len = 0;
	int clockRate = Chip_Clock_GetMainClockRate();

	/* Enabled Clock To GPPIO */
	Chip_GPIO_Init(LPC_GPIO);
	// Set the pin direction, set high for an output LED2
	Chip_GPIO_SetPinDIR(LPC_GPIO, 0, 2, 1);
	/* Serial Driver Enable */
	SER_Init();

	msg_len = snprintf(message, sizeof(message), "Main clock is: %d\r\n", clockRate);
	Chip_UART0_SendRB(LPC_USART0, &txring, message, msg_len);
	
	for(;;)
	{
		os_dly_wait(50);

		Chip_UART0_SendRB(LPC_USART0, &txring, "Sveiki\r\n", strlen("Sveiki\r\n"));
		Chip_GPIO_WriteDirBit(LPC_GPIO, 0, 2, 0);

		os_dly_wait(100);
		Chip_GPIO_WriteDirBit(LPC_GPIO, 0, 2, 1);

	}
}
コード例 #3
0
void InicializarLEDS(){
	Chip_GPIO_Init(LPC_GPIO_PORT);
	//Mapeo los ledsa los GPIOX.X y habilito pullup
	Chip_SCU_PinMux(2,0,MD_PUP,FUNC4); //mapea 2.0 a GPIO5[0] (RGB, R)
	Chip_SCU_PinMux(2,1,MD_PUP,FUNC4); //mapea 2.0 a GPIO5[1] (RGB, G)
	Chip_SCU_PinMux(2,2,MD_PUP,FUNC4); //mapea 2.0 a GPIO5[2] (RGB, B)
	Chip_SCU_PinMux(2,10,MD_PUP,FUNC0); //mapea 2.0 a GPIO0[14] (LED Amarillo)
	Chip_SCU_PinMux(2,11,MD_PUP,FUNC0); //mapea 2.0 a GPIO1[11] (LED Rojo)
	Chip_SCU_PinMux(2,12,MD_PUP,FUNC0); //mapea 2.0 a GPIO1[12] (LED Verde)
	//Direcciono los GPIOX.X
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 5, (1<<0), 1); // !1 es SALIDA, LPC_GPIO_PORT
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 5, (1<<1), 1);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 5, (1<<2), 1);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 0, (1<<14), 1);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 1, (1<<11), 1);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 1, (1<<12), 1);
	//Pongo en bajo las salidas GPIOX.X
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 5, 0);
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 5, 1);
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 5, 2);
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 0, 14);
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 1, 11);
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 1, 12);

}
コード例 #4
0
void Board_LEDs_Init(void) {
    Chip_GPIO_Init(LPC_GPIO);
    Chip_GPIO_WriteDirBit(LPC_GPIO, LED0, true);
    Chip_GPIO_WriteDirBit(LPC_GPIO, LED1, true);
    Chip_GPIO_WriteDirBit(LPC_GPIO, LED2, true);
    Chip_GPIO_WriteDirBit(LPC_GPIO, LED3, true);
}
コード例 #5
0
ファイル: ciaaIO.c プロジェクト: cpantel/ciaa
void ciaaIOInit(void)
{
	Chip_GPIO_Init(LPC_GPIO_PORT);

   /* LEDs */
   Chip_SCU_PinMux(2,0,MD_PUP,FUNC4);  /* GPIO5[0], LED0R */
   Chip_SCU_PinMux(2,1,MD_PUP,FUNC4);  /* GPIO5[1], LED0G */
   Chip_SCU_PinMux(2,2,MD_PUP,FUNC4);  /* GPIO5[2], LED0B */
   Chip_SCU_PinMux(2,10,MD_PUP,FUNC0); /* GPIO0[14], LED1 */
   Chip_SCU_PinMux(2,11,MD_PUP,FUNC0); /* GPIO1[11], LED2 */
   Chip_SCU_PinMux(2,12,MD_PUP,FUNC0); /* GPIO1[12], LED3 */

   Chip_GPIO_SetDir(LPC_GPIO_PORT, 5,(1<<0)|(1<<1)|(1<<2),1);
   Chip_GPIO_SetDir(LPC_GPIO_PORT, 0,(1<<14),1);
   Chip_GPIO_SetDir(LPC_GPIO_PORT, 1,(1<<11)|(1<<12),1);

   Chip_GPIO_ClearValue(LPC_GPIO_PORT, 5,(1<<0)|(1<<1)|(1<<2));
   Chip_GPIO_ClearValue(LPC_GPIO_PORT, 0,(1<<14));
   Chip_GPIO_ClearValue(LPC_GPIO_PORT, 1,(1<<11)|(1<<12));

   /* Switches */
   Chip_SCU_PinMux(1,0,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* GPIO0[4], SW1 */
   Chip_SCU_PinMux(1,1,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* GPIO0[8], SW2 */
   Chip_SCU_PinMux(1,2,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* GPIO0[9], SW3 */
   Chip_SCU_PinMux(1,6,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* GPIO1[9], SW4 */

   Chip_GPIO_SetDir(LPC_GPIO_PORT, 0,(1<<4)|(1<<8)|(1<<9),0);
   Chip_GPIO_SetDir(LPC_GPIO_PORT, 1,(1<<9),0);
}
コード例 #6
0
ファイル: i2c.c プロジェクト: SNolasco86/PIDDEF46-12
/** \brief Main function
 *
 * This is the main entry point of the software.
 *
 * \returns 0
 *
 * \remarks This function never returns. Return value is only to avoid compiler
 *          warnings or errors.
 */
void InicializarLeds(void){

	/*Funcion inicializa GPIO */
	Chip_GPIO_Init(LPC_GPIO_PORT);

	/**Configurar la System Control Unit (SCU), para indicarle las
características eléctricas de cada pin empleado y remapearlos como puertos
GPIO**/
	 Chip_SCU_PinMux(2,0,MD_PUP,FUNC4); /* remapea P2_0 en GPIO5[0], LED0R y habilita el
	 pull up*/
	 Chip_SCU_PinMux(2,1,MD_PUP,FUNC4); /* remapea P2_1 en GPIO5[1], LED0G y habilita
	 el pull up */
	 Chip_SCU_PinMux(2,2,MD_PUP,FUNC4); /* remapea P2_2 en GPIO5[2], LED0B y habilita el
	 pull up */
	 Chip_SCU_PinMux(2,10,MD_PUP,FUNC0); /* remapea P2_10 en GPIO0[14], LED1 y habilita
	 el pull up */
	 Chip_SCU_PinMux(2,11,MD_PUP,FUNC0); /* remapea P2_11 en GPIO1[11], LED2 y habilita
	 el pull up */
	 Chip_SCU_PinMux(2,12,MD_PUP,FUNC0); /* remapea P2_12 en GPIO1[12], LED3 y habilita
	 el pull up */
	 /********************************************************************/
	 /*Seleccionar el modo (salida) de cada pin con la función "chip_GPIO_setDIr"*/
	 /*******************************************************************/

	 /*Defino salida LED_R (0),LED_G (1) y LED_B (2)*/
	 Chip_GPIO_SetDir(LPC_GPIO_PORT,5,(((1<<0)|(1<<1))|(1<<2)),1);
	 /*Defino salida LED1 (14)*/
	 Chip_GPIO_SetDir(LPC_GPIO_PORT,0,(1<<14),1);
	 /*Defino salida LED2 (11) y LED3(12)*/
	 Chip_GPIO_SetDir(LPC_GPIO_PORT,1,((1<<11)|(1<<12)),1);
	 /****************************************************/

}
コード例 #7
0
void AVALON_LED_Test(void)
{
    /* Initialize GPIO */
	Chip_GPIO_Init(LPC_GPIO);
	AVALON_LED_Init();

	/* open all led */
	AVALON_LED_Rgb(AVALON_LED_RED, true);
	AVALON_LED_Rgb(AVALON_LED_GREEN, true);
	AVALON_LED_Rgb(AVALON_LED_BLUE, true);
	AVALON_Delay(4000000);

	/* close all led */
	AVALON_LED_Rgb(AVALON_LED_RED, false);
	AVALON_LED_Rgb(AVALON_LED_GREEN, false);
	AVALON_LED_Rgb(AVALON_LED_BLUE, false);
	AVALON_Delay(4000000);

	/* red led test */
	AVALON_LED_Rgb(AVALON_LED_RED, true);
	AVALON_Delay(4000000);
	AVALON_LED_Rgb(AVALON_LED_RED, false);

	/* green led test */
	AVALON_LED_Rgb(AVALON_LED_GREEN, true);
	AVALON_Delay(4000000);
	AVALON_LED_Rgb(AVALON_LED_GREEN, false);

	/* blue led test */
	AVALON_LED_Rgb(AVALON_LED_BLUE, true);
	AVALON_Delay(4000000);
	AVALON_LED_Rgb(AVALON_LED_BLUE, false);

	AVALON_Delay(4000000);
}
コード例 #8
0
ファイル: led.c プロジェクト: GAldereteHero/CursoEduCIAA
void inicializarled()

{
	Chip_GPIO_Init(LPC_GPIO_PORT);


	Chip_SCU_PinMux(2,0,MD_PUP,FUNC4); /* remapea P2_0 en GPIO5[0], LED0R y habilita el pull up*/
	Chip_SCU_PinMux(2,1,MD_PUP,FUNC4); /* remapea P2_1 en GPIO5[1], LED0G y habilita el pull up */
	Chip_SCU_PinMux(2,2,MD_PUP,FUNC4); /* remapea P2_2 en GPIO5[2], LED0B y habilita el pull up */
	Chip_SCU_PinMux(2,10,MD_PUP,FUNC0); /* remapea P2_10 en GPIO0[14], LED1 y habilita el pull up */
	Chip_SCU_PinMux(2,11,MD_PUP,FUNC0); /* remapea P2_11 en GPIO1[11], LED2 y habilita el pull up */
	Chip_SCU_PinMux(2,12,MD_PUP,FUNC0); /* remapea P2_12 en GPIO1[12], LED3 y habilita el pull up */

	Chip_GPIO_SetDir(LPC_GPIO_PORT,5,(1<<0)|(1<<1)|(1<<2),1); // Defino ls puertos como salidas
	Chip_GPIO_SetDir(LPC_GPIO_PORT,0,(1<<14),1);
	Chip_GPIO_SetDir(LPC_GPIO_PORT,1,(1<<11)|(1<<12),1);


	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,5,0); // reseteo todos los leds
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,5,1); // reseteo todos los leds
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,5,2); // reseteo todos los leds
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,0,14); // reseteo todos los leds
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,1,11); // reseteo todos los leds
	Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,1,14); // reseteo todos los leds
}
コード例 #9
0
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{
	/* Sets up DEBUG UART */
	DEBUGINIT();

	/* Updates SystemCoreClock global var with current clock speed */
	SystemCoreClockUpdate();

	/* Initializes GPIO */
	Chip_GPIO_Init(LPC_GPIO_PORT);

	/* Setup GPIOs for USB demos */
	Chip_SCU_PinMuxSet(0x2, 6, (SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC4));			/* P2_6 USB1_PWR_EN, USB1 VBus function */
	Chip_SCU_PinMuxSet(0x2, 5, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC2));	/* P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION */
	Chip_SCU_PinMuxSet(0x1, 7, (SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC4));			/* P1_7 USB0_PWR_EN, USB0 VBus function Xplorer */
	Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 5, 6);							/* GPIO5[6] = USB1_PWR_EN */
	Chip_GPIO_SetPinState(LPC_GPIO_PORT, 5, 6, true);							/* GPIO5[6] output high */

	/* Initialize LEDs */
	Board_LED_Init();
#if defined(USE_RMII)
	Chip_ENET_RMIIEnable(LPC_ETHERNET);
#else
	Chip_ENET_MIIEnable(LPC_ETHERNET);
#endif
}
コード例 #10
0
ファイル: board.c プロジェクト: FEDEVEL/openrex-lpc
/* Initializes board Button(s) */
static void Board_BTN_Init(void)
{
    pinmux_t buttons[] = { ONBOARD_BTNS };
    Chip_GPIO_Init(LPC_GPIO_PORT);
    for (int i = 0; i < (sizeof(buttons)/sizeof(buttons[0])); i++)
    {
        Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, TO_PORT(buttons[i]), TO_PIN(buttons[i]));
    }
}
コード例 #11
0
ファイル: board.c プロジェクト: FEDEVEL/openrex-lpc
/* Initializes board LED(s) */
static void Board_LED_Init(void)
{
    pinmux_t leds[] = { ONBOARD_LEDS };
    Chip_GPIO_Init(LPC_GPIO_PORT);
    for (int i = 0; i < (sizeof(leds)/sizeof(leds[0])); i++)
    {
        Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, TO_PORT(leds[i]), TO_PIN(leds[i]));
    }
}
コード例 #12
0
ファイル: board.c プロジェクト: Strongc/Earphone-Code
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{

	Earphone_Init();
	/* Initialize GPIO */
	Chip_GPIO_Init(LPC_GPIO_PORT);

	
}
コード例 #13
0
ファイル: clkout.c プロジェクト: frankzzcn/M2_SE_RTOS_Project
/**
 * @brief	main routine for CLKOUT example
 * @return	Function should not exit.
 */
int main(void)
{
	CHIP_SYSCTL_CLKOUTSRC_T clkoutClks;

	SystemCoreClockUpdate();
	Board_Init();

	Board_LED_Set(0, false);

	/* Enable and setup SysTick Timer at a 100Hz rate */
	SysTick_Config(Chip_Clock_GetSysTickClockRate() / 100);

	/* Enable the power to the WDT */
	Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_WDTOSC_PD);
	/* Setup SCT PLL */
	Chip_SYSCTL_PowerDown(SYSCTL_POWERDOWN_SCTPLL_PD);
	Chip_Clock_SetSCTPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
	Chip_Clock_SetupSCTPLL(5, 2);
	Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_SCTPLL_PD);
	/* Wait for PLL to lock */
	while (!Chip_Clock_IsSCTPLLLocked()) {}
	/* Enable RTC Oscillator */
	Chip_Clock_EnableRTCOsc();

	/* Enable SWM clocking prior to switch matrix operations */
	Chip_SWM_Init();
	Chip_GPIO_Init(LPC_GPIO);

	/* Setup pin as CLKOUT */
	Chip_SWM_MovablePortPinAssign(SWM_CLK_OUT_O, CLKOUT_PORT, CLKOUT_PIN);

	/* Configure as a digital pin with no pullups/pulldowns */
	Chip_IOCON_PinMuxSet(LPC_IOCON, CLKOUT_PORT, CLKOUT_PIN,
						 (IOCON_MODE_INACT | IOCON_DIGMODE_EN));

	/* Cycle through all clock sources for the CLKOUT pin */
	while (1) {
		for (clkoutClks = SYSCTL_CLKOUTSRC_IRC;
			 clkoutClks <= SYSCTL_CLKOUTSRC_RTC32K; clkoutClks++) {

			/* Setup CLKOUT pin for specific clock with a divider of 1 */
			Chip_Clock_SetCLKOUTSource(clkoutClks, 1);

			/* Wait 5 seconds */
			ticks100 = 0;
			while (ticks100 < 500) {
				__WFI();
			}
		}
	}

	/* Disable CLKOUT pin by setting divider to 0 */
	Chip_Clock_SetCLKOUTSource(SYSCTL_CLKOUTSRC_MAINSYSCLK, 0);

	return 0;
}
コード例 #14
0
int main(void)
{
   /* perform the needed initialization here */


	volatile uint64_t i;


    Chip_GPIO_Init(LPC_GPIO_PORT);
    Chip_SCU_PinMux(2,0,MD_PUP,FUNC4);  /* remapea P2_0  en GPIO5[0], LED0R y habilita el pull up*/
    Chip_SCU_PinMux(2,1,MD_PUP,FUNC4);  /* remapea P2_1  en GPIO5[1], LED0G y habilita el pull up */
    Chip_SCU_PinMux(2,2,MD_PUP,FUNC4);  /* remapea P2_2  en GPIO5[2], LED0B y habilita el pull up */
    Chip_SCU_PinMux(2,10,MD_PUP,FUNC0); /* remapea P2_10 en GPIO0[14], LED1 y habilita el pull up */
    Chip_SCU_PinMux(2,11,MD_PUP,FUNC0); /* remapea P2_11 en GPIO1[11], LED2 y habilita el pull up */
    Chip_SCU_PinMux(2,12,MD_PUP,FUNC0); /* remapea P2_12 en GPIO1[12], LED3 y habilita el pull up */

    Chip_SCU_PinMux(1,0,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_0  en GPIO 0[4], SW1 */
    Chip_SCU_PinMux(1,1,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_1  en GPIO 0[8], SW2 */
    Chip_SCU_PinMux(1,2,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_2  en GPIO 0[9], SW3 */
    Chip_SCU_PinMux(1,6,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_6  en GPIO 1[9], SW4 */


    Chip_GPIO_SetDir(LPC_GPIO_PORT, 5,(1<<0)|(1<<1)|(1<<2),1);
    Chip_GPIO_SetDir(LPC_GPIO_PORT, 0,(1<<14),1);
    Chip_GPIO_SetDir(LPC_GPIO_PORT, 1,(1<<11)|(1<<12),1);

    Chip_GPIO_ClearValue(LPC_GPIO_PORT, 5,(1<<0)|(1<<1)|(1<<2));
    Chip_GPIO_ClearValue(LPC_GPIO_PORT, 0,(1<<14));
    Chip_GPIO_ClearValue(LPC_GPIO_PORT, 1,(1<<11)|(1<<12));



       while(1) {
            /* add your code here */
    	     Chip_GPIO_SetPortToggle(LPC_GPIO_PORT,0,1<<14);      //Puerto 5  bit 0 --> LED ROJO
             //Chip_GPIO_ClearValue(LPC_GPIO_PORT, 5, 1);





             //Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,5,0);      //Puerto 5  bit 0 --> LED ROJO
             for (i=0;i<3000000;i++){
               asm  ("nop");
               }
            // Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT, 5, 0);   //Puerto 5  bit 0 --> LED ROJO
             //for (i=0;i<3000000;i++){
             //  asm  ("nop");
             //  }
         }
         return 0;


}
コード例 #15
0
ファイル: board.c プロジェクト: jmeed/teamRocket
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{
	/* Sets up DEBUG UART */
	DEBUGINIT();

	/* Initialize GPIO */
	Chip_GPIO_Init(LPC_GPIO);

	/* Initialize LEDs */
	Board_LED_Init();
}
コード例 #16
0
ファイル: board.c プロジェクト: patriciobos/TpFinal
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{
	/* Sets up DEBUG UART */
	DEBUGINIT();

	/* Initializes GPIO */
	Chip_GPIO_Init(LPC_GPIO_PORT);

	/* Initialize LEDs */
	Board_LED_Init();
	Chip_ENET_RMIIEnable(LPC_ETHERNET);
}
コード例 #17
0
ファイル: main.c プロジェクト: entropia/kuechenlicht
static void gpio_init(void) {
	Chip_GPIO_Init(LPC_GPIO_PORT);

	// 0_4 -> Wake
	// 0_16 -> Misc

	Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);

	Chip_IOCON_PinSetMode(LPC_IOCON, IOCON_PIO4, PIN_MODE_PULLUP);

	Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 0, 4);
}
コード例 #18
0
/*****************************************************************************
** Function name:		GPIOInit
**
** Descriptions:		Initialize GPIO, install the
**						GPIO interrupt handler
**
** parameters:			None
** Returned value:		true or false, return false if the VIC table
**						is full and GPIO interrupt handler can be
**						installed.
**
*****************************************************************************/
void GPIOInit( void )
{
	/* Initialize GPIO */
	Chip_GPIO_Init(LPC_GPIO_PORT);

	// Enable GPIO Pin interrupt clock domain
	Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PINT);

	// Enable GPIO Group interrupt #0 clock domain
	//Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GROUP0INT);
	// Enable GPIO Group interrupt #1 clock domain
	//Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GROUP1INT);
}
コード例 #19
0
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{
	/* Initialize the system core clock variable */
	SystemCoreClockUpdate();

	/* Sets up DEBUG UART */
	DEBUGINIT();

	/* Initialize GPIO */
	Chip_GPIO_Init(LPC_GPIO_PORT);

	/* Initialize the LEDs */
	Board_LED_Init();
}
コード例 #20
0
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{
	/* Sets up DEBUG UART */
	DEBUGINIT();

	/* Updates SystemCoreClock global var with current clock speed */
	SystemCoreClockUpdate();

	/* Initializes GPIO */
	Chip_GPIO_Init(LPC_GPIO);
	Chip_IOCON_Init(LPC_IOCON);

	/* Initialize LEDs */
	Board_LED_Init();
}
コード例 #21
0
ファイル: board.c プロジェクト: pridolfi/workspace
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{
	/* INMUX and IOCON are used by many apps, enable both INMUX and IOCON clock bits here. */
	Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_INPUTMUX);
	Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_IOCON);

	/* Sets up DEBUG UART */
	DEBUGINIT();

	/* Initialize GPIO */
	Chip_GPIO_Init(LPC_GPIO);

	/* Initialize the LEDs. Be careful with below routine, once it's called some of the I/O will be set to output. */
	Board_LED_Init();
}
コード例 #22
0
void inicializarTeclas(void)
{
	/* inicializo*/
	Chip_GPIO_Init(LPC_GPIO_PORT);

	/* inicializo pulsadores */
	Chip_SCU_PinMux(1,0,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_0 en GPIO 0[4], SW1 */
	Chip_SCU_PinMux(1,1,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_1 en GPIO 0[8], SW2 */
	Chip_SCU_PinMux(1,2,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_2 en GPIO 0[9], SW3 */
	Chip_SCU_PinMux(1,6,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_6 en GPIO 1[9], SW4 */

	/* seteo los pulsadores como puerto de entrada  */
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 0, (1<<4)|(1<<9)|(1<<8), 0);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 1, (1<<9), 0);
}
コード例 #23
0
ファイル: main.c プロジェクト: ernesto-g/prog_up_entregas
/* Set up and initialize board hardware */
void boardInit(void) {

   /* Config Core */
   coreInit();

   /* Initializes GPIO */
   Chip_GPIO_Init(LPC_GPIO_PORT);

   /* Config EDU-CIAA-NXP Button Pins */
   boardButtonsInit();

   /* Config EDU-CIAA-NXP Led Pins */
   boardLedsInit();

}
コード例 #24
0
ファイル: TeclasDriver.c プロジェクト: eugenioorosco8/driver
void InicializarTeclas(void)
{
	Chip_GPIO_Init(LPC_GPIO_PORT);
	Chip_SCU_PinMux(1,0,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_0 en GPIO 0[4], SW1 */
	Chip_SCU_PinMux(1,1,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_1 en GPIO 0[8], SW2 */
	Chip_SCU_PinMux(1,2,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_2 en GPIO 0[9], SW3 */
	Chip_SCU_PinMux(1,6,MD_PUP|MD_EZI|MD_ZI,FUNC0); /* remapea P1_6 en GPIO 1[9], SW4 */

	Chip_GPIO_SetDir(LPC_GPIO_PORT, 0, (1 << 4), 0);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 0, (1 << 8), 0);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 0, (1 << 9), 0);
	Chip_GPIO_SetDir(LPC_GPIO_PORT, 1, (1 << 9), 0);


}
コード例 #25
0
ファイル: teclas.c プロジェクト: dslepikas/2016educiaa_fiuner
void InicializarTeclas(){
	/* inicializa el puerto GPIO */
	 Chip_GPIO_Init(LPC_GPIO_PORT);

	 /* Configura Multiplexor: Chip_SCU_PinMux (Puerto, Pin específico, Modo, Función del pin)*/
     Chip_SCU_PinMux(PUERTO_TECLA_1,PIN_TECLA_1,MD_PUP|MD_EZI|MD_ZI,FUNC0 );
     Chip_SCU_PinMux(PUERTO_TECLA_2,PIN_TECLA_2,MD_PUP|MD_EZI|MD_ZI,FUNC0);
     Chip_SCU_PinMux(PUERTO_TECLA_3,PIN_TECLA_3,MD_PUP|MD_EZI|MD_ZI,FUNC0);
     Chip_SCU_PinMux(PUERTO_TECLA_4,PIN_TECLA_4,MD_PUP|MD_EZI|MD_ZI,FUNC0);

     /* Setea puertos como Entrada: Chip_GPIO_SetDir (Puerto GPIO, GPIO específico, Bit de Tecla, Sentido)*/
	 Chip_GPIO_SetDir(LPC_GPIO_PORT,GPIO_TECLA_1,BIT_TECLA_1,ENTRADA);
	 Chip_GPIO_SetDir(LPC_GPIO_PORT,GPIO_TECLA_2,BIT_TECLA_2,ENTRADA);
	 Chip_GPIO_SetDir(LPC_GPIO_PORT,GPIO_TECLA_3,BIT_TECLA_3,ENTRADA);
	 Chip_GPIO_SetDir(LPC_GPIO_PORT,GPIO_TECLA_4,BIT_TECLA_4,ENTRADA);
}
コード例 #26
0
/*==================[internal functions definition]==========================*/
 void InicializarTecla(void)
 {
	 Chip_GPIO_Init(LPC_GPIO_PORT);
	 //Chip_SCU_PinMux(TECLA_PAQUETE,TEC1_PIN,MD_PUP,FUNC0);/*mapea P2 0 en GPIO5[0], LED0R y habilita el pull up	 */
	 //Chip_SCU_PinMux(TECLA_PAQUETE,TEC2_PIN,MD_PUP,FUNC0); /*mapea P2 1 en GPIO5[1], LED0G y habilita el pull up	 */
	 //Chip_SCU_PinMux(TECLA_PAQUETE,TEC3_PIN,MD_PUP,FUNC0); /* mapea P2 2 en GPIO5[2], LED0B y habilita el pull up	 */
	 //Chip_SCU_PinMux(TECLA_PAQUETE,TEC4_PIN,MD_PUP,FUNC0); /* remapea P2 10 en GPIO0[14], LED1 y habilita el pull up	 */

	 Chip_SCU_PinMux(TECLA_PAQUETE,TEC1_PIN,MD_PUP|MD_EZI|MD_ZI,FUNC0);/* mapea P1 0 en GPIO 0[4], SW1 */
	 Chip_SCU_PinMux(TECLA_PAQUETE,TEC2_PIN,MD_PUP|MD_EZI|MD_ZI,FUNC0);/* mapea P1 1 en GPIO 0[8], SW2 */
	 Chip_SCU_PinMux(TECLA_PAQUETE,TEC3_PIN,MD_PUP|MD_EZI|MD_ZI,FUNC0);/* mapea P1 2 en GPIO 0[9], SW3 */
	 Chip_SCU_PinMux(TECLA_PAQUETE,TEC4_PIN,MD_PUP|MD_EZI|MD_ZI,FUNC0);/* mapea P1 6 en GPIO 1[9], SW4 */

	 Chip_GPIO_SetDir(LPC_GPIO_PORT,  PORT_NUM_TEC12Y3, 1<<4|1<<8|1<<9, INPUT);/* bit*/
	 Chip_GPIO_SetDir(LPC_GPIO_PORT, PORT_NUM_TEC4,1<<9, INPUT);

 }
コード例 #27
0
ファイル: led.c プロジェクト: xsantinos/EDU-CIAA
/*Configuración de los pines/puertos*/
void InitGPIO_EDUCIAA_Leds(void)
{
	Chip_GPIO_Init(LPC_GPIO_PORT);
/*Mapeo de pines de los leds RGB:
 * El primer número corresponde al número de paquete de pines del micro.
 * El segundo número corresponde al pin dentro de ese paquete.
 * MD_PUP habilita el pull up de ese pin. Por lo tanto, se habilita para los tres.
 * FUNC4 establece la función del pin, que corresponde a GPIO para los tres.
 * De este modo, el mapeo resulta:
 * 		P2_0 (LED0R) en GPIO 5[0]
 * 		P2_1 (LED0G) en GPIO 5[1]
 * 		P2_2 (LED0B) en GPIO 5[2]*/
	Chip_SCU_PinMux( LED_RGB_R_PACK_NUMBER, LED_RGB_R_GPIO_PIN, MD_PUP, FUNC4);
    Chip_SCU_PinMux( LED_RGB_G_PACK_NUMBER, LED_RGB_G_GPIO_PIN, MD_PUP, FUNC4);
    Chip_SCU_PinMux( LED_RGB_B_PACK_NUMBER, LED_RGB_B_GPIO_PIN, MD_PUP, FUNC4);

/*Mapeo de pines de los leds 1, 2 y 3:
 * El primer número corresponde al número de paquete de pines del micro.
 * El segundo número corresponde al pin dentro de ese paquete.
 * MD_PUP habilita el pull up de ese pin. Por lo tanto, se habilita para los tres.
 * FUNC4 establece la función del pin, que corresponde a GPIO para los tres.
 * De este modo, el mapeo resulta:
 * 		P2_10 (LED1) en GPIO 0[14]
 * 		P2_11 (LED2) en GPIO 1[11]
 * 		P2_12 (LED3) en GPIO 1[12]*/
    Chip_SCU_PinMux( LED_1_PACK_NUMBER,LED_1_PACK_PIN, MD_PUP, FUNC0);
    Chip_SCU_PinMux( LED_2_PACK_NUMBER,LED_2_PACK_PIN, MD_PUP, FUNC0);
    Chip_SCU_PinMux( LED_3_PACK_NUMBER,LED_3_PACK_PIN, MD_PUP, FUNC0);

/* Configuración como salida para los leds RGB */
    Chip_GPIO_SetDir(LPC_GPIO_PORT, 5,(1<<0),1);
    Chip_GPIO_SetDir(LPC_GPIO_PORT, 5,(1<<2),1);
    Chip_GPIO_SetDir(LPC_GPIO_PORT, 5,(1<<1),1);



    /* Configuración como salida para el led LED1 */
    Chip_GPIO_SetDir(LPC_GPIO_PORT, LED_1_GPIO_NUMBER,(1<<14),1);
    /* Configuración como salida para los leds LED2 y LED3 */
    Chip_GPIO_SetDir(LPC_GPIO_PORT, 1,(1<<11)|(1<<12),1);

    /*Se apagan los leds.*/
    Chip_GPIO_ClearValue(LPC_GPIO_PORT, 5,(1<<0)|(1<<1)|(1<<2));
    Chip_GPIO_ClearValue(LPC_GPIO_PORT, 0,(1<<14));
    Chip_GPIO_ClearValue(LPC_GPIO_PORT, 1,(1<<11)|(1<<12));
}
コード例 #28
0
ファイル: board.c プロジェクト: ernesto-g/micropython
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{
	/* Sets up DEBUG UART */
	DEBUGINIT();

	/* Initializes GPIO */
	Chip_GPIO_Init(LPC_GPIO_PORT);
	Board_GPIOs_Init();

	/* Initialize LEDs */
	Board_LED_Init();

	/* Initialize uarts */
	Board_UART_Init(LPC_USART0); //RS 485
	Board_UART_Init(LPC_USART3); // rs232

	/* Initialize buttons */
	Board_Buttons_Init();

	/* Initialize DAC */
	Board_DAC_Init();

	/* Initialize Timers */
	Board_TIMER_Init();

	/* Initialize ADCs */
	Board_ADC_Init();

	/* Initialize Keyboard disabled */
	Board_KEYBOARD_disable();

	/* Initilize EEPROM */
	Board_EEPROM_init();

	/* Initialize SPI pins */
	Board_SSP_Init();

	/* Initialize RTC module */
	//Board_RTC_Init();

	/* Initialize I2C0 module */
	Board_I2C_Master_Init();

	Chip_ENET_RMIIEnable(LPC_ETHERNET);
}
コード例 #29
0
ファイル: board.c プロジェクト: Silmac/ModulAid
/* Set up and initialize all required blocks and functions related to the
   board hardware */
void Board_Init(void)
{
	QUICKJACK_IO_Init();
	
	/* Initialize GPIO */
	Chip_GPIO_Init(LPC_GPIO_PORT);

	/* Initialize the LEDs */
	Board_LED_Init();

	// init sensor switch
	SensorSwitch_Init();

	/* Configure GPIO pin as input pin */
	Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 0, 0);

	/* MCU Tx Pin initialize */
	Chip_IOCON_PinSetMode(LPC_IOCON, QUICKJACKTXPIN, PIN_MODE_INACTIVE);
	Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, QUICKJACKTXPINNUM);
	Chip_GPIO_SetPinState(LPC_GPIO_PORT, 0, QUICKJACKTXPINNUM, 1);	
	
	/* MCU Rx Pin initialize */
	Chip_IOCON_PinSetMode(LPC_IOCON, QUICKJACKRXPIN, PIN_MODE_INACTIVE);
	/* Configure analog comparator for Manchester Rx */
	Chip_SWM_FixedPinEnable(SWM_FIXED_ACMP_I1, 1);
	Chip_ACMP_Init(LPC_CMP);
	Chip_ACMP_SetPosVoltRef(LPC_CMP, ACMP_POSIN_ACMP_I1);
	Chip_ACMP_SetNegVoltRef(LPC_CMP, ACMP_NEGIN_VLO);
	Chip_ACMP_SetupVoltLadder(LPC_CMP, (15<<1), false);
	Chip_ACMP_EnableVoltLadder(LPC_CMP);
	Chip_ACMP_SetHysteresis(LPC_CMP, ACMP_HYS_10MV);
	Chip_ACMP_SetEdgeSelection(LPC_CMP, ACMP_EDGESEL_RISING);
	/* Uncomment below 2 lines to connect analog comparator output to P1_0 (not needed for normal operation) */
//	Chip_SWM_FixedPinEnable(SWM_FIXED_ACMP_I2, 0);
//	Chip_SWM_MovablePinAssign(SWM_ACMP_O_O, 1);
	
	Chip_ACMP_EdgeClear(LPC_CMP);
	NVIC_EnableIRQ(CMP_IRQn);
	
	/* Disable clocks to SWM and IOCON to save power */
	Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
	Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_IOCON);
}
コード例 #30
0
ファイル: board.c プロジェクト: FEDEVEL/openrex-lpc
void BOARD_assert(const char *file, const int line)
{
    /* NOTE: If LED 24 (the one next to power supply connector) blinks, 
     * it means that your application has some serious issues */

    /* IOCON and GPIO doesn't have to be enabled at this point */
    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
    Chip_GPIO_Init(LPC_GPIO_PORT);
    /* set mux and output direction */
    Chip_IOCON_PinMuxSet(LPC_IOCON, TO_PORT(ONBOARD_ASSERT_LED), TO_PIN(ONBOARD_ASSERT_LED), ONBOARDCFG_ASSERT_LED);
    Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, TO_PORT(ONBOARD_ASSERT_LED), TO_PIN(ONBOARD_ASSERT_LED));
    /* blink forever. the speed depends on core clock settings */
    for (volatile int i = 1; i; )
    {
        Board_LED_SetLevel(ONBOARD_ASSERT_LED, true);
        for (volatile int k = 500000; k; k--) __asm("nop");
        Board_LED_SetLevel(ONBOARD_ASSERT_LED, false);
        for (volatile int k = 500000; k; k--) __asm("nop");
    }
}