beaglebone点亮LED
这两天配了下开发环境,粗略的把GPIO搞定,写了个亮灯程序。
现贴出一段代码:
/* Selecting LED pin for use. */
GPIO1PinMuxSetup(21);
GPIO1PinMuxSetup(22);
GPIO1PinMuxSetup(23);
GPIO1PinMuxSetup(24);
/* Enabling the GPIO module. */<r_output);
GPIODirModeSet(GPIO_INSTANCE_ADDRESS,
24,
GPIO_DIR_OUTPUT);
while(1)sp; 21,
GPIO_DIR_OUTPUT);
GPIODirModeSet(GPIO_INSTANCE_ADDRESS,
22,
GPIO_DIR_OUTPUT);
GPIODirModeSet(GPIO_INSTANCE_ADDRESS,
23</r_output);
GPIO_DIR_OUTPUT);
GPIODirModeSet(GPIO_INSTANCE_ADDRESS,
24,
GPIO_DIR_OUTPUT);
while(1)
{
/* Driving a logic HIGH on the GPIO pin. */
GPIOPinWrite(GPIO_INSTANCE_ADDRESS,
21,
GPIO_PIN_HIGH);
GPIOPinWrite(GPIO_INSTANCE_ADDRESS,
22,
GPIO_PIN_HIGH);
GPIOPinWrite(GPIO_INSTANCE_ADDRESS,
GPIO_INSTANCE_PIN_NUMBER,
GPIO_PIN_HIGH);
GPIOPinWrite(GPIO_INSTANCE_ADDRESS,
24,
GPIO_PIN_HIGH);
Delay(0x3FFFF);
/* Driving a logic LOW on the GPIO pin. */
GPIOPinWrite(GPIO_INSTANCE_ADDRESS,
21,
GPIO_PIN_LOW);
GPIOPinWrite(GPIO_INSTANCE_ADDRESS,
22,
GPIO_PIN_LOW);
GPIOPinWrite(GPIO_INSTANCE_ADDRESS,
GPIO_INSTANCE_PIN_NUMBER,
GPIO_PIN_LOW);
GPIOPinWrite(GPIO_INSTANCE_ADDRESS,
24,
GPIO_PIN_LOW);
Delay(0x3FFFF);
}
|