申请狗板也结束了,差不多该拿出点东西来了。这两天配了下开发环境,粗略的把GPIO搞定,写了个亮灯程序。
现贴出一段代码:
/* Selecting LED pin for use. */
GPIO1PinMuxSetup(21); GPIO1PinMuxSetup(22); GPIO1PinMuxSetup(23); GPIO1PinMuxSetup(24); /* Enabling the GPIO module. */ 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
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); }
|