1
0
mirror of https://github.com/mist-devel/mist-firmware.git synced 2026-04-29 21:37:45 +00:00

[Firmware] Minor bug fixes

This commit is contained in:
Till Harbaum
2015-08-25 14:32:27 +02:00
parent 101538fe4b
commit 12f678c8ec
5 changed files with 46 additions and 23 deletions

3
menu.c
View File

@@ -2631,6 +2631,9 @@ void HandleUI(void)
fpga_init(file.name);
// make sure new config gets current button/dip status
user_io_send_buttons(1);
menustate = MENU_NONE1;
break;

7
readme.md Normal file
View File

@@ -0,0 +1,7 @@
MIST Firmware source code
=========================
This is the source code of the MIST firmware. Binaries can be found
in the [mist-binaries repository](https://github.com/mist-devel/mist-binaries/tree/master/firmware).
For instructions how to compile this see the [wiki](https://github.com/mist-devel/mist-board/wiki/HowToCompileTheFirmware).

View File

@@ -3,6 +3,7 @@
//
// driver for the pl2303 usb to serial converter
//
// https://github.com/felis/USB_Host_Shield_2.0/blob/master/cdcprolific.cpp
// https://github.com/felis/USB_Host_Shield_2.0
// http://lxr.free-electrons.com/source/drivers/usb/serial/pl2303.c

View File

@@ -124,7 +124,6 @@ static void PollAdc() {
}
void user_io_init() {
// no sd card image selected, SD card accesses will go directly
// to the card
sd_image.size = 0;
@@ -453,7 +452,7 @@ static long kbd_timer = 0;
static void kbd_fifo_minimig_send(unsigned short code) {
spi_uio_cmd8((code&OSD)?UIO_KBD_OSD:UIO_KEYBOARD, code & 0xff);
kbd_timer = GetTimer(10); // next key after 10ms earliest
kbd_timer = GetTimer(50); // next key after 50ms earliest
}
static void kbd_fifo_enqueue(unsigned short code) {
@@ -616,6 +615,31 @@ unsigned char user_io_8bit_set_status(unsigned char new_status, unsigned char ma
return status;
}
void user_io_send_buttons(char force) {
static unsigned char key_map = 0;
// frequently poll the adc the switches
// and buttons are connected to
PollAdc();
unsigned char map = 0;
if(adc_state & 1) map |= SWITCH2;
if(adc_state & 2) map |= SWITCH1;
if(adc_state & 4) map |= BUTTON1;
if(adc_state & 8) map |= BUTTON2;
// TODO adding conf here
if (mist_cfg.scandoubler_disable)
map |= CONF_SCANDOUBLER_DISABLE;
if((map != key_map) || force) {
key_map = map;
spi_uio_cmd8(UIO_BUT_SW, map);
iprintf("sending keymap\n");
}
}
void user_io_poll() {
if(user_io_dip_switch1()) {
@@ -740,26 +764,7 @@ void user_io_poll() {
user_io_joystick(joystick_renumber(1), joy_map);
}
// frequently poll the adc the switches
// and buttons are connected to
PollAdc();
static unsigned char key_map = 0;
unsigned char map = 0;
if(adc_state & 1) map |= SWITCH2;
if(adc_state & 2) map |= SWITCH1;
if(adc_state & 4) map |= BUTTON1;
if(adc_state & 8) map |= BUTTON2;
// TODO adding conf here
if (mist_cfg.scandoubler_disable) map |= CONF_SCANDOUBLER_DISABLE;
if(map != key_map) {
key_map = map;
spi_uio_cmd8(UIO_BUT_SW, map);
}
user_io_send_buttons(0);
// mouse movement emulation is continous
if(emu_mode == EMU_MOUSE) {
@@ -928,7 +933,13 @@ void user_io_poll() {
// ... and write it to disk
DISKLED_ON;
MMC_Write(lba, wr_buf);
if(sd_image.size) {
FileSeek(&sd_image, lba, SEEK_SET);
FileWrite(&sd_image, wr_buf);
} else
MMC_Write(lba, wr_buf);
DISKLED_OFF;
}
}

View File

@@ -157,6 +157,7 @@ char user_io_create_config_name(char *s);
void user_io_digital_joystick(unsigned char, unsigned char);
void user_io_analog_joystick(unsigned char, char, char);
char user_io_osd_is_visible();
void user_io_send_buttons(char);
void user_io_key_remap(char *);