@ -49,7 +49,7 @@ static void playKeyCode(Key key, uint8_t keyStates, bool explicit_report) {
static void readKeyCodeAndPlay ( uint16_t pos , uint8_t flags , uint8_t keyStates , bool explicit_report ) {
static void readKeyCodeAndPlay ( uint16_t pos , uint8_t flags , uint8_t keyStates , bool explicit_report ) {
Key key ;
Key key ;
key . flags = flags ;
key . flags = flags ;
key . keyCode = EEPROM . read ( pos + + ) ;
key . keyCode = KeyboardHardware. storage ( ) . read ( pos + + ) ;
playKeyCode ( key , keyStates , explicit_report ) ;
playKeyCode ( key , keyStates , explicit_report ) ;
}
}
@ -63,7 +63,7 @@ void DynamicMacros::updateDynamicMacroCache(void) {
map_ [ 0 ] = 0 ;
map_ [ 0 ] = 0 ;
while ( pos < storage_base_ + storage_size_ ) {
while ( pos < storage_base_ + storage_size_ ) {
macro = EEPROM . read ( pos + + ) ;
macro = KeyboardHardware. storage ( ) . read ( pos + + ) ;
switch ( macro ) {
switch ( macro ) {
case MACRO_ACTION_STEP_EXPLICIT_REPORT :
case MACRO_ACTION_STEP_EXPLICIT_REPORT :
case MACRO_ACTION_STEP_IMPLICIT_REPORT :
case MACRO_ACTION_STEP_IMPLICIT_REPORT :
@ -91,8 +91,8 @@ void DynamicMacros::updateDynamicMacroCache(void) {
previous_macro_ended = false ;
previous_macro_ended = false ;
uint8_t keyCode , flags ;
uint8_t keyCode , flags ;
do {
do {
flags = EEPROM . read ( pos + + ) ;
flags = KeyboardHardware. storage ( ) . read ( pos + + ) ;
keyCode = EEPROM . read ( pos + + ) ;
keyCode = KeyboardHardware. storage ( ) . read ( pos + + ) ;
} while ( ! ( flags = = 0 & & keyCode = = 0 ) ) ;
} while ( ! ( flags = = 0 & & keyCode = = 0 ) ) ;
break ;
break ;
}
}
@ -101,7 +101,7 @@ void DynamicMacros::updateDynamicMacroCache(void) {
previous_macro_ended = false ;
previous_macro_ended = false ;
uint8_t keyCode , flags ;
uint8_t keyCode , flags ;
do {
do {
keyCode = EEPROM . read ( pos + + ) ;
keyCode = KeyboardHardware. storage ( ) . read ( pos + + ) ;
} while ( keyCode ! = 0 ) ;
} while ( keyCode ! = 0 ) ;
break ;
break ;
}
}
@ -128,7 +128,7 @@ void DynamicMacros::play(uint8_t macro_id) {
pos = storage_base_ + map_ [ macro_id ] ;
pos = storage_base_ + map_ [ macro_id ] ;
while ( true ) {
while ( true ) {
switch ( macro = EEPROM . read ( pos + + ) ) {
switch ( macro = KeyboardHardware. storage ( ) . read ( pos + + ) ) {
case MACRO_ACTION_STEP_EXPLICIT_REPORT :
case MACRO_ACTION_STEP_EXPLICIT_REPORT :
explicit_report = true ;
explicit_report = true ;
break ;
break ;
@ -140,23 +140,23 @@ void DynamicMacros::play(uint8_t macro_id) {
kaleidoscope : : hid : : sendMouseReport ( ) ;
kaleidoscope : : hid : : sendMouseReport ( ) ;
break ;
break ;
case MACRO_ACTION_STEP_INTERVAL :
case MACRO_ACTION_STEP_INTERVAL :
interval = EEPROM . read ( pos + + ) ;
interval = KeyboardHardware. storage ( ) . read ( pos + + ) ;
break ;
break ;
case MACRO_ACTION_STEP_WAIT : {
case MACRO_ACTION_STEP_WAIT : {
uint8_t wait = EEPROM . read ( pos + + ) ;
uint8_t wait = KeyboardHardware. storage ( ) . read ( pos + + ) ;
delay ( wait ) ;
delay ( wait ) ;
break ;
break ;
}
}
case MACRO_ACTION_STEP_KEYDOWN :
case MACRO_ACTION_STEP_KEYDOWN :
flags = EEPROM . read ( pos + + ) ;
flags = KeyboardHardware. storage ( ) . read ( pos + + ) ;
readKeyCodeAndPlay ( pos + + , flags , IS_PRESSED , explicit_report ) ;
readKeyCodeAndPlay ( pos + + , flags , IS_PRESSED , explicit_report ) ;
break ;
break ;
case MACRO_ACTION_STEP_KEYUP :
case MACRO_ACTION_STEP_KEYUP :
flags = EEPROM . read ( pos + + ) ;
flags = KeyboardHardware. storage ( ) . read ( pos + + ) ;
readKeyCodeAndPlay ( pos + + , flags , WAS_PRESSED , explicit_report ) ;
readKeyCodeAndPlay ( pos + + , flags , WAS_PRESSED , explicit_report ) ;
break ;
break ;
case MACRO_ACTION_STEP_TAP :
case MACRO_ACTION_STEP_TAP :
flags = EEPROM . read ( pos + + ) ;
flags = KeyboardHardware. storage ( ) . read ( pos + + ) ;
readKeyCodeAndPlay ( pos + + , flags , IS_PRESSED | WAS_PRESSED , false ) ;
readKeyCodeAndPlay ( pos + + , flags , IS_PRESSED | WAS_PRESSED , false ) ;
break ;
break ;
@ -173,8 +173,8 @@ void DynamicMacros::play(uint8_t macro_id) {
case MACRO_ACTION_STEP_TAP_SEQUENCE : {
case MACRO_ACTION_STEP_TAP_SEQUENCE : {
uint8_t keyCode ;
uint8_t keyCode ;
do {
do {
flags = EEPROM . read ( pos + + ) ;
flags = KeyboardHardware. storage ( ) . read ( pos + + ) ;
keyCode = EEPROM . read ( pos + + ) ;
keyCode = KeyboardHardware. storage ( ) . read ( pos + + ) ;
playKeyCode ( Key ( keyCode , flags ) , IS_PRESSED | WAS_PRESSED , false ) ;
playKeyCode ( Key ( keyCode , flags ) , IS_PRESSED | WAS_PRESSED , false ) ;
delay ( interval ) ;
delay ( interval ) ;
} while ( ! ( flags = = 0 & & keyCode = = 0 ) ) ;
} while ( ! ( flags = = 0 & & keyCode = = 0 ) ) ;
@ -183,7 +183,7 @@ void DynamicMacros::play(uint8_t macro_id) {
case MACRO_ACTION_STEP_TAP_CODE_SEQUENCE : {
case MACRO_ACTION_STEP_TAP_CODE_SEQUENCE : {
uint8_t keyCode ;
uint8_t keyCode ;
do {
do {
keyCode = EEPROM . read ( pos + + ) ;
keyCode = KeyboardHardware. storage ( ) . read ( pos + + ) ;
playKeyCode ( Key ( keyCode , 0 ) , IS_PRESSED | WAS_PRESSED , false ) ;
playKeyCode ( Key ( keyCode , 0 ) , IS_PRESSED | WAS_PRESSED , false ) ;
delay ( interval ) ;
delay ( interval ) ;
} while ( keyCode ! = 0 ) ;
} while ( keyCode ! = 0 ) ;
@ -221,7 +221,7 @@ EventHandlerResult DynamicMacros::onFocusEvent(const char *command) {
if ( : : Focus . isEOL ( ) ) {
if ( : : Focus . isEOL ( ) ) {
for ( uint16_t i = 0 ; i < storage_size_ ; i + + ) {
for ( uint16_t i = 0 ; i < storage_size_ ; i + + ) {
uint8_t b ;
uint8_t b ;
b = EEPROM . read ( storage_base_ + i ) ;
b = KeyboardHardware. storage ( ) . read ( storage_base_ + i ) ;
: : Focus . send ( b ) ;
: : Focus . send ( b ) ;
}
}
} else {
} else {
@ -231,7 +231,7 @@ EventHandlerResult DynamicMacros::onFocusEvent(const char *command) {
uint8_t b ;
uint8_t b ;
: : Focus . read ( b ) ;
: : Focus . read ( b ) ;
EEPROM . update ( storage_base_ + pos + + , b ) ;
KeyboardHardware. storage ( ) . update ( storage_base_ + pos + + , b ) ;
}
}
updateDynamicMacroCache ( ) ;
updateDynamicMacroCache ( ) ;
}
}