Skip to content

Commit

Permalink
Переделана работа ВГ75, поддержка аттрибутов и псевдографики.
Browse files Browse the repository at this point in the history
Картинку можно двигать Win+Курсор.
Переделана Web-страница, доступно обновление прошивки.
0x00000.bin - файл для прошивки программатором
fota.bin - файл для прошивки по WiFi через Web-страницу.
  • Loading branch information
Alexey Presniakov committed Mar 25, 2018
1 parent dc1197e commit 47ef9a4
Show file tree
Hide file tree
Showing 23 changed files with 503 additions and 217 deletions.
13 changes: 9 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ cd WiFiAPP
make || exit
cd ..

cd mkfw
rm -f 0x00000.bin fota.bin
./mkfw || exit
cd ..

cd ..


# óÏÚÄÁÅÍ ËÁÔÁÌÏÇ ÄÌÑ ÂÉÌÄÁ
mkdir -p builds/$BUILD || exit

# ëÏĞÉÒÕÅÍ ÆÁÊÌÙ
cp soft/boot-2apps/out/boot.bin builds/$BUILD/0x00000.bin || exit
cp soft/EmuAPP/out/emu-0x00000.bin builds/$BUILD/0x01000.bin || exit
cp soft/WiFiAPP/out/wifi.1.bin builds/$BUILD/0x10000.bin || exit
cp soft/WiFiAPP/httpfs/httpfs.bin builds/$BUILD/0x70000.bin || exit
cp soft/mkfw/0x00000.bin builds/$BUILD || exit
cp soft/mkfw/fota.bin builds/$BUILD || exit

echo "Build $BUILD done"
Binary file added builds/15/0x00000.bin
Binary file not shown.
Binary file added builds/15/fota.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion soft/EmuAPP/src/i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


// 1600000000L/(div*bestbck)
#define WS_I2S_BCK 4
#define WS_I2S_BCK 5
#define WS_I2S_DIV 4

