⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 9095dc10175b001d12ebad93121f84ab

📁 altera DE1 SD_CARD带写入一个扇区功能的程序
💻
字号:
#include "alt_types.h"
#include "sys/alt_irq.h"
#include "system.h"
#include <stdio.h>
#include <unistd.h>

#define pio *(unsigned int*)PIO_BASE
#define pio1 *(unsigned int*)PIO_1_BASE

void handle_button_interrupts(void* context, alt_u32 id)
{
    (&pio1)[3]=0;
    printf("The key u pressed is %c\n",pio);
}

void init_button_pio()
{
    (&pio1)[2]=0xf;
    (&pio1)[3]=0;
    alt_irq_register( PIO_1_IRQ, 0,handle_button_interrupts );
}

int main()
{
    init_button_pio();
    
  printf("Hello from Nios II!\n");
    while(1);
  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -