Expose variables via USB

This commit is contained in:
Eric Tang
2018-07-19 21:11:02 -07:00
parent 1bced1be13
commit 63d82d92db
6 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#include "usb_protocol_handler.h"
#include "usb_commands/usb_command_get_variable.h"
#include "key_matrix.h"
void UsbCommand_GetVariable(void)
{
usb_variable_id_t variableId = GetUsbRxBufferUint8(1);
switch (variableId) {
case UsbVariable_TestMode:
break;
case UsbVariable_TestUsbStack:
break;
case UsbVariable_DebounceTimePress:
SetUsbTxBufferUint8(1, DebounceTimePress);
break;
case UsbVariable_DebounceTimeRelease:
SetUsbTxBufferUint8(1, DebounceTimeRelease);
break;
}
}

View File

@@ -0,0 +1,8 @@
#ifndef __USB_COMMAND_GET_VARIABLE_H__
#define __USB_COMMAND_GET_VARIABLE_H__
// Functions:
void UsbCommand_GetVariable(void);
#endif

View File

@@ -0,0 +1,21 @@
#include "usb_protocol_handler.h"
#include "usb_commands/usb_command_set_variable.h"
#include "key_matrix.h"
void UsbCommand_SetVariable(void)
{
usb_variable_id_t variableId = GetUsbRxBufferUint8(1);
switch (variableId) {
case UsbVariable_TestMode:
break;
case UsbVariable_TestUsbStack:
break;
case UsbVariable_DebounceTimePress:
DebounceTimePress = GetUsbRxBufferUint8(2);
break;
case UsbVariable_DebounceTimeRelease:
DebounceTimeRelease = GetUsbRxBufferUint8(2);
break;
}
}

View File

@@ -0,0 +1,8 @@
#ifndef __USB_COMMAND_SET_VARIABLE_H__
#define __USB_COMMAND_SET_VARIABLE_H__
// Functions:
void UsbCommand_SetVariable(void);
#endif