本文整理汇总了C++中ROM_GPIOPinWrite函数的典型用法代码示例。如果您正苦于以下问题:C++ ROM_GPIOPinWrite函数的具体用法?C++ ROM_GPIOPinWrite怎么用?C++ ROM_GPIOPinWrite使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ROM_GPIOPinWrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
//
// Device configuration: PLL is used, crystal of 16 MHz, main clock is the source clock
// System clock divider = 4
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
//
// PF2 as output (blue led)
//
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN);
ButtonsInit(); // Init buttons
// Loop
while(1)
{
In = ROM_GPIOPinRead(BUTTONS_GPIO_BASE, RIGHT_BUTTON); // Read PORTF 0
if (In==0){
ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_BLUE, LED_BLUE); // Turn on LED BLUE
ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED, 0);
}
else {
ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_RED, LED_RED); // Turn on LED RED
ROM_GPIOPinWrite(GPIO_PORTF_BASE, LED_BLUE, 0);
}
}
}
示例2: readSingleBlock
void readSingleBlock(unsigned char *buf, unsigned int addr) {
ROM_GPIOPinWrite(LED_BASE, BUSY_LED, BUSY_LED);
unsigned char r = sendCommand(CMD17, addr);
if(r != 0x00){
#ifdef __UART_DEBUG
UARTprintf("Recieved error 0x%02x for CMD17(0x%02x)!\n",r,addr);
#endif
errorAndHang();
}
// read in what we've requested
do
r = tradeByte(0xff);
while (r == 0xff);
if(r != 0xfe) {
#ifdef __UART_DEBUG
UARTprintf("Invalid data token read, recieved %02x\n",r);
#endif
errorAndHang();
}
for(int i = 0; i < 512; i++)
buf[i] = tradeByte(0xff);
while(tradeByte(0xff) != 0xff);
ROM_GPIOPinWrite(LED_BASE, BUSY_LED, 0);
}
示例3: writeSingleBlock
void writeSingleBlock(unsigned char *buf, unsigned int addr) {
ROM_GPIOPinWrite(LED_BASE, BUSY_LED, BUSY_LED);
unsigned char r = sendCommand(CMD24, addr);
if(r != 0x00){
#ifdef __UART_DEBUG
UARTprintf("Recieved error 0x%02x for CMD24(0x%02x)!\n",r,addr);
#endif
errorAndHang();
}
// block start token
tradeByte(0xfe);
// push out data packet
for(int i = 0; i < 512; i++)
tradeByte(buf[i]);
// CRC dummy bytes
r = tradeByte(0xff);
r = tradeByte(0xff);
// card is now busy, wait for it to stop
while(tradeByte(0xff) != 0xff);
ROM_GPIOPinWrite(LED_BASE, BUSY_LED, 0);
}
示例4: board_toggle_led
void board_toggle_led(led_t led) {
uint32_t port;
switch (led) {
case RED:
port = ROM_GPIOPinRead(LED_RED_PORTBASE, LED_RED);
port ^=LED_RED;
ROM_GPIOPinWrite(LED_RED_PORTBASE, LED_RED, port);
break;
case BLUE:
port = ROM_GPIOPinRead(LED_BLUE_PORTBASE, LED_BLUE);
port ^=LED_BLUE;
ROM_GPIOPinWrite(LED_BLUE_PORTBASE, LED_BLUE, port);
break;
case GREEN:
port = ROM_GPIOPinRead(LED_GREEN_PORTBASE, LED_GREEN);
port ^=LED_GREEN;
ROM_GPIOPinWrite(LED_GREEN_PORTBASE, LED_GREEN, port);
break;
default:
break;
}
}
示例5: init_lcd
// Fonction qui initialise le LCD
void init_lcd(void) {
// Enable ports on board
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
// Configure pins
ROM_GPIOPadConfigSet(GPIO_PORTE_BASE, 0xFF, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPD);
// Enable data as output
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE, 0xFF); // Toutes les pins
// Default values of pins to zero
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_RS | LCD_RW | LCD_E, 0x00);
ROM_GPIOPinWrite(GPIO_PORTE_BASE, 0xFF, 0x00);
// Set LCD to 2line mode
wait();
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_RS | LCD_RW, LCD_RS_Instruction | LCD_RW_Write);
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_E, LCD_E);
ROM_GPIOPinWrite(GPIO_PORTE_BASE, 0xFF, 0x38);
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_E, 0);
// Activate cursor blinking
wait();
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_RS | LCD_RW, LCD_RS_Instruction | LCD_RW_Write);
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_E, LCD_E);
ROM_GPIOPinWrite(GPIO_PORTE_BASE, 0xFF, 0x0F);
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_E, 0);
// Clear LCD
clear();
}
示例6: IntGPIOa
//*****************************************************************************
//
// This is the handler for INT_GPIOA. It simply saves the interrupt sequence
// number.
//
//*****************************************************************************
void
IntGPIOa(void)
{
//
// Set PE1 high to indicate entry to this interrupt handler.
//
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1, GPIO_PIN_1);
//
// Put the current interrupt state on the display.
//
DisplayIntStatus();
//
// Wait two seconds.
//
Delay(2);
//
// Save and increment the interrupt sequence number.
//
g_ui32GPIOa = g_ui32Index++;
//
// Set PE1 low to indicate exit from this interrupt handler.
//
ROM_GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_1, 0);
}
示例7: write_char
//Fonction qui écrit le charactère "mychar" en mémoire du LCD
void write_char(char mychar) {
wait();
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_RS | LCD_RW, LCD_RS_Display | LCD_RW_Write);
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_E, LCD_E);
ROM_GPIOPinWrite(GPIO_PORTE_BASE, 0xFF, mychar);
ROM_GPIOPinWrite(GPIO_PORTJ_BASE, LCD_E, 0);
}
示例8: Config_PWM
static void Config_PWM(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_GPIOPinConfigure(GPIO_PB6_T0CCP0);
ROM_GPIOPinConfigure(GPIO_PB2_T3CCP0);
ROM_GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_6);
// Configure timer
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER3);
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, DEFAULT);
ROM_TimerMatchSet(TIMER0_BASE, TIMER_A, DEFAULT); // PWM
ROM_TimerEnable(TIMER0_BASE, TIMER_A);
ROM_TimerConfigure(TIMER3_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM);
ROM_TimerLoadSet(TIMER3_BASE, TIMER_A, DEFAULT);
ROM_TimerMatchSet(TIMER3_BASE, TIMER_A, DEFAULT); // PWM
ROM_TimerControlLevel(TIMER3_BASE, TIMER_A, true);
ROM_TimerEnable(TIMER3_BASE, TIMER_A);
ROM_SysCtlPeripheralEnable(DRV_ENABLE_LEFT_CHN_PERIPHERAL);
ROM_SysCtlPeripheralEnable(DRV_ENABLE_RIGHT_CHN_PERIPHERAL);
ROM_GPIOPinTypeGPIOOutput(DRV_ENABLE_LEFT_CHN_PORT, DRV_ENABLE_LEFT_CHN_PIN);
ROM_GPIOPinTypeGPIOOutput(DRV_ENABLE_RIGHT_CHN_PORT, DRV_ENABLE_RIGHT_CHN_PIN);
ROM_GPIOPinWrite(DRV_ENABLE_LEFT_CHN_PORT, DRV_ENABLE_LEFT_CHN_PIN, 0);
ROM_GPIOPinWrite(DRV_ENABLE_RIGHT_CHN_PORT, DRV_ENABLE_RIGHT_CHN_PIN, 0);
}
示例9: MX66L51235FWait
//*****************************************************************************
//
// Waits until a program/erase operation has completed.
//
//*****************************************************************************
static void
MX66L51235FWait(void)
{
uint8_t ui8Status;
//
// Loop until the requested operation has completed.
//
do {
//
// Assert the chip select to the MX66L51235F.
//
ROM_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, 0);
//
// Read the status register.
//
ui8Status = ROM_SPIFlashReadStatus(SSI3_BASE);
//
// De-assert the chip select to the MX66L51235F.
//
ROM_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, GPIO_PIN_1);
} while(ui8Status & 1);
}
示例10: TimerIntHandlerServos
// Triggered every SERVO_TIMER_RESOLUTION microseconds
void TimerIntHandlerServos(void) {
// Clear the interrupt
ROM_TimerIntClear(SERVO_TIMER, SERVO_TIMER_TRIGGER);
// SERVO_TIMER_RESOLUTION microseconds have passed, increment each counter by that
// to determine how long to set the pin high for
g_pulseTime += SERVO_TIMER_RESOLUTION;
if(g_pulseTime > SERVO_PERIOD) {
g_pulseTime = 0;
}
// Loop through al servo configs and see if they need to be set low yet
uint8_t i;
for(i=0; i<SERVO_MAX_COUNT; i++) {
servo_t *servo = &g_servos[i];
if(servo->state & SERVO_STATE_ENABLED) {
if(g_pulseTime >= servo->value) {
// End of pulse, set low
ROM_GPIOPinWrite(servo->port, servo->pin, 0);
} else {
// Beginning of pulse, set high
ROM_GPIOPinWrite(servo->port, servo->pin, servo->pin);
}
}
}
}
示例11: motor_enable
void motor_enable()
{
ROM_GPIOPinWrite( MOTOR_XENPORT, MOTOR_XEN, 0 );
ROM_GPIOPinWrite( MOTOR_YENPORT, MOTOR_YEN, 0 );
ROM_GPIOPinWrite( MOTOR_ZENPORT, MOTOR_ZEN, 0 );
ROM_GPIOPinWrite( MOTOR_EENPORT, MOTOR_EEN, 0 );
motors_enabled = true;
}
示例12: motor_disable
void motor_disable()
{
ROM_GPIOPinWrite( MOTOR_XENPORT, MOTOR_XEN, MOTOR_XEN );
ROM_GPIOPinWrite( MOTOR_YENPORT, MOTOR_YEN, MOTOR_YEN );
ROM_GPIOPinWrite( MOTOR_ZENPORT, MOTOR_ZEN, MOTOR_ZEN );
ROM_GPIOPinWrite( MOTOR_EENPORT, MOTOR_EEN, MOTOR_EEN );
motors_enabled = false;
}
示例13: motor_unstep
void motor_unstep()
{
ROM_GPIOPinWrite(LED_PORT, LED_R | LED_G | LED_B, 0 );
ROM_GPIOPinWrite( MOTOR_XSTEPPORT, MOTOR_XPIN, 0);
ROM_GPIOPinWrite( MOTOR_YSTEPPORT, MOTOR_YPIN, 0);
ROM_GPIOPinWrite( MOTOR_ZSTEPPORT, MOTOR_ZPIN, 0);
ROM_GPIOPinWrite( MOTOR_ESTEPPORT, MOTOR_EPIN, 0);
}
示例14: MX66L51235FWriteEAR
//*****************************************************************************
//
// Writes the extended address register, allowing the full contents of the
// MX66L51235F to be accessed.
//
//*****************************************************************************
static void
MX66L51235FWriteEAR(uint32_t ui32Addr)
{
//
// See if the extended address register needs to be written.
//
if((ui32Addr & 0xff000000) == (g_ui32MX66L51235FAddr & 0xff000000)) {
//
// The extended address register does not need to be changed, so return
// without doing anything.
//
return;
}
//
// Save the new value of the extended address register.
//
g_ui32MX66L51235FAddr = ui32Addr;
//
// Enable program/erase of the SPI flash.
//
MX66L51235FWriteEnable();
//
// Assert the chip select to the MX66L51235F.
//
ROM_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, 0);
//
// Set the SSI module into write-only mode.
//
ROM_SSIAdvModeSet(SSI3_BASE, SSI_ADV_MODE_WRITE);
//
// Send the sector erase command.
//
ROM_SSIDataPut(SSI3_BASE, 0xc5);
//
// Send the address of the sector to be erased, marking the last byte of
// the address as the end of the frame.
//
ROM_SSIAdvDataPutFrameEnd(SSI3_BASE, (ui32Addr >> 24) & 0xff);
//
// Wait until the command has been completely transmitted.
//
while(ROM_SSIBusy(SSI3_BASE)) {
}
//
// De-assert the chip select to the MX66L51235F.
//
ROM_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, GPIO_PIN_1);
}
示例15: lcd_init
void lcd_init() {
ROM_SysCtlPeripheralEnable(LCD_PORTENABLE);
ROM_GPIOPinTypeGPIOOutput(LCD_PORT, (LCD_RS | LCD_E | LCD_D4 | LCD_D5 | LCD_D6 | LCD_D7));
// Please refer to the HLCD_D44780 datasheet for how these initializations work!
ROM_SysCtlDelay(ROM_SysCtlClockGet()/3/2);
ROM_GPIOPinWrite(LCD_PORT, LCD_RS, 0x00);
ROM_GPIOPinWrite(LCD_PORT, LCD_D4 | LCD_D5 | LCD_D6 | LCD_D7, 0x30);
ROM_GPIOPinWrite(LCD_PORT, LCD_E, 0x02);ROM_SysCtlDelay((20e-6)*ROM_SysCtlClockGet()/3); ROM_GPIOPinWrite(LCD_PORT, LCD_E, 0x00);
ROM_SysCtlDelay((50e-3)*ROM_SysCtlClockGet()/3);
ROM_GPIOPinWrite(LCD_PORT, LCD_D4 | LCD_D5 | LCD_D6 | LCD_D7, 0x30);
ROM_GPIOPinWrite(LCD_PORT, LCD_E, 0x02);ROM_SysCtlDelay((20e-6)*ROM_SysCtlClockGet()/3);ROM_GPIOPinWrite(LCD_PORT, LCD_E, 0x00);
ROM_SysCtlDelay((50e-3)*ROM_SysCtlClockGet()/3);
ROM_GPIOPinWrite(LCD_PORT, LCD_D4 | LCD_D5 | LCD_D6 | LCD_D7, 0x30);
ROM_GPIOPinWrite(LCD_PORT, LCD_E, 0x02);ROM_SysCtlDelay((20e-6)*ROM_SysCtlClockGet()/3); ROM_GPIOPinWrite(LCD_PORT, LCD_E, 0x00);
ROM_SysCtlDelay((10e-3)*ROM_SysCtlClockGet()/3);
ROM_GPIOPinWrite(LCD_PORT, LCD_D4 | LCD_D5 | LCD_D6 | LCD_D7, 0x20);
ROM_GPIOPinWrite(LCD_PORT, LCD_E, 0x02);ROM_SysCtlDelay((20e-6)*ROM_SysCtlClockGet()/3); ROM_GPIOPinWrite(LCD_PORT, LCD_E, 0x00);
ROM_SysCtlDelay((10e-3)*ROM_SysCtlClockGet()/3);
lcd_command(LCD_CLEARDISPLAY); // Clear the screen.
lcd_command(0x06); // Cursor moves right.
lcd_command(LCD_DISPLAYCONTROL | LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF); // Don't show any cursor, turn on LCD.
}