PYNQでChipkit GPIOのテスト

ck_gpio[15:0]のck_gpio[0]=IO26を点灯させる
コード

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xparameters.h"
#include "xgpio.h"

#define GPIO_EXAMPLE_DEVICE_ID  XPAR_GPIO_1_DEVICE_ID
#define LED_DELAY     10000000
#define LED_CHANNEL 1

XGpio Gpio; /* The Instance of the GPIO Driver */
#define LED 0x01   /* Assumes bit 0 of GPIO is connected to an LED  */

int main()
{
	init_platform();

	print("Hello World\n\r");

	int Status;
	volatile int Delay;

	/* Initialize the GPIO driver */
	Status = XGpio_Initialize(&Gpio, GPIO_EXAMPLE_DEVICE_ID);
	if (Status != XST_SUCCESS) {
		xil_printf("Gpio Initialization Failed\r\n");
		return XST_FAILURE;
	}

	/* Set the direction for all signals as inputs except the LED output */
	XGpio_SetDataDirection(&Gpio, LED_CHANNEL, ~LED);

	/* Loop forever blinking the LED */

	while (1) {
		XGpio_DiscreteWrite(&Gpio, LED_CHANNEL, LED);
		for (Delay = 0; Delay < LED_DELAY; Delay++);
		XGpio_DiscreteClear(&Gpio, LED_CHANNEL, LED);
		for (Delay = 0; Delay < LED_DELAY; Delay++);
	}

	xil_printf("Successfully ran Gpio Example\r\n");

	cleanup_platform();
	return 0;
}