an conditional for console in
This commit is contained in:
parent
f8d340a9dd
commit
426ace718b
5 changed files with 49 additions and 35 deletions
|
@ -44,6 +44,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define AUDIO_VOICES
|
#define AUDIO_VOICES
|
||||||
#define C6_AUDIO
|
#define C6_AUDIO
|
||||||
|
|
||||||
|
#define CONSOLE_IN_ENABLE
|
||||||
|
|
||||||
#define BACKLIGHT_PIN B7
|
#define BACKLIGHT_PIN B7
|
||||||
|
|
||||||
/* COL2ROW or ROW2COL */
|
/* COL2ROW or ROW2COL */
|
||||||
|
|
|
@ -1297,7 +1297,7 @@ void shutdown_user() {}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_IN_ENABLE
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
void process_console_data_user(uint8_t * data, uint8_t length) {
|
void process_console_data_user(uint8_t * data, uint8_t length) {
|
||||||
|
@ -1309,19 +1309,26 @@ void process_console_data_kb(uint8_t * data, uint8_t length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_console_data_quantum(uint8_t * data, uint8_t length) {
|
void process_console_data_quantum(uint8_t * data, uint8_t length) {
|
||||||
|
// This can be used for testing - it echos back the information received
|
||||||
// print("Received message:\n ");
|
// print("Received message:\n ");
|
||||||
// while (*data) {
|
// while (*data) {
|
||||||
// sendchar(*data);
|
// sendchar(*data);
|
||||||
// data++;
|
// data++;
|
||||||
// }
|
// }
|
||||||
switch (data[0]) {
|
switch (data[0]) {
|
||||||
case 0xFE:
|
|
||||||
print("Entering bootloader\n");
|
|
||||||
reset_keyboard();
|
|
||||||
break;
|
|
||||||
case 0x01:
|
case 0x01:
|
||||||
print("Saying hello\n");
|
print("Saying hello\n");
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
audio_on();
|
audio_on();
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 0xFE:
|
||||||
|
#ifdef CONSOLE_IN_BOOTLOADER
|
||||||
|
print("Entering bootloader\n");
|
||||||
|
reset_keyboard();
|
||||||
|
#else
|
||||||
|
print("Unable to enter bootloader\n");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
process_console_data_kb(data, length);
|
process_console_data_kb(data, length);
|
||||||
|
|
|
@ -193,7 +193,7 @@ void led_set_kb(uint8_t usb_led);
|
||||||
|
|
||||||
void api_send_unicode(uint32_t unicode);
|
void api_send_unicode(uint32_t unicode);
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_IN_ENABLE
|
||||||
void process_console_data_user(uint8_t * data, uint8_t length);
|
void process_console_data_user(uint8_t * data, uint8_t length);
|
||||||
void process_console_data_kb(uint8_t * data, uint8_t length);
|
void process_console_data_kb(uint8_t * data, uint8_t length);
|
||||||
void process_console_data_quantum(uint8_t * data, uint8_t length);
|
void process_console_data_quantum(uint8_t * data, uint8_t length);
|
||||||
|
|
|
@ -208,8 +208,11 @@ typedef struct
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_ENABLE
|
||||||
# define CONSOLE_IN_EPNUM (RAW_OUT_EPNUM + 1)
|
# define CONSOLE_IN_EPNUM (RAW_OUT_EPNUM + 1)
|
||||||
|
# ifdef CONSOLE_IN_ENABLE
|
||||||
# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 2)
|
# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 2)
|
||||||
//# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 1)
|
# else
|
||||||
|
# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 1)
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# define CONSOLE_OUT_EPNUM RAW_OUT_EPNUM
|
# define CONSOLE_OUT_EPNUM RAW_OUT_EPNUM
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -274,16 +274,16 @@ static bool console_flush = false;
|
||||||
|
|
||||||
static void Console_Task(void)
|
static void Console_Task(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Device must be connected and configured for the task to run */
|
/* Device must be connected and configured for the task to run */
|
||||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
uint8_t ep = Endpoint_GetCurrentEndpoint();
|
||||||
|
|
||||||
|
#ifdef CONSOLE_IN_ENABLE
|
||||||
/* Create a temporary buffer to hold the read in report from the host */
|
/* Create a temporary buffer to hold the read in report from the host */
|
||||||
uint8_t ConsoleData[CONSOLE_EPSIZE];
|
uint8_t ConsoleData[CONSOLE_EPSIZE];
|
||||||
bool data_read = false;
|
bool data_read = false;
|
||||||
uint8_t ep = Endpoint_GetCurrentEndpoint();
|
|
||||||
|
|
||||||
// TODO: impl receivechar()/recvchar()
|
// TODO: impl receivechar()/recvchar()
|
||||||
Endpoint_SelectEndpoint(CONSOLE_OUT_EPNUM);
|
Endpoint_SelectEndpoint(CONSOLE_OUT_EPNUM);
|
||||||
|
@ -310,6 +310,8 @@ static void Console_Task(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if (console_flush) {
|
if (console_flush) {
|
||||||
/* IN packet */
|
/* IN packet */
|
||||||
Endpoint_SelectEndpoint(CONSOLE_IN_EPNUM);
|
Endpoint_SelectEndpoint(CONSOLE_IN_EPNUM);
|
||||||
|
@ -454,10 +456,10 @@ void EVENT_USB_Device_ConfigurationChanged(void)
|
||||||
/* Setup Console HID Report Endpoints */
|
/* Setup Console HID Report Endpoints */
|
||||||
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
||||||
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
|
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||||
// #if 0
|
#ifdef CONSOLE_IN_ENABLE
|
||||||
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
|
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
|
||||||
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
|
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||||
// #endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_ENABLE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue