add further boilerplate, missing functions for usb console

This commit is contained in:
true 2024-11-06 22:19:03 -08:00
parent 7beb6b8ac5
commit 5cd5005ae3
5 changed files with 21 additions and 14 deletions

View File

@ -1,8 +1,5 @@
/* /*
* cons_about.h * about.h
*
* Created on: Nov 6, 2024
* Author: true
*/ */
#ifndef USER_SHELL_COMMANDS_ABOUT_H_ #ifndef USER_SHELL_COMMANDS_ABOUT_H_

View File

@ -1,8 +1,5 @@
/* /*
* cons_cls.h * cls.h
*
* Created on: Nov 6, 2024
* Author: true
*/ */
#ifndef USER_SHELL_COMMANDS_CLS_H_ #ifndef USER_SHELL_COMMANDS_CLS_H_

View File

@ -1,8 +1,5 @@
/* /*
* cons_help.h * help.h
*
* Created on: Nov 6, 2024
* Author: true
*/ */
#ifndef USER_SHELL_COMMANDS_HELP_H_ #ifndef USER_SHELL_COMMANDS_HELP_H_
@ -48,7 +45,7 @@ void cons_help_real(int argc, char **argv, command_table_t *p)
} }
// looks like the command wasn't found // looks like the command wasn't found
strcpy( console_line, "* no help found for command called '"); strcpy( console_line, "* no help found for '");
strncat(console_line, argv[1], 60); strncat(console_line, argv[1], 60);
strncat(console_line, "'\r\n", 62); strncat(console_line, "'\r\n", 62);
CONS_PRINT(console_line); CONS_PRINT(console_line);

View File

@ -35,6 +35,8 @@
#include "usb_lib.h" #include "usb_lib.h"
#include "console/console.h" #include "console/console.h"
#include "../usblib/config/usb_pwr.h"
void btn_top_push_cb(uint8_t idx) void btn_top_push_cb(uint8_t idx)
@ -195,12 +197,15 @@ int main(void)
USB_Init(); USB_Init();
usb_intr_init(); usb_intr_init();
// then initialize shell
console_set_gets(0);
console_set_puts(0);
console_init(); console_init();
// let's do this // let's do this
while (1) { while (1) {
// todo: add check to see if USB is connected // todo: add check to see if USB is connected
if (1) { if (bDeviceState == CONFIGURED) {
console_process(); console_process();
} else { } else {
console_stop(); console_stop();

View File

@ -345,3 +345,14 @@ void CDC_DataRx_Process( void )
} }
} }
} }
__attribute__((interrupt("WCH-Interrupt-fast")))
void TIM4_IRQHandler(void)
{
// uart timeout counts
Cdc.Rx_TimeOut++;
Cdc.USB_Up_TimeOut++;
// clear status
TIM4->INTFR = (uint16_t)~TIM_IT_Update;
}