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

📄 lcd_controller.h

📁 在SOPC平台上
💻 H
字号:
#ifndef __LCD_CONTROLLER_H__
#define __LCD_CONTROLLER_H__

#include <stdio.h>
#include "system.h"
#include "sys/alt_llist.h"
#include "priv/alt_dev_llist.h"
#include "priv/alt_file.h"


#define HEAP -1

#define BLACK_8 0x00

#define FRAME_WIDTH 240
#define FRAME_HEIGHT 320

typedef int frame_array;

typedef struct {
  frame_array* frame0;
  frame_array* frame1;
  int width;
  int height;
  int color_depth;
  int bytes_per_pixel;
  int bytes_per_frame;
  int frame_buffers;
  int orientation;
  int lcd_controller_base;
} frame_buffer_struct;

typedef struct lcd_controller_dev lcd_controller_dev;

struct lcd_controller_dev
{
  alt_dev dev;
  int width;
  int height;
  int color_depth;
  int base_addr;
  int frame_buffers;
  int orientation;
};

#define LCD_CONTROLLER_INSTANCE(name, dev)           \
static lcd_controller_dev dev =                      \
{                                                    \
  {                                                  \
      ALT_LLIST_ENTRY,                               \
      name##_NAME,                                   \
      NULL, /* open */                               \
      NULL, /* close */                              \
      NULL, /* read */                               \
      NULL, /* write */                              \
      NULL, /* lseek */                              \
      NULL, /* fstat */                              \
      NULL, /* ioctl */                              \
   },                                                \
   name##_SCREEN_WIDTH,                              \
   name##_SCREEN_HEIGHT,                             \
   name##_COLOR_DEPTH,                               \
   name##_BASE,                                      \
   name##_FRAME_BUFFERS,                             \
   name##_ORIENTATION,                               \
}

#define LCD_CONTROLLER_INIT(name, dev)               \
    lcd_dev_init (&dev )        

static ALT_INLINE int lcd_device_register( alt_dev* fd)
{
  extern alt_llist lcd_dev_list;

  return alt_dev_llist_insert ((alt_dev_llist*) fd, &lcd_dev_list);
}

int lcd_dev_init ( lcd_controller_dev* lcd );

alt_dev* alt_lcd_open_dev(const char* name);

void alt_lcd_close_dev(alt_dev* fd);

frame_buffer_struct* lcd_init_no_interrupt ( lcd_controller_dev* lcd, int buffer_location);

int lcd_stop ( lcd_controller_dev* lcd );

inline void lcd_clear_screen ( frame_buffer_struct* frame_buffer, char color );

int lcd_flip_frame_buffers( frame_buffer_struct* frame_buffer );

#endif // __LCD_CONTROLLER_H__

⌨️ 快捷键说明

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