forked from TeamTofuShop/segatools
add default port fallback for vfd
This commit is contained in:
11
board/vfd.c
11
board/vfd.c
@ -50,7 +50,7 @@ HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer
|
||||
|
||||
static bool utf_enabled;
|
||||
|
||||
HRESULT vfd_hook_init(struct vfd_config *cfg)
|
||||
HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port)
|
||||
{
|
||||
if (!cfg->enable){
|
||||
return S_FALSE;
|
||||
@ -58,8 +58,13 @@ HRESULT vfd_hook_init(struct vfd_config *cfg)
|
||||
|
||||
utf_enabled = cfg->utf_conversion;
|
||||
|
||||
dprintf("VFD: enabling (port=%d)\n", cfg->port);
|
||||
uart_init(&vfd_uart, cfg->port);
|
||||
int port = cfg->port;
|
||||
if (port == 0){
|
||||
port = default_port;
|
||||
}
|
||||
|
||||
dprintf("VFD: enabling (port=%d)\n", port);
|
||||
uart_init(&vfd_uart, port);
|
||||
vfd_uart.written.bytes = vfd_written;
|
||||
vfd_uart.written.nbytes = sizeof(vfd_written);
|
||||
vfd_uart.readable.bytes = vfd_readable;
|
||||
|
@ -9,5 +9,5 @@ struct vfd_config {
|
||||
};
|
||||
|
||||
|
||||
HRESULT vfd_hook_init(struct vfd_config *cfg);
|
||||
HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port);
|
||||
|
||||
|
Reference in New Issue
Block a user