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

📄 vfd_sunplus.h

📁 代码有点长,需细心阅读,仅供影音视听类产品的开发人员参考
💻 H
字号:
#ifndef __VFD_R_H
#define __VFD_R_H

/* LCD pin map (Sunplus LCD panel)
  1    2    3    4   5   6  7   8   9  10 11  12 13  14 15  16 17  18 19
COM1                 ESP 1a REP 2a  1  3a ALB 4a SHF 5a INT 6a PRG 7a :
     COM2            1f  1b 2f  2b  3f 3b 4f  4b 5f  5b 6f  6b 7f  7b CD
          COM3       1e  1g 2e  2g  3e 3g 4e  4g 5e  5g 6e  6g 7e  7g VCD
               COM4  1d  1c 2d  2c  3d 3c 4d  4c 5d  5c 6d  6c 7d  7c MP3
             
                 a
                ----
             f |  g | b
                ----
             e |    | c
                ----
                 d
*/

/*
**      444444
**     1      5
**     1      5
**      666666
**     2      7
**     2      7
**      333333
*/

#define VFD_7SEG_SG     (1<<6)
#define VFD_7SEG_SF     (1<<1)
#define VFD_7SEG_SE     (1<<2)
#define VFD_7SEG_SD     (1<<3)
#define VFD_7SEG_SC     (1<<7)
#define VFD_7SEG_SB     (1<<5)
#define VFD_7SEG_SA     (1<<4)

#include "vfd_7seg.h"
#include "macro.h"

#define VFD_DOT_MIC1    (255)
#define VFD_DOT_MIC2    (255)
//#define VFD_DOT_MP3     (56)
#define VFD_DOT_SVCD    (255)
//#define VFD_DOT_VCD     (31)
//#define VFD_DOT_CD      (30)
#define VFD_DOT_MINUS   (255)
#define VFD_DOT_PAL     (255)
#define VFD_DOT_NTSC    (255)
#define VFD_DOT_MEM (255)
#define VFD_DOT_PLAYB   (255)
#define VFD_DOT_PLAYA   (255)
#define VFD_DOT_REPALL  (255)
#define VFD_DOT_REP1    (30)
//#define VFD_DOT_REPEAT  (31)
#define VFD_DOT_MINSEC  (255)
#define VFD_DOT_MIN (255)
#define VFD_DOT_SEC (255)
//#define VFD_DOT_COLON   (48)
#define VFD_DOT_DASH    (255)
#define VFD_DOT_RESUME  (255)
#define VFD_DOT_REMAIN  (255)
#define VFD_DOT_PAUSE   (255)
#define VFD_DOT_PLAY    (255)
#define VFD_DOT_PBC     (255)
//#define VFD_DOT_RAN (70)
//#define VFD_DOT_PGM (0)
#define VFD_DOT_VCD20   (255)
#define VFD_DOT_OVER    (255)
#define VFD_DOT_2R      (255)
#define VFD_DOT_1L      (255)
#define VFD_DOT_TIME    (255)
#define VFD_DOT_SPACE   (255)
//#define VFD_DOT_INTRO   (9)
#define VFD_DOT_PGM01   (255)
#define VFD_DOT_PGM02   (255)
#define VFD_DOT_PGM03   (255)
#define VFD_DOT_PGM04   (255)
#define VFD_DOT_PGM05   (255)
#define VFD_DOT_PGM06   (255)
#define VFD_DOT_PGM07   (255)
#define VFD_DOT_PGM08   (255)
#define VFD_DOT_PGM09   (255)
#define VFD_DOT_PGM10   (255)
#define VFD_DOT_PGM11   (255)
#define VFD_DOT_PGM12   (255)
#define VFD_DOT_PGM13   (255)
#define VFD_DOT_PGM14   (255)
#define VFD_DOT_PGM15   (255)
#define VFD_DOT_PGM16   (255)

#define VFD_DOT_ESP     (0)
#define VFD_DOT_REP     (8)
#define VFD_DOT_ONE     (16)
#define VFD_DOT_ALBUM   (24)
#define VFD_DOT_RAN     (32)
#define VFD_DOT_INTRO   (40)
#define VFD_DOT_PGM (48)
#define VFD_DOT_COLON   (56)
#define VFD_DOT_CD      (57)
#define VFD_DOT_VCD     (58)
#define VFD_DOT_MP3     (59)

