Skip to content

Commit

Permalink
small non-functional improvements on CAPS LOCK handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Oliver Moll committed Jul 13, 2020
1 parent f3b1c7f commit 5c58327
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
22 changes: 22 additions & 0 deletions Build_CDTV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Build Configuration For CDTV
============================

Pins On Arduino
---------------

Pin | Signal | Note
----|--------|-------------------
2 | KBCLK |
3 | KBDAT | may not be changed
6 | PRDT |

Pull these signals through a level shifter, LV on Arduino side, HV on CDTV
side. Connect +5V from both ports to RAW on the Arduino Pro Mini and HV on
the level shifter. LV of the level shifter is connected to 3.3V (VCC) on the
Arduino. GND should be connected to both CDTV ports, GND on both sides of
the level shifter and GND on the Arduino. This way the converter works also
when only one port is connected for that port.

Pins On CDTV
------------
![CDTV connectors](images/cdtv_kb_mouse.png)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ approach is intended (but not yet implemented.)


System | Keyboard | Mouse | Joystick | Note
-------|------------|----------|----------|--------------------------------
-------|------------|----------|----------|---------------------------------
CDTV | working | working | untested | primay development target
CD32 | untested | planning | planning | soon to come
A500 | untested | planning | planning | keyboard will require soldering
A500 | untested | planning | planning | reset handling different
A600 | won't work | planning | planning | different keyboard handling
A1000 | untested | planning | planning | no system available for testing
A1200 | won't work | planning | planning | different keyboard handling
Expand Down
2 changes: 1 addition & 1 deletion USB2Amiga/USB2Amiga.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "USB_Keyboard.hpp"

USB Usb;
USBHub Hub(&Usb);
//USBHub Hub(&Usb);

HIDBoot<USB_HID_PROTOCOL_KEYBOARD | USB_HID_PROTOCOL_MOUSE> HidComposite(&Usb);
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
Expand Down
16 changes: 9 additions & 7 deletions USB2Amiga/USB_Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ static inline void amigakey( uint8_t code, bool pressed )

KbdRptParser::KbdRptParser()
: KeyboardReportParser()
, mCapsLock( false )
, mReset( false )
{
}
Expand Down Expand Up @@ -98,7 +97,7 @@ void KbdRptParser::OnControlKeysChanged(uint8_t before, uint8_t after)
{
mReset = false;
#if DEBUG
Serial.println( "Sending hard reset" );
Serial.println( "Sending hard reset" );
#endif
amikbd_kReset();
}
Expand Down Expand Up @@ -133,11 +132,14 @@ void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key)
PrintHex<uint8_t>( mod, 0x80 );
Serial.println( "" );
#endif
if( key == 0x39 )
if( key == UHS_HID_BOOT_KEY_CAPS_LOCK )
{
/* CAPS LOCK */
mCapsLock = !mCapsLock;
if( !mCapsLock )
#if DEBUG
Serial.print( "CAPS LOCK: " );
Serial.println( kbdLockingKeys.kbdLeds.bmCapsLock );
#endif
if( !kbdLockingKeys.kbdLeds.bmCapsLock )
{
return;
}
Expand Down Expand Up @@ -166,10 +168,10 @@ void KbdRptParser::OnKeyUp(uint8_t mod, uint8_t key)
PrintHex<uint8_t>( mod, 0x80 );
Serial.println( "" );
#endif
if( key == 0x39 )
if( key == UHS_HID_BOOT_KEY_CAPS_LOCK )
{
/* CAPS LOCK */
if( mCapsLock )
if( kbdLockingKeys.kbdLeds.bmCapsLock )
{
return;
}
Expand Down
1 change: 0 additions & 1 deletion USB2Amiga/USB_Keyboard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class KbdRptParser : public KeyboardReportParser
void OnKeyDown( uint8_t mod, uint8_t key );
void OnKeyUp( uint8_t mod, uint8_t key );
private:
bool mCapsLock;
bool mReset;
};
extern KbdRptParser KbdPrs;
Expand Down
1 change: 1 addition & 0 deletions USB2Amiga/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define USE_AMIGA_KEYBOARD (1)
#define USE_CDTV_MOUSE_JOY (1)
#define USE_AMIGA_MOUSE (0)
#define USE_A500_RESET (0)

#define DEBUG (0)

Expand Down
2 changes: 0 additions & 2 deletions USB2Amiga/keycodes_amiga.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ extern "C" {
* PgUp -> KP ([
* PgDn -> KP )]
* Num Lock
*
* Amiga-Amiga-Ctrl keycode?
*/

uint8_t usb2amiga[0x80] =
Expand Down

0 comments on commit 5c58327

Please sign in to comment.