Skip to content

Commit

Permalink
Add io_seproxyhal_enable_io() function
Browse files Browse the repository at this point in the history
`io_seproxyhal_enable_io()` and `io_seproxyhal_disable_io()` allow to
turn on and off USB connection.
  • Loading branch information
abonnaudet-ledger committed Oct 13, 2023
1 parent 54bf657 commit b5d0e38
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/os_io_seproxyhal.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ void io_seproxyhal_setup_ticker(unsigned int interval_ms);
void io_seproxyhal_power_off(bool criticalBattery);
void io_seproxyhal_se_reset(void);
void io_seproxyhal_disable_io(void);
void io_seproxyhal_enable_io(void);

#ifdef HAVE_PIEZO_SOUND
typedef enum tune_index_e {
Expand Down
14 changes: 14 additions & 0 deletions src/os_io_seproxyhal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,12 +1111,26 @@ static const unsigned char seph_io_usb_disconnect[] = {
1,
SEPROXYHAL_TAG_USB_CONFIG_DISCONNECT,
};

void io_seproxyhal_disable_io(void)
{
// usb off
io_seproxyhal_spi_send(seph_io_usb_disconnect, sizeof(seph_io_usb_disconnect));
}

static const unsigned char seph_io_usb_connect[] = {
SEPROXYHAL_TAG_USB_CONFIG,
0,
1,
SEPROXYHAL_TAG_USB_CONFIG_CONNECT,
};

void io_seproxyhal_enable_io(void)
{
// usb on
io_seproxyhal_spi_send(seph_io_usb_connect, sizeof(seph_io_usb_connect));
}

void io_seproxyhal_backlight(unsigned int flags, unsigned int backlight_percentage)
{
G_io_seproxyhal_spi_buffer[0] = SEPROXYHAL_TAG_SET_SCREEN_CONFIG;
Expand Down

0 comments on commit b5d0e38

Please sign in to comment.