本文整理汇总了C++中scu_pinmux函数的典型用法代码示例。如果您正苦于以下问题:C++ scu_pinmux函数的具体用法?C++ scu_pinmux怎么用?C++ scu_pinmux使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scu_pinmux函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: board_init
void board_init(void)
{
SystemInit();
CGU_Init();
SysTick_Config( CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/CFG_TICKS_PER_SECOND ); /* 1 ms Timer */
//------------- USB Bus power HOST ONLY-------------//
scu_pinmux(0x1, 7, MD_PUP | MD_EZI, FUNC4); // P1_7 USB0_PWR_EN, USB0 VBus function Xplorer
scu_pinmux(0x2, 6, MD_PUP | MD_EZI, FUNC4); // P2_6 is configured as GPIO5[6] for USB1_PWR_EN
GPIO_SetDir (5, BIT_(6), 1); // GPIO5[6] is output
GPIO_SetValue (5, BIT_(6)); // GPIO5[6] output high
// Leds Init
for (uint8_t i=0; i<BOARD_MAX_LEDS; i++)
{
scu_pinmux(leds[i].port, leds[i].pin, MD_PUP|MD_EZI|MD_ZI, FUNC0);
GPIO_SetDir(leds[i].port, BIT_(leds[i].pin), 1); // output
}
#if CFG_UART_ENABLE
//------------- UART init -------------//
UART_CFG_Type UARTConfigStruct;
scu_pinmux(0x6 ,4, MD_PDN|MD_EZI, FUNC2); // UART0_TXD
scu_pinmux(0x6 ,5, MD_PDN|MD_EZI, FUNC2); // UART0_RXD
UART_ConfigStructInit(&UARTConfigStruct); // default: baud = 9600, 8 bit data, 1 stop bit, no parity
UARTConfigStruct.Baud_rate = CFG_UART_BAUDRATE; // Re-configure baudrate
UART_Init((LPC_USARTn_Type*) LPC_USART0, &UARTConfigStruct); // Initialize UART port
UART_TxCmd((LPC_USARTn_Type*) LPC_USART0, ENABLE); // Enable UART
#endif
}
示例2: gpio_init
void gpio_init(void) {
/* Enable clock and init GPIO outputs */
LPC_CCU1->CLK_M4_GPIO_CFG = CCU_CLK_CFG_AUTO | CCU_CLK_CFG_RUN;
while (!(LPC_CCU1->CLK_M4_GPIO_STAT & CCU_CLK_STAT_RUN));
/* Configure I/O pins: function number, input buffer enabled, */
/* no pull-up/down */
scu_pinmux(1, 1, GPIO_NOPULL, FUNC0); /* LED: GPIO0[8] */
#ifdef BOARD_LPC4337
scu_pinmux(2, 11, GPIO_NOPULL, FUNC0); /* ISPCTRL: GPIO1[11] */
#else
scu_pinmux(2, 3, GPIO_NOPULL, FUNC4); /* ISPCTRL: GPIO5[3] */
#endif
scu_pinmux(2, 5, GPIO_PUP, FUNC4); /* nRESET: GPIO5[5] */
scu_pinmux(2, 6, GPIO_NOPULL, FUNC4); /* nRESET_OE: GPIO5[6] */
/* Configure: LED as output (turned off) */
LPC_GPIO_PORT->CLR[LED_CONNECTED_PORT] = (1 << LED_CONNECTED_BIT);
LPC_GPIO_PORT->DIR[LED_CONNECTED_PORT] |= (1 << LED_CONNECTED_BIT);
/* Configure: ISPCTRL as output and high */
LPC_GPIO_PORT->SET[ISPCTRL_PORT] = (1 << ISPCTRL_BIT);
LPC_GPIO_PORT->DIR[ISPCTRL_PORT] |= (1 << ISPCTRL_BIT);
/* configure Reset Button as input, Reset Output Enable as output LOW */
LPC_GPIO_PORT->DIR[PORT_nRESET] &= ~(1 << PIN_nRESET_IN_BIT);
LPC_GPIO_PORT->CLR[PORT_RESET_TXE] = (1 << PIN_RESET_TXE_IN_BIT);
LPC_GPIO_PORT->DIR[PORT_RESET_TXE] |= (1 << PIN_RESET_TXE_IN_BIT);
/* Use Pin Interrupt 0 */
LPC_SCU->PINTSEL0 &= ~0xff;
LPC_SCU->PINTSEL0 |= (PORT_nRESET << 5) | (PIN_nRESET_IN_BIT);
}
示例3: ads7843_init
void ads7843_init(void)
{
SSP_CFG_Type SSP_ConfigStruct;
CONFIG_TS_PENIRQ;
scu_pinmux(0x3,3,MD_PLN_FAST,FUNC2); // P3.3 connected to SCL/SCLK func2=SSP0 SCK0
// scu_pinmux(0x9,0,MD_PLN_FAST,FUNC7); // P9.0 connected to nCS func2=SSP0 SSEL0
scu_pinmux(0x9,0,MD_PLN_FAST | MD_EZI,FUNC0);
GPIO_SetDir(4,1<<12,1);
scu_pinmux(0x3,6,MD_PLN_FAST | MD_EZI,FUNC5); // P3.6 connected to SO func2=SSP0 MISO0
GPIO_SetDir(0,1<<6,0);
scu_pinmux(0x3,7,MD_PLN_FAST ,FUNC5); // P3.7 connected to nSI func2=SSP0 MOSI0
// initialize SSP configuration structure to default
SSP_ConfigStructInit(&SSP_ConfigStruct);
SSP_ConfigStruct.ClockRate = 100000;
SSP_ConfigStruct.Databit = SSP_DATABIT_8;
// Initialize SSP peripheral with parameter given in structure above
SSP_Init(LPC_SSP0, &SSP_ConfigStruct);
// Enable SSP peripheral
SSP_Cmd(LPC_SSP0, ENABLE);
}
示例4: Serial_Init
void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed)
{
UART_CFG_Type UARTConfigStruct;
/*
* Initialize UART1 pin connect
*/
#if (BOARD == BOARD_XPLORER)
scu_pinmux(0x1 ,13 , MD_PDN, FUNC1); // UART1_TXD
scu_pinmux(0x1 ,14 , MD_PLN|MD_EZI|MD_ZI, FUNC1); // UART1_RXD
#else
scu_pinmux(0x4 ,1 , MD_PDN|MD_EZI, FUNC6); // UART3_TXD
scu_pinmux(0x4 ,2 , MD_PDN|MD_EZI, FUNC6); // UART3_RXD
#endif
/* Initialize UART Configuration parameter structure to default state:
* Baudrate = 9600bps
* 8 data bit
* 1 Stop bit
* None parity
*/
UART_ConfigStructInit(&UARTConfigStruct);
UARTConfigStruct.Baud_rate = BaudRate; // Re-configure baudrate
// Initialize DEBUG_UART_PORT peripheral with given to corresponding parameter
UART_Init(DEBUG_UART_PORT, &UARTConfigStruct);
// Enable UART Transmit
UART_TxCmd(DEBUG_UART_PORT, ENABLE);
}
示例5: Serial_Init
void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed)
{
UART_CFG_Type UARTConfigStruct;
/*
* Initialize UART pin connect
*/
// scu_pinmux(0x2 ,0 , MD_PDN, FUNC1); // UART0_TXD
// scu_pinmux(0x2 ,1 , MD_PLN|MD_EZI|MD_ZI, FUNC1); // UART0_RXD
scu_pinmux(0x2 ,3 , MD_PDN, FUNC2); // UART3_TXD
scu_pinmux(0x2 ,4 , MD_PLN|MD_EZI|MD_ZI, FUNC2); // UART3_RXD
/* Initialize UART Configuration parameter structure to default state:
* Baudrate = 9600bps
* 8 data bit
* 1 Stop bit
* None parity
*/
UART_ConfigStructInit(&UARTConfigStruct);
UARTConfigStruct.Baud_rate = BaudRate; // Re-configure baudrate
// Initialize uart peripheral with given to corresponding parameter
UART_Init(DEBUG_UART_PORT, &UARTConfigStruct);
// Enable UART Transmit
UART_TxCmd(DEBUG_UART_PORT, ENABLE);
}
示例6: pin_setup
void pin_setup(void)
{
int i;
#ifdef AIRSPY_NOS
#else /* AIRSPY One/Demo */
uint8_t serial_clock_rate;
uint8_t clock_prescale_rate;
#endif
/* Configure all GPIO as Input (safe state) */
GPIO0_DIR = 0;
GPIO1_DIR = 0;
GPIO2_DIR = 0;
GPIO3_DIR = 0;
GPIO4_DIR = 0;
GPIO5_DIR = 0;
GPIO6_DIR = 0;
GPIO7_DIR = 0;
/* Pin configuration for all pins */
for(i = 0; i < GPIO_CONF_NB; i++)
{
scu_pinmux(gpio_conf[i].group_pin, gpio_conf[i].scu_conf);
}
/* GPIO1[7] on P1_14 as output. */
GPIO1_DIR |= PIN_EN_R820T;
disable_r820t_power();
/* GPIO1[13] on P2_13 as output. */
GPIO1_DIR |= PIN_EN_BIAST;
disable_biast_power();
#ifdef AIRSPY_NOS
/* GPIO0[12] on P1_17 as output. */
GPIO0_DIR |= PIN_EN_LED1;
#else /* AIRSPY One/Demo */
/* Configure SSP1 Peripheral */
#define SCU_SSP1_SCK (P1_19) /* P1_19 */
scu_pinmux(SCU_SSP1_SCK, (SCU_SSP_IO | SCU_CONF_FUNCTION1));
/* Freq About 1.12MHz => Freq = PCLK / (CPSDVSR * [SCR+1]) with PCLK=PLL1=288MHz */
clock_prescale_rate = 2;
serial_clock_rate = 128;
ssp_init(SSP1_NUM,
SSP_DATA_8BITS,
SSP_FRAME_SPI,
SSP_CPOL_0_CPHA_0,
serial_clock_rate,
clock_prescale_rate,
SSP_MODE_NORMAL,
SSP_MASTER,
SSP_SLAVE_OUT_ENABLE);
#endif
led_off();
}
示例7: cpld_jtag_release
/* set pins as inputs so we don't interfere with an external JTAG device */
void cpld_jtag_release(jtag_t* const jtag) {
scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4);
scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
gpio_input(jtag->gpio->gpio_tdo);
gpio_input(jtag->gpio->gpio_tck);
gpio_input(jtag->gpio->gpio_tms);
gpio_input(jtag->gpio->gpio_tdi);
}
示例8: cpld_jtag_release
/* set pins as inputs so we don't interfere with an external JTAG device */
void cpld_jtag_release(void) {
scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4);
scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
GPIO_DIR(PORT_CPLD_TDO) &= ~PIN_CPLD_TDO;
GPIO_DIR(PORT_CPLD_TCK) &= ~PIN_CPLD_TCK;
GPIO_DIR(PORT_CPLD_TMS) &= ~PIN_CPLD_TMS;
GPIO_DIR(PORT_CPLD_TDI) &= ~PIN_CPLD_TDI;
}
示例9: cpld_jtag_setup
void cpld_jtag_setup(void) {
scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4);
scu_pinmux(SCU_PINMUX_CPLD_TCK, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
/* TDO is an input */
GPIO_DIR(PORT_CPLD_TDO) &= ~PIN_CPLD_TDO;
/* the rest are outputs */
GPIO_DIR(PORT_CPLD_TCK) |= PIN_CPLD_TCK;
GPIO_DIR(PORT_CPLD_TMS) |= PIN_CPLD_TMS;
GPIO_DIR(PORT_CPLD_TDI) |= PIN_CPLD_TDI;
}
示例10: ssp1_init
void ssp1_init(void)
{
gpio_clear(PORT_SOURCE_CE, PIN_SOURCE_CE);
gpio_set(PORT_SOURCE_LE, PIN_SOURCE_LE);
gpio_clear(PORT_LO_CE, PIN_LO_LE);
gpio_set(PORT_LO_LE, PIN_LO_LE);
gpio_clear(PORT_ATT_LE, PIN_ATT_LE);
/* Configure SSP1 Peripheral (to be moved later in SSP driver) */
scu_pinmux(SCU_SSP1_MISO, (SCU_SSP_IO | SCU_CONF_FUNCTION5));
scu_pinmux(SCU_SSP1_MOSI, (SCU_SSP_IO | SCU_CONF_FUNCTION5));
scu_pinmux(SCU_SSP1_SCK, (SCU_SSP_IO | SCU_CONF_FUNCTION1));
ssp1_set_mode_16bit();
}
示例11: gpio_setup
static void gpio_setup(void)
{
/* Configure SCU Pin Mux as GPIO */
scu_pinmux(SCU_PINMUX_LED1, SCU_GPIO_FAST);
scu_pinmux(SCU_PINMUX_LED2, SCU_GPIO_FAST);
scu_pinmux(SCU_PINMUX_LED3, SCU_GPIO_FAST);
scu_pinmux(SCU_PINMUX_EN1V8, SCU_GPIO_FAST);
scu_pinmux(SCU_PINMUX_BOOT0, SCU_GPIO_FAST);
scu_pinmux(SCU_PINMUX_BOOT1, SCU_GPIO_FAST);
scu_pinmux(SCU_PINMUX_BOOT2, SCU_GPIO_FAST);
scu_pinmux(SCU_PINMUX_BOOT3, SCU_GPIO_FAST);
/* Configure all GPIO as Input (safe state) */
GPIO0_DIR = 0;
GPIO1_DIR = 0;
GPIO2_DIR = 0;
GPIO3_DIR = 0;
GPIO4_DIR = 0;
GPIO5_DIR = 0;
GPIO6_DIR = 0;
GPIO7_DIR = 0;
/* Configure GPIO as Output */
GPIO2_DIR |= (PIN_LED1|PIN_LED2|PIN_LED3); /* Configure GPIO2[1/2/8] (P4_1/2 P6_12) as output. */
GPIO3_DIR |= PIN_EN1V8; /* GPIO3[6] on P6_10 as output. */
}
示例12: Joystick_Init
void Joystick_Init(void)
{
scu_pinmux(0xC ,9 , MD_PUP|MD_EZI|MD_ZI, FUNC4); // PC_9 as GPIO6[8]
scu_pinmux(0xC ,11, MD_PUP|MD_EZI|MD_ZI, FUNC4); // PC_11 as GPIO6[10]
scu_pinmux(0xC ,12, MD_PUP|MD_EZI|MD_ZI, FUNC4); // PC_12 as GPIO6[11]
scu_pinmux(0xC ,13, MD_PUP|MD_EZI|MD_ZI, FUNC4); // PC_13 as GPIO6[12]
scu_pinmux(0xC ,14, MD_PUP|MD_EZI|MD_ZI, FUNC4); // PC_14 as GPIO6[13]
GPIO_SetDir(JOYSTICK_UP_GPIO_PORT_NUM,(1<<JOYSTICK_UP_GPIO_BIT_NUM),0); // input
GPIO_SetDir(JOYSTICK_DOWN_GPIO_PORT_NUM,(1<<JOYSTICK_DOWN_GPIO_BIT_NUM),0); // input
GPIO_SetDir(JOYSTICK_LEFT_GPIO_PORT_NUM,(1<<JOYSTICK_LEFT_GPIO_BIT_NUM),0); // input
GPIO_SetDir(JOYSTICK_RIGHT_GPIO_PORT_NUM,(1<<JOYSTICK_RIGHT_GPIO_BIT_NUM),0); // input
GPIO_SetDir(JOYSTICK_PRESS_GPIO_PORT_NUM,(1<<JOYSTICK_PRESS_GPIO_BIT_NUM),0); // input
}
示例13: mcp_init
void mcp_init(void) {
/* P6_5(GPIO3[4]) = MCP_CS
* P6_9(GPIO3[5]) = MCP_UD */
/* Configure the pinmux */
scu_pinmux(SCU_MCP_CS, SCU_GPIO_NOPULL);
scu_pinmux(SCU_MCP_UD, SCU_GPIO_NOPULL);
CS_HIGH();
UD_HIGH();
/* Configures the pins as outputs */
GPIO3_DIR |= (BIT4 | BIT5);
mcp_val = 32;
}
示例14: hw_pwm_pin_pulsewidth
int hw_pwm_pin_pulsewidth (int pin, uint32_t pulsewidth)
{
if (g_APinDescription[pin].alternate != PWM_MODE) {
return -1; // Not a PWM pin
}
// This is the output channel ({8,5,10} on TM-00-04). They're also
// used as event indicies for convenience,
int channel = g_APinDescription[pin].pwm_channel;
// Event N at counter match
LPC_SCT->EVENT[channel].CTRL = SCT_EVENT_CTRL_MATCH(channel) | SCT_EVENT_CTRL_MATCH_ONLY; // match register 1, match condition only, no state change
LPC_SCT->EVENT[channel].STATE = (1 << 0); // in state 0
LPC_SCT->MATCH[channel].U = pulsewidth;
LPC_SCT->MATCHREL[channel].U = pulsewidth;
LPC_SCT->OUT[channel].SET = (1 << 0); // Event 0 sets the output
LPC_SCT->OUT[channel].CLR = (1 << channel); // Event N clears the output
scu_pinmux(g_APinDescription[pin].port,
g_APinDescription[pin].pin,
PUP_DISABLE | PDN_DISABLE,
g_APinDescription[pin].alternate_func);
return 0;
}
示例15: scu_pinmux
int Spi::open()
{
// configure SGPIO bit so we can toggle slave select (SS)
LPC_SGPIO->OUT_MUX_CFG14 = 4;
scu_pinmux(0x1, 3, (MD_PLN | MD_EZI | MD_ZI | MD_EHS), FUNC5); // SSP1_MISO
scu_pinmux(0x1, 4, (MD_PLN | MD_EZI | MD_ZI | MD_EHS), FUNC5); // SSP1_MOSI
scu_pinmux(0x1, 19, (MD_PLN | MD_EZI | MD_ZI | MD_EHS), FUNC1); // SSP1_SCK
// enable interrupt
NVIC_EnableIRQ(SSP1_IRQn);
// sync
sync();
return 0;
}