#ifndef i2c_bbpll
Expand Down
83 changes: 63 additions & 20 deletions soft/EmuAPP/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void main_program(void)
uint32_t prev_T=getCycleCount();
uint32_t sec_T=prev_T;
uint32_t cycles=0, sec_cycles=0;
bool turbo=false;
bool turbo=false, win=false;
while (1)
{
uint32_t T=getCycleCount();
Expand Down Expand Up @@ -88,25 +88,68 @@ void main_program(void)
sec_T=prev_T=getCycleCount();
sec_cycles=0;
}
ps2_leds(kbd_rus(), false, turbo);
ps2_periodic();
switch (keymap_periodic())
{
case PS2_ESC:
// îÁÖÁÌÉ ESC - ÚÁÐÕÓË ÍÅÎÀ
ui_start();
menu();
ui_stop();

if (win)
{
// Win ÎÁÖÁÔÁ - ÏÂÒÁÂÁÔÙ×ÁÅÍ ÓÐÅÃ-ËÏÍÁÎÄÙ
uint16_t c=ps2_read();
switch (c)
{
case PS2_LEFT:
// üËÒÁÎ ×ÌÅ×Ï
if (screen.x_offset > 0) screen.x_offset--;
break;

case PS2_RIGHT:
// üËÒÁÎ ×ÐÒÁ×Ï
if (screen.x_offset < 16) screen.x_offset++;
break;

case PS2_UP:
// üËÒÁÎ ××ÅÒÈ
if (screen.y_offset > 8) screen.y_offset-=8; else screen.y_offset=0;
break;

case PS2_DOWN:
// üËÒÁÎ ×ÎÉÚ
if (screen.y_offset < 8*8) screen.y_offset+=8;
break;

case PS2_L_WIN | 0x8000:
case PS2_R_WIN | 0x8000:
// ïÔÖÁÌÉ Win
win=false;
break;
}
} else
{
// Win ÎÅ ÎÁÖÁÔÁ
ps2_leds(kbd_rus(), false, turbo);
ps2_periodic();
switch (keymap_periodic())
{
case PS2_ESC:
// îÁÖÁÌÉ ESC - ÚÁÐÕÓË ÍÅÎÀ
ui_start();
menu();
ui_stop();

// óÂÒÁÓÙ×ÁÅÍ ×ÒÅÍÑ ÃÉËÌÏ×
sec_T=prev_T=getCycleCount();
sec_cycles=0;
break;

// óÂÒÁÓÙ×ÁÅÍ ×ÒÅÍÑ ÃÉËÌÏ×
sec_T=prev_T=getCycleCount();
sec_cycles=0;
break;

case PS2_SCROLL:
// ðÅÒÅËÌÀÞÁÔÅÌØ ÔÕÒÂÏ
turbo=!turbo;
break;
}
case PS2_SCROLL:
// ðÅÒÅËÌÀÞÁÔÅÌØ ÔÕÒÂÏ
turbo=!turbo;
break;

case PS2_L_WIN:
case PS2_R_WIN:
// îÁÖÁÌÉ Win
win=true;
break;
}
}
}
}
25 changes: 13 additions & 12 deletions soft/EmuAPP/src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,21 @@ void menu(void)
"4.úÁÇÒÕÚËÁ Ó ÍÁÇÎÉÔÏÆÏÎÁ\n"
"5.ðÅÒÅËÌÀÞÉÔØÓÑ × ÒÅÖÉÍ WiFi\n"
);
ui_draw_text(10, 20,
ui_draw_text(10, 18,
"ðÒÉ×ÑÚËÁ ËÌÁ×ÉÁÔÕÒÙ:\n"
"æ1-æ4 - F1-F4\n"
"֑ - Enter\n"
"ðó - Enter ÎÁ ÄÏÐ.ËÌÁ×ÉÁÔÕÒÅ\n"
"úâ - Backspace\n"
"õó - CTRL\n"
"óó - Shift\n"
"òõó/ìáô - Caps Lock\n"
"\\ - Home\n"
"óôò - End/Delete\n"
"áò2 - Alt\n"
"æ1-æ4 - F1-F4\n"
"֑ - Enter\n"
"ðó - Enter ÎÁ ÄÏÐ.ËÌÁ×ÉÁÔÕÒÅ\n"
"úâ - Backspace\n"
"õó - CTRL\n"
"óó - Shift\n"
"òõó/ìáô - Caps Lock\n"
"\\ - Home\n"
"óôò - End/Delete\n"
"áò2 - Alt\n"
"\n"
"ôõòâï - Scroll Lock\n"
"ôõòâï - Scroll Lock\n"
"WIN+ëÕÒÓÏÒ - óÄ×ÉÇ ÉÚÏÂÒÁÖÅÎÉÑ\n"
);
switch (ui_select(5))
{
Expand Down
3 changes: 3 additions & 0 deletions soft/EmuAPP/src/ps2_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
#define PS2_R_CTRL 0x114
#define PS2_L_ALT 0x11
#define PS2_R_ALT 0x111
#define PS2_L_WIN 0x11F
#define PS2_R_WIN 0x127
#define PS2_MENU 0x12F
#define PS2_ENTER 0x5A
#define PS2_ESC 0x76
#define PS2_INSERT 0x170
Expand Down
80 changes: 23 additions & 57 deletions soft/EmuAPP/src/tv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@


// éÓÐÏÌØÚÕÅÍÙÅ ÐÁÔÔÅÒÎÙ ÄÌÑ I2S
uint8_t tv_empty_line[80];
static uint8_t tv_sync_4_28__4_28[80], tv_sync_4_28__28_4[80];
static uint8_t tv_sync_28_4__4_28[80], tv_sync_28_4__28_4[80];
uint8_t tv_empty_line[64];
static uint8_t tv_sync_4_28__4_28[64], tv_sync_4_28__28_4[64];
static uint8_t tv_sync_28_4__4_28[64], tv_sync_28_4__28_4[64];


static const uint8_t* TV_vsync1[] =
Expand Down Expand Up @@ -59,7 +59,7 @@ static const uint8_t* tv_i2s_cb(void)
static uint8_t field=0;
static const uint8_t* *sync=TV_vsync1;
static uint16_t line=0;
#define T_DELAY_N 6
#define T_DELAY_N 7
static uint32_t Tdelay[T_DELAY_N]; // ÌÉÎÉÑ ÚÁÄÅÒÖËÉ ÓÉÎÈÒÏÎÉÚÁÃÉÉ (Ô.Ë. I2S ÉÍÅÅÔ ÚÁÄÅÒÖËÕ ÐÒÉ ×Ù×ÏÄÅ)
static uint8_t Tdelay_n=0;

Expand Down Expand Up @@ -109,66 +109,32 @@ void tv_init(void)
// úÁÐÏÌÎÑÅÍ ×ÓÅ ÐÁÔÔÅÒÎÙ (ÐÏÒÑÄÏË ÂÁÊÔ 3-2-1-0)

// ðÕÓÔÁÑ ÓÔÒÏËÁ - ÔÏÌØËÏ ÓÉÎÈÒÁ 4ÍËÓ
ets_memset(tv_empty_line, 0x00, 80);
tv_empty_line[3]=0xff;
tv_empty_line[2]=0xff;
tv_empty_line[1]=0xff;
tv_empty_line[0]=0xff;
tv_empty_line[7]=0xff;
ets_memset(tv_empty_line, 0x00, 64);
ets_memset(tv_empty_line+0, 0xff, 4);

// ðÁÔÔÅÒÎ 4-28, 4-28 ÍËÓ
ets_memset(tv_sync_4_28__4_28, 0x00, 80);
tv_sync_4_28__4_28[3]=0xff;
tv_sync_4_28__4_28[2]=0xff;
tv_sync_4_28__4_28[1]=0xff;
tv_sync_4_28__4_28[0]=0xff;
tv_sync_4_28__4_28[7]=0xff;
tv_sync_4_28__4_28[43]=0xff;
tv_sync_4_28__4_28[42]=0xff;
tv_sync_4_28__4_28[41]=0xff;
tv_sync_4_28__4_28[40]=0xff;
tv_sync_4_28__4_28[47]=0xff;
ets_memset(tv_sync_4_28__4_28, 0x00, 64);
ets_memset(tv_sync_4_28__4_28+0, 0xff, 4);
ets_memset(tv_sync_4_28__4_28+32, 0xff, 4);

// ðÁÔÔÅÒÎ 4-28, 28-4 ÍËÓ
ets_memset(tv_sync_4_28__28_4, 0x00, 40);
tv_sync_4_28__28_4[3]=0xff;
tv_sync_4_28__28_4[2]=0xff;
tv_sync_4_28__28_4[1]=0xff;
tv_sync_4_28__28_4[0]=0xff;
tv_sync_4_28__28_4[7]=0xff;
ets_memset(tv_sync_4_28__28_4+40, 0xff, 40);
tv_sync_4_28__28_4[72]=0x00;
tv_sync_4_28__28_4[79]=0x00;
tv_sync_4_28__28_4[78]=0x00;
tv_sync_4_28__28_4[77]=0x00;
tv_sync_4_28__28_4[76]=0x00;
ets_memset(tv_sync_4_28__28_4, 0x00, 32);
ets_memset(tv_sync_4_28__28_4+0, 0xff, 4);

ets_memset(tv_sync_4_28__28_4+32, 0xff, 32);
ets_memset(tv_sync_4_28__28_4+64-4, 0x00, 4);

// ðÁÔÔÅÒÎ 28-4, 4-28 ÍËÓ
ets_memset(tv_sync_28_4__4_28, 0xff, 40);
tv_sync_28_4__4_28[32]=0x00;
tv_sync_28_4__4_28[39]=0x00;
tv_sync_28_4__4_28[38]=0x00;
tv_sync_28_4__4_28[37]=0x00;
tv_sync_28_4__4_28[36]=0x00;
ets_memset(tv_sync_28_4__4_28+40, 0x00, 40);
tv_sync_28_4__4_28[43]=0xff;
tv_sync_28_4__4_28[42]=0xff;
tv_sync_28_4__4_28[41]=0xff;
tv_sync_28_4__4_28[40]=0xff;
tv_sync_28_4__4_28[47]=0xff;
ets_memset(tv_sync_28_4__4_28, 0xff, 32);
ets_memset(tv_sync_28_4__4_28+32-4, 0x00, 4);

ets_memset(tv_sync_28_4__4_28+32, 0x00, 32);
ets_memset(tv_sync_28_4__4_28+64-4, 0xff, 4);

// ðÁÔÔÅÒÎ 28-4, 28-4 ÍËÓ
ets_memset(tv_sync_28_4__28_4, 0xff, 80);
tv_sync_28_4__28_4[32]=0x00;
tv_sync_28_4__28_4[39]=0x00;
tv_sync_28_4__28_4[38]=0x00;
tv_sync_28_4__28_4[37]=0x00;
tv_sync_28_4__28_4[36]=0x00;
tv_sync_28_4__28_4[72]=0x00;
tv_sync_28_4__28_4[79]=0x00;
tv_sync_28_4__28_4[78]=0x00;
tv_sync_28_4__28_4[77]=0x00;
tv_sync_28_4__28_4[76]=0x00;
ets_memset(tv_sync_28_4__28_4, 0xff, 32);
ets_memset(tv_sync_28_4__28_4+32-4, 0x00, 4);
ets_memset(tv_sync_28_4__28_4+64-4, 0x00, 4);
}


Expand All @@ -179,6 +145,6 @@ void tv_start(void)
timer0_attachInterrupt(t0_int);

// úÁÐÕÓËÁÅÍ I2S
i2s_init(tv_i2s_cb, 80);
i2s_init(tv_i2s_cb, 64);
i2s_start();
}
2 changes: 1 addition & 1 deletion soft/EmuAPP/src/tv.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {
#endif


extern uint8_t tv_empty_line[80];
extern uint8_t tv_empty_line[64];


void tv_init(void);
Expand Down
5 changes: 2 additions & 3 deletions soft/EmuAPP/src/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ int8_t ui_select(uint8_t count)
if ( (c==KEY_LEFT) && (n > 0) )
{
// ÷ÌÅ×Ï
n-=20;
if (n < 0) n=0;
if (n > 20) n-=20; else n=0;
break;
} else
if ( (c==KEY_RIGHT) && (n < count-1) )
Expand Down Expand Up @@ -252,7 +251,7 @@ void ui_start(void)
screen.screen_h=38;
screen.char_h=8;
screen.cursor_x=0;
screen.cursor_y=0;
screen.cursor_y=99;
screen.cursor_type=0;
screen.vram=(uint8_t*)ui_scr;
screen.overlay_timer=0;
Expand Down
Loading

0 comments on commit 47ef9a4

Please sign in to comment.