コード例 #1
0
/* Board UART Initialisation function */
void Board_UART_Init(LPC_USART_T *pUART)
{
	/* Enable the clock to the Switch Matrix */
	Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
	Chip_Clock_SetUARTClockDiv(1);	/* divided by 1 */
	if (pUART == LPC_USART0) {
		/*connect the U0_TXD_O and U0_RXD_I signals to port pins(P0.4, P0.0) */
		Chip_SWM_FixedPinEnable(ACMP_I1, DISABLE);
		Chip_SWM_MovablePinAssign(SWM_U0_TXD_O, PIO4);
		Chip_SWM_MovablePinAssign(SWM_U0_RXD_I, PIO0);
		/* Enable USART0 clock */
		Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_UART0);	// FIXME UART clocking and reset need to be part of CHIP driver
		/* Peripheral reset control to USART0, a "1" bring it out of reset. */
		Chip_SYSCTL_PeriphReset(RESET_USART0);
	}
	else if (pUART == LPC_USART1) {
		/*connect the U1_TXD_O and U1_RXD_I signals to port pins(P0.13, P0.14) */
		Chip_SWM_MovablePinAssign(SWM_U1_TXD_O, PIO13);
		Chip_SWM_MovablePinAssign(SWM_U1_RXD_I, PIO14);
		/* Enable USART1 clock */
		Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_UART1);	// FIXME UART clocking and reset need to be part of CHIP driver
		/* Peripheral reset control to USART1, a "1" bring it out of reset. */
		Chip_SYSCTL_PeriphReset(RESET_USART1);
	}
	else {
		/*connect the U2_TXD_O and U2_RXD_I signals to port pins(P0.13, P0.14) */
		Chip_SWM_MovablePinAssign(SWM_U2_TXD_O, PIO13);
		Chip_SWM_MovablePinAssign(SWM_U2_RXD_I, PIO14);
		/* Enable USART2 clock */
		Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_UART2);	// FIXME UART clocking and reset need to be part of CHIP driver
		/* Peripheral reset control to USART2, a "1" bring it out of reset. */
		Chip_SYSCTL_PeriphReset(RESET_USART2);
	}
}
コード例 #2
0
ファイル: pinmux.c プロジェクト: ValereVersnip/AE_VVD_MULTI
/**
 * Configure the pinmuxing for the MultiSensor board.
 *
 * only the special functions are set here, default the pins are gpio.
 */
void PINMUX_Init()
{
	/* Enable the clock to the Switch Matrix */
	Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);

	/* DISconnect the XTALIN and XTALOUT signals to port pins(P0.8, P0.9), as these will be used for gpio purposes */
	/* these are fixed location pins */
	Chip_SWM_FixedPinEnable(SWM_FIXED_XTALIN, false);
	Chip_SWM_FixedPinEnable(SWM_FIXED_XTALOUT, false);

	/* connect the fixed reset_n pin to P0.5 */
	Chip_SWM_EnableFixedPin(SWM_FIXED_RST);

	/* Connect the I2C_SDA0 and I2C_SCL0 signals to port pins(P0.10, P0.11) */
	/* these are fixed location pins */
	Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
	Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);

	/* Connect the ADC0 (P0.7) and ADC1 (P0.6) */
	/* these are fixed location pins */
	Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0);
	Chip_SWM_EnableFixedPin(SWM_FIXED_ADC1);

	/* Connect the USART0 TX & RX signals to port pins(P0.16, P0.26) */
	/* these are movable location pins */
	Chip_SWM_MovablePinAssign(SWM_U0_TXD_O, 16);
	Chip_SWM_MovablePinAssign(SWM_U0_RXD_I, 26);

	/* Connect the USART1 RX signal to port pins(P0.25) */
	/* these are movable location pins */
	Chip_SWM_MovablePinAssign(SWM_U1_RXD_I, 25);


	/* Connect the SCT OUTPUT 1,2,3 (PWM : RGB)  signal to port pin(P0.1, P0.9, P0.8) --> this is the RGB led*/
	/* these are movable location pins */
	Chip_SWM_MovablePinAssign(SWM_SCT_OUT1_O, 1);
	Chip_SWM_MovablePinAssign(SWM_SCT_OUT2_O, 9);
	Chip_SWM_MovablePinAssign(SWM_SCT_OUT3_O, 8);

	/* make sure to disable fixed pin functionality for HUMIDITY dht22 data pin */
	Chip_SWM_DisableFixedPin(SWM_FIXED_ADC10);
	//Chip_SWM_MovablePinAssign(SWM_SCT_IN1_I, 13);


	/* Disable the clock to the Switch Matrix to save power */
	Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
}
コード例 #3
0
/* Initialize pin muxing for SPI interface */
void Board_SPI_Init(LPC_SPI_T *pSPI)
{
	/* Enable the clock to the Switch Matrix */
	Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
	if (pSPI == LPC_SPI0) {
		/*
		 * Initialize SSP0 pins connect
		 * SCK0: PINASSIGN3[31:24] : Select P0.12
		 * MOSI: PINASSIGN4[7:0] : Select P0.14
		 * MISO0: PINASSIGN4[15:8]: Select P0.6
		 * SSEL0: PINASSIGN4[23:16] : Select P0.13
		 */
		Chip_SWM_FixedPinEnable(VDDCMP, DISABLE);
		Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, PIO12);
		Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, PIO14);
		Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, PIO6);
		Chip_SWM_MovablePinAssign(SWM_SPI0_SSEL_IO, PIO13);
		
	}
	else {
		/*
		 * Initialize SSP0 pins connect
		 * SCK1: PINASSIGN4[31:24]: Select P0.12
		 * MOSI1: PINASSIGN5[7:0]: Select P0.14
		 * MISO1: PINASSIGN5[15:8] : Select P0.6
		 * SSEL1: PINASSIGN5[23:16]: Select P0.13
		 */
		Chip_SWM_FixedPinEnable(VDDCMP, DISABLE);
		Chip_SWM_MovablePinAssign(SWM_SPI1_SCK_IO, PIO12);
		Chip_SWM_MovablePinAssign(SWM_SPI1_MOSI_IO, PIO14);
		Chip_SWM_MovablePinAssign(SWM_SPI1_MISO_IO, PIO6);
		Chip_SWM_MovablePinAssign(SWM_SPI1_SSEL_IO, PIO13);
	}
	/* Disable the clock to the Switch Matrix to save power */
	Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
}
コード例 #4
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);
}