bug fix,tested on real uConsole

This commit is contained in:
cuu 2023-04-01 19:38:26 +13:00
parent 24dd0c6a8a
commit 396c913f96
3 changed files with 21 additions and 12 deletions

View File

@ -6,7 +6,7 @@
#include <USBComposite.h>
#define SER_NUM_STR "20210531"
#define SER_NUM_STR "20230307"
USBHID HID;
DEVTERM dev_term;
@ -26,7 +26,7 @@ HardwareTimer ctrl_timer(4);
void setup() {
USBComposite.setManufacturerString("ClockworkPI");
USBComposite.setProductString("DevTerm");
USBComposite.setProductString("uConsole");
USBComposite.setSerialString(SER_NUM_STR);
dev_term.Keyboard = new HIDKeyboard(HID);
@ -79,11 +79,12 @@ void setup() {
timer.setPeriod(KEYBOARD_LED_PWM_PERIOD);
timer.resume();
/*
ctrl_timer.setPeriod(20*1000);
ctrl_timer.attachInterrupt(1,ctrl_timer_handler);
ctrl_timer.refresh();
ctrl_timer.resume();
*/
pinMode(PA8,PWM);
pwmWrite(PA8,0);

View File

@ -227,6 +227,13 @@ void keyboard_action(DEVTERM*dv,uint8_t row,uint8_t col,uint8_t mode) {
dv->Consumer->release();
}
}break;
case _VOLUME_MUTE:{
if(mode == KEY_PRESSED) {
dv->Consumer->press(HIDConsumer::MUTE);
}else {
dv->Consumer->release();
}
}break;
case _FN_LOCK_KEYBOARD:{
if(mode == KEY_PRESSED) {
dv->Keyboard_state.lock = dv->Keyboard_state.lock ^ 1;
@ -235,8 +242,7 @@ void keyboard_action(DEVTERM*dv,uint8_t row,uint8_t col,uint8_t mode) {
case _FN_LIGHT_KEYBOARD: {
//dv->_Serial->println("light keyboard");
if(mode == KEY_PRESSED) {
dv->Keyboard_state.backlight = ( dv->Keyboard_state.backlight + 1) % 4;
dv->Keyboard_state.backlight = dv->Keyboard_state.backlight % 4;
pwmWrite(PA8,backlight[ dv->Keyboard_state.backlight ] );
if(backlight[ dv->Keyboard_state.backlight ]== 0){
timer.pause();
@ -244,6 +250,7 @@ void keyboard_action(DEVTERM*dv,uint8_t row,uint8_t col,uint8_t mode) {
timer.resume();
}
//dv->_Serial->println("light keyboard");
dv->Keyboard_state.backlight ++;
}
}break;
case _FN_KEY:
@ -281,12 +288,12 @@ void keyboard_action(DEVTERM*dv,uint8_t row,uint8_t col,uint8_t mode) {
}
break;
}
/*
press_any_key_to_release_lock(dv,&dv->Keyboard_state.ctrl,k,mode);
press_any_key_to_release_lock(dv,&dv->Keyboard_state.alt,k,mode);
press_any_key_to_release_lock(dv,&dv->Keyboard_state.shift,k,mode);
press_any_key_to_release_lock(dv,&dv->Keyboard_state.fn,k,mode);
*/
}
@ -516,9 +523,10 @@ void keypad_action(DEVTERM*dv,uint8_t col,uint8_t mode) {
default:break;
}
/*
press_any_key_to_release_lock(dv,&dv->Keyboard_state.ctrl,k,mode);
press_any_key_to_release_lock(dv,&dv->Keyboard_state.alt,k,mode);
press_any_key_to_release_lock(dv,&dv->Keyboard_state.shift,k,mode);
press_any_key_to_release_lock(dv,&dv->Keyboard_state.fn,k,mode);
*/
}

View File

@ -12,10 +12,10 @@
#define EXPONENTIAL_BASE 1.2
*/
#define RIGHT_PIN HO3
#define LEFT_PIN HO1
#define DOWN_PIN HO4
#define UP_PIN HO2
#define RIGHT_PIN HO2
#define LEFT_PIN HO4
#define DOWN_PIN HO3
#define UP_PIN HO1
void trackball_init(DEVTERM*);