#define VFDA_P0     1
#define VFDA_P1     0
#define VFDA_M0     5
#define VFDA_M1     4
#define VFDA_S0     7
#define VFDA_S1     6

const BYTE vfd_addr[7] = { 0, 1, 2, 3, 4, 5, 6 };
void print_vfd_digital(BYTE no, BYTE data)
{
    if(no < 7)
    {
        vfd_mem[vfd_addr[no]] &= (~0xfe);
        vfd_mem[vfd_addr[no]] |= (vfd_digit[data]);
    }
}

void vfd_disc_turn(BYTE mode)
{
    static BYTE i = 7;

    if(i < 2)
        i = 7;
    if(mode == 2)
    {
        //vfd_mem[1]=0xfe;
        //vfd_mem[1]&=(~(1<<(i%8)));
        i--;
        switch (i)
        {
            case 1:
                vfd_dot(VFD_DOT_ON, VFD_DOT_COLON);
                break;
            case 4:
                vfd_dot(VFD_DOT_OFF, VFD_DOT_COLON);
            default:
                break;
        }
    }
    else if(mode == 1)
    {
        //vfd_mem[1]=0xfe;         
        vfd_dot(VFD_DOT_ON, VFD_DOT_COLON);
    }
    else if(mode == 0)
    {
        //vfd_mem[1]=0xfe;         
        vfd_dot(VFD_DOT_OFF, VFD_DOT_COLON);
    }
}

void vfd_cdtype(BYTE cd_types)
{
    switch (cd_types)
    {
        case CDCVD:
        case CDSVCD:
            vfd_dot(VFD_DOT_ON, VFD_DOT_SVCD);
            break;
        case CDVCD10:
        case CDVCD11:
        case CDVCD20:
            vfd_dot(VFD_DOT_ON, VFD_DOT_VCD);
            break;
        case CDDA:
            vfd_dot(VFD_DOT_ON, VFD_DOT_CD);
            break;
        case CDVCD30:
            break;
        case CDROM:
            vfd_dot(VFD_DOT_ON, VFD_DOT_MP3);
            break;
    }
}

void vfd_close(void)
{
    print_vfd_digital(1, 12);
    print_vfd_digital(2, 21);
    print_vfd_digital(3, 24);
    print_vfd_digital(4, 28);
    print_vfd_digital(5, 14);
}
void vfd_readtoc(void)
{
    //int i;
    init_vfd_clear(0);
    vfd_disc_turn(0);
    //for(i=0;i<7;i++)
    //     vfd_mem[vfd_addr[i]]|=VFD_7SEG_SG;              
    print_vfd_digital(3, 27);
    print_vfd_digital(4, 14);
    print_vfd_digital(5, 10);
    print_vfd_digital(6, 13);
}

void vfd_nodisc(void)
{
    print_vfd_digital(0, 23);
    print_vfd_digital(1, 24);
    print_vfd_digital(3, 13);
    print_vfd_digital(4, 18);
    print_vfd_digital(5, 28);
    print_vfd_digital(6, 12);
}


void vfd_open(void)
{
    print_vfd_digital(2, 24);
    print_vfd_digital(3, 25);
    print_vfd_digital(4, 14);
    print_vfd_digital(5, 23);
}

void vfd_show_time(void)
{
    static BYTE cd_time_ss = 0xff;  //0;  wyf 2-4-1 15:57

    if(cd_disp_ss != cd_time_ss)
    {
        cd_time_ss = cd_disp_ss;
        print_vfd_digital(0, cd_disp_trk / 100);
        print_vfd_digital(1, cd_disp_trk / 10);
        print_vfd_digital(2, cd_disp_trk % 10);
        print_vfd_digital(3, cd_disp_mm / 10);
        print_vfd_digital(4, cd_disp_mm % 10);
        print_vfd_digital(5, cd_disp_ss / 10);
        print_vfd_digital(6, cd_disp_ss % 10);
    }

}

void vfd_pause(void)
{
    vfd_dot(VFD_DOT_ON, VFD_DOT_PAUSE);
    vfd_dot(VFD_DOT_OFF, VFD_DOT_PLAY);
}

