Skip to content

Commit

Permalink
USB command to wake-up device, fix #293
Browse files Browse the repository at this point in the history
  • Loading branch information
limpkin committed Mar 29, 2022
1 parent 5f689a0 commit d8a13d7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions source_code/main_mcu/src/COMMS/comms_hid_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
#define HID_CMD_DELETE_NOTE_ID 0x003C
#define HID_CMD_PREPARE_SN_FLASH 0x003D
#define HID_CMD_SET_CUR_CATEGORY 0x003E
#define HID_CMD_WAKE_UP_DEVICE 0x003F
// Below: commands requiring MMM
#define HID_CMD_GET_START_PARENTS 0x0100
#define HID_CMD_END_MMM 0x0101
Expand Down
8 changes: 8 additions & 0 deletions source_code/main_mcu/src/COMMS/comms_hid_msgs.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,14 @@ void comms_hid_msgs_parse(hid_message_t* rcv_msg, uint16_t supposed_payload_leng
comms_hid_msgs_send_ack_nack_message(is_message_from_usb, rcv_message_type, TRUE);
return;
}

case HID_CMD_WAKE_UP_DEVICE:
{
/* Wake up the device */
main_create_virtual_wheel_movement();
comms_hid_msgs_send_ack_nack_message(is_message_from_usb, rcv_message_type, TRUE);
return;
}

case HID_CMD_NIMH_RECONDITION:
{
Expand Down
2 changes: 1 addition & 1 deletion source_code/main_mcu/src/FILESYSTEM/custom_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const uint8_t custom_fs_default_device_settings[NB_DEVICE_SETTINGS] = { 0,
60, // SETTINGS_DELAY_BEF_UNLOCK_LOGIN
FALSE, // SETTINGS_SWITCH_OFF_AFTER_BT_DISC
FALSE, // SETTINGS_MC_SUBDOMAIN_FORCE_STATUS
TRUE}; // SETTINGS_FAV_LAST_USED_SORTED
FALSE}; // SETTINGS_FAV_LAST_USED_SORTED
#ifndef EMULATOR_BUILD
/* Pointer to the platform unique data, stored at the last page of our bootloader */
platform_unique_data_t* custom_fs_plat_data_ptr = (platform_unique_data_t*)(FLASH_ADDR + APP_START_ADDR - NVMCTRL_ROW_SIZE);
Expand Down
8 changes: 8 additions & 0 deletions source_code/main_mcu/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ void jump_to_application_function(void)
}
#endif

/*! \fn main_create_virtual_wheel_movement(void)
* \brief Create virtual wheel movement
*/
void main_create_virtual_wheel_movement(void)
{
virtual_wheel_action = WHEEL_ACTION_VIRTUAL;
}

/*! \fn main_platform_init(void)
* \brief Initialize our platform
*/
Expand Down
1 change: 1 addition & 0 deletions source_code/main_mcu/src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@


/* Prototypes */
void main_create_virtual_wheel_movement(void);
uint32_t main_check_stack_usage(void);
void main_init_stack_tracking(void);
void main_platform_init(void);
Expand Down
1 change: 1 addition & 0 deletions source_code/main_mcu/src/platform_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
- setting: sort favorites by last used date
- setting: switch off after BLE disconnect
- USB command to select current category
- USB command to wake-up device
*/

/**************** SETUP DEFINES ****************/
Expand Down

0 comments on commit d8a13d7

Please sign in to comment.