void app_setup_pin(void)
{
/* Enable SWM clock before altering SWM */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 4, false);//Push botton SW1. <== should use this or not?
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 12, true);//led //12=Red, 16=Green, 27=Blue
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 16, true);//led //12=Red, 16=Green, 27=Blue
Chip_GPIO_SetPinDIR(LPC_GPIO_PORT, 0, 27, true);//led //12=Red, 16=Green, 27=Blue
/* Connect SCT input 0 to SCT_IN0 */
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC11);//PIO_04 disable
Chip_SWM_MovablePinAssign(SWM_SCT_IN0_I, 4);//=SW1, Note its IN0
/* Connect SCT output 0,1,2 to LED pin PIO_12,16,27 respectively */
Chip_SWM_MovablePinAssign(SWM_SCT_OUT0_O, 12);//12=Red, 16=Green, 27=Blue
Chip_SWM_MovablePinAssign(SWM_SCT_OUT1_O, 16);//12=Red, 16=Green, 27=Blue
Chip_SWM_MovablePinAssign(SWM_SCT_OUT2_O, 27);//12=Red, 16=Green, 27=Blue
/* Connect the INMUX
Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_0, SCT_INP_IN1 );// all other, SCT_INP_IN0, 2, 3 do not work!!!
/* Example is using Input pin 0, INMUX_0, so why does the following not work: */
// Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_0, SCT_INP_IN0 ); //BAD
}
|