void vfd_audio(void)
{
    switch (audio_channel)
    {
        case CH_LR:
            vfd_dot(VFD_DOT_ON, VFD_DOT_1L);
            vfd_dot(VFD_DOT_ON, VFD_DOT_2R);
            break;
#ifdef VOCAL_CANCEL
        case CH_AUTO_L:
#endif
        case CH_LL:
            vfd_dot(VFD_DOT_ON, VFD_DOT_1L);
            vfd_dot(VFD_DOT_OFF, VFD_DOT_2R);
            break;
#ifdef VOCAL_CANCEL
        case CH_AUTO_R:
#endif
        case CH_RR:
            vfd_dot(VFD_DOT_OFF, VFD_DOT_1L);
            vfd_dot(VFD_DOT_ON, VFD_DOT_2R);
            break;
#ifdef VOCAL_CANCEL
        case CH_AUTO_LR:
            vfd_dot(VFD_DOT_ON, VFD_DOT_1L);
            vfd_dot(VFD_DOT_ON, VFD_DOT_2R);
            break;
#endif
    }
}

void vfd_format(void)
{
    if(tv_format == TV_NTSC)
    {
        vfd_dot(VFD_DOT_ON, VFD_DOT_NTSC);
        vfd_dot(VFD_DOT_OFF, VFD_DOT_PAL);
    }
    else if(tv_format == TV_PAL)
    {
        vfd_dot(VFD_DOT_ON, VFD_DOT_PAL);
        vfd_dot(VFD_DOT_OFF, VFD_DOT_NTSC);
    }
}

void vfd_playmode(void)
{
    if(cd_type_loaded == CDROM || cd_type_loaded == CDDA)   //wyf 2-6-25 9:02.
    {
        vfd_dot(VFD_DOT_OFF, VFD_DOT_PBC);
        return;
    }
    else
    {
        if(IsPBCOn())
            vfd_dot(VFD_DOT_ON, VFD_DOT_PBC);
        else
            vfd_dot(VFD_DOT_OFF, VFD_DOT_PBC);
    }
}

void vfd_repeat(void)
{

    switch (rep_mode)
    {
        case REPEAT_TRACK:
            vfd_dot(VFD_DOT_ON, VFD_DOT_REP1);
            vfd_dot(VFD_DOT_OFF, VFD_DOT_REPALL);
            break;
        case REPEAT_DISC:
            if(cd_type_loaded == CDROM)
                vfd_dot(VFD_DOT_ON, VFD_DOT_REPALL);
            else
                vfd_dot(VFD_DOT_ON, VFD_DOT_REPALL);
            vfd_dot(VFD_DOT_ON, VFD_DOT_REP1);

            break;
        default:                                        //repeat cancel
            vfd_dot(VFD_DOT_OFF, VFD_DOT_REP1);
            vfd_dot(VFD_DOT_OFF, VFD_DOT_REPALL);
            break;
    }
}


void vfd_refresh(void)
{
    vfd_playmode();
    vfd_format();
    vfd_cdtype(cd_type_loaded);
    vfd_audio();
}

void vfd_game(void)
{
    print_vfd_digital(0, 0);
    print_vfd_digital(1, GetCmdSrc(sys_cmd) / 10);
    print_vfd_digital(2, GetCmdSrc(sys_cmd) % 10);
    print_vfd_digital(3, 0);
    print_vfd_digital(4, 0);
    print_vfd_digital(5, 0);
    print_vfd_digital(6, 0);
}

void vfd_game_clear(void)
{
    print_vfd_digital(1, 0);
    print_vfd_digital(2, 0);
}

void vfd_jpeg_disp(void)
{//ok!
       init_vfd_clear(0);     
       print_vfd_digital(3,cd_disp_trk/1000);
       print_vfd_digital(4,(cd_disp_trk / 100) % 10);
       print_vfd_digital(5,(cd_disp_trk / 10) % 10);
       print_vfd_digital(6,cd_disp_trk % 10);      
       
       vfd_dot(VFD_DOT_ON,VFD_DOT_PLAY);
       vfd_dot(VFD_DOT_OFF,VFD_DOT_PAUSE);
}

#endif/*__VFD_R_H*/

⌨️ 快捷键说明

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