Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
17/05/2018
clockworkpi_keypad.ino uploaded to https://github.com/clockworkpi/Keypad.
CLOCKWORK Keypad Arduino driver

01/08/2018
Changelog created.
Added a debug flag to turn on/off keypress serial printing.
Intended for checking if the Keypad Board is working.

14/04/2020
Added a INVERT_AB flag to invert XYAB to ABXY easily.
Updated obdev v-usb lib to the latest eg. USBDRV_VERSION 20090822 to 20121206.
Ported UsbKeyboard to the latest v-usb.
Fixed the incorect not on the timer (from ! to bitwise ~)
33 changes: 33 additions & 0 deletions UsbKeyboard/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,36 @@ Scroll down to the bottom to see the most recent changes.
USB 1.1 (in particular bit 7, it is a must-be-set bit now).

* Release 2009-08-22

- Moved first DBG1() after odDebugInit() in all examples.
- Use vector INT0_vect instead of SIG_INTERRUPT0 if defined. This makes
V-USB compatible with the new "p" suffix devices (e.g. ATMega328p).
- USB_CFG_CLOCK_KHZ setting is now required in usbconfig.h (no default any
more).
- New option USB_CFG_DRIVER_FLASH_PAGE allows boot loaders on devices with
more than 64 kB flash.
- Built-in configuration descriptor allows custom definition for second
endpoint now.

* Release 2010-07-15

- Fixed bug in usbDriverSetup() which prevented descriptor sizes above 255
bytes.
- Avoid a compiler warning for unused parameter in usbHandleResetHook() when
compiler option -Wextra is enabled.
- Fixed wrong hex value for some IDs in USB-IDs-for-free.txt.
- Keep a define for USBATTR_BUSPOWER, although the flag does not exist
in USB 1.1 any more. Set it to 0. This is for backward compatibility.

* Release 2012-01-09

- Define a separate (defined) type for usbMsgPtr so that projects using a
tiny memory model can define it to an 8 bit type in usbconfig.h. This
change also saves a couple of bytes when using a scalar 16 bit type.
- Inserted "const" keyword for all PROGMEM declarations because new GCC
requires it.
- Fixed problem with dependence of usbportability.h on usbconfig.h. This
problem occurred with IAR CC only.
- Prepared repository for github.com.

* Release 2012-12-06
10 changes: 5 additions & 5 deletions UsbKeyboard/CommercialLicense.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
V-USB Driver Software License Agreement
Version 2009-08-03
Version 2012-07-09

THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN
ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING
Expand Down Expand Up @@ -37,10 +37,10 @@ Product ID(s), sent to you in e-mail. These Product IDs are reserved
exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID
ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen
Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from
Jason Kotzin (Clay Logic, www.claylogic.com). Both owners of the Vendor IDs
have obtained these IDs from the USB Implementers Forum, Inc.
(www.usb.org). OBJECTIVE DEVELOPMENT disclaims all liability which might
arise from the assignment of USB IDs.
Jason Kotzin (now flirc.tv, Inc.). Both owners of the Vendor IDs have
obtained these IDs from the USB Implementers Forum, Inc. (www.usb.org).
OBJECTIVE DEVELOPMENT disclaims all liability which might arise from the
assignment of USB IDs.

2.5 USB Certification. Although not part of this agreement, we want to make
it clear that you cannot become USB certified when you use V-USB or a USB
Expand Down
32 changes: 23 additions & 9 deletions UsbKeyboard/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ CPU CORE CLOCK FREQUENCY
========================
We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz,
16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The
actual clock rate must be configured in usbdrv.h unless you use the default
12 MHz.
actual clock rate must be configured in usbconfig.h.

12 MHz Clock
This is the traditional clock rate of V-USB because it's the lowest clock
Expand Down Expand Up @@ -114,13 +113,28 @@ IDs. See http://www.obdev.at/vusb/ for details.
DEVELOPMENT SYSTEM
==================
This driver has been developed and optimized for the GNU compiler version 3
(gcc 3). It does work well with gcc 4, but with bigger code size. We recommend
that you use the GNU compiler suite because it is freely available. V-USB
has also been ported to the IAR compiler and assembler. It has been tested
with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the "small" and "tiny"
memory model. Not every release is tested with IAR CC and the driver may
therefore fail to compile with IAR. Please note that gcc is more efficient for
usbdrv.c because this module has been deliberately optimized for gcc.
and 4. We recommend that you use the GNU compiler suite because it is freely
available. V-USB has also been ported to the IAR compiler and assembler. It
has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the
"small" and "tiny" memory model. Not every release is tested with IAR CC and
the driver may therefore fail to compile with IAR. Please note that gcc is
more efficient for usbdrv.c because this module has been deliberately
optimized for gcc.

Gcc version 3 produces smaller code than version 4 due to new optimizing
capabilities which don't always improve things on 8 bit CPUs. The code size
generated by gcc 4 can be reduced with the compiler options
-fno-move-loop-invariants, -fno-tree-scev-cprop and
-fno-inline-small-functions in addition to -Os. On devices with more than
8k of flash memory, we also recommend the linker option --relax (written as
-Wl,--relax for gcc) to convert absolute calls into relative where possible.

For more information about optimizing options see:

http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html

These optimizations are good for gcc 4.x. Version 3.x of gcc does not support
most of these options and produces good code anyway.


USING V-USB FOR FREE
Expand Down
6 changes: 3 additions & 3 deletions UsbKeyboard/USB-ID-FAQ.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version 2009-08-22
Version 2012-07-09

==========================
WHY DO WE NEED THESE IDs?
Expand Down Expand Up @@ -107,8 +107,8 @@ WHO IS THE OWNER OF THE VENDOR-ID?
Objective Development has obtained ranges of USB Product-IDs under two
Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen
Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason
Kotzin (Clay Logic, www.claylogic.com). Both VID owners have received their
Vendor-ID directly from usb.org.
Kotzin (now flirc.tv, Inc.). Both VID owners have received their Vendor-ID
directly from usb.org.


=========================================================================
Expand Down
30 changes: 25 additions & 5 deletions UsbKeyboard/USB-IDs-for-free.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ If you use one of the IDs listed below, your device and host-side software
must conform to these rules:

(1) The USB device MUST provide a textual representation of the serial
number. The serial number string MUST be available at least in USB language
0x0409 (English/US).
number, unless ONLY the operating system's default class driver is used.
The serial number string MUST be available at least in USB language 0x0409
(English/US).

(2) The serial number MUST start with either an Internet domain name (e.g.
"mycompany.com") registered and owned by you, or an e-mail address under your
Expand All @@ -108,6 +109,11 @@ driver for Vendor Class devices is needed, this driver must be libusb or
libusb-win32 (see http://libusb.org/ and
http://libusb-win32.sourceforge.net/).

(7) If ONLY the operating system's default class driver is used, e.g. for
mice, keyboards, joysticks, CDC or MIDI devices and no discrimination by an
application is needed, the serial number may be omitted.


Table if IDs for discrimination by serial number string:

PID dec (hex) | VID dec (hex) | Description of use
Expand All @@ -121,12 +127,26 @@ PID dec (hex) | VID dec (hex) | Description of use
---------------+---------------+-------------------------------------------
10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards
---------------+---------------+-------------------------------------------
10204 (0x27db) | 5824 (0x16c0) | For USB Joysticks
10204 (0x27dc) | 5824 (0x16c0) | For USB Joysticks
---------------+---------------+-------------------------------------------
10205 (0x27dd) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
---------------+---------------+-------------------------------------------
10206 (0x27de) | 5824 (0x16c0) | For MIDI class devices
---------------+---------------+-------------------------------------------
10205 (0x27dc) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
10207 (0x27df) | 5824 (0x16c0) | For Mass Storage class devices
---------------+---------------+-------------------------------------------
10206 (0x27dd) | 5824 (0x16c0) | For MIDI class devices
10208 (0x27e0) | 5824 (0x16c0) | For Audio class devices
---------------+---------------+-------------------------------------------
10209 (0x27e1) | 5824 (0x16c0) | For CDC-ECM class devices
---------------+---------------+-------------------------------------------
10210 (0x27e2) | 5824 (0x16c0) | For MTP class devices
---------------+---------------+-------------------------------------------

Note that the last six cannot be implemented using V-USB in a standards
compliant way because they require bulk endpoints which are forbidden for
low speed devices. We provide them nevertheless, either if you want to
implement a non-compliant device or implement it using other technology
than V-USB.


=================
Expand Down
19 changes: 7 additions & 12 deletions UsbKeyboard/UsbKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <string.h>
#include <util/delay.h> // for _delay_ms()

#include "usbdrv.h"

extern "C"
{
#include "usbdrv.h"
};
// TODO: Work around Arduino 12 issues better.
//#include <WConstants.h>
//#undef int()
Expand Down Expand Up @@ -141,7 +144,6 @@ class UsbKeyboardDevice {
_delay_ms(250);
usbDeviceConnect();


usbInit();

sei();
Expand Down Expand Up @@ -241,11 +243,8 @@ size_t release(uint8_t k)

UsbKeyboardDevice UsbKeyboard = UsbKeyboardDevice();

#ifdef __cplusplus
extern "C"{
#endif
// USB_PUBLIC uchar usbFunctionSetup
uchar usbFunctionSetup(uchar data[8])
// USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8])
usbMsgLen_t usbFunctionSetup(uchar data[8])
{
usbRequest_t *rq = (usbRequest_t *)((void *)data);

Expand All @@ -272,9 +271,5 @@ uchar usbFunctionSetup(uchar data[8])
}
return 0;
}
#ifdef __cplusplus
} // extern "C"
#endif


#endif // __UsbKeyboard_h__
1 change: 0 additions & 1 deletion UsbKeyboard/asmcommon.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Tabsize: 4
* Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
* Revision: $Id$
*/

/* Do not link this file! Link usbdrvasm.S instead, which includes the
Expand Down
1 change: 0 additions & 1 deletion UsbKeyboard/oddebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Tabsize: 4
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
* This Revision: $Id: oddebug.c 692 2008-11-07 15:07:40Z cs $
*/

#include "oddebug.h"
Expand Down
1 change: 0 additions & 1 deletion UsbKeyboard/oddebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Tabsize: 4
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
* This Revision: $Id: oddebug.h 692 2008-11-07 15:07:40Z cs $
*/

#ifndef __oddebug_h_included__
Expand Down
27 changes: 21 additions & 6 deletions UsbKeyboard/usbconfig-prototype.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Tabsize: 4
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
* This Revision: $Id: usbconfig-prototype.h 767 2009-08-22 11:39:22Z cs $
*/

#ifndef __usbconfig_h_included__
Expand Down Expand Up @@ -45,10 +44,12 @@ section at the end of this file).
*/
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
* 16500 and 20000. The 12.8 MHz and 16.5 MHz versions of the code require no
* crystal, they tolerate +/- 1% deviation from the nominal frequency. All
* other rates require a precision of 2000 ppm and thus a crystal!
* Default if not specified: 12 MHz
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
* require no crystal, they tolerate +/- 1% deviation from the nominal
* frequency. All other rates require a precision of 2000 ppm and thus a
* crystal!
* Since F_CPU should be defined to your actual clock rate anyway, you should
* not need to modify this setting.
*/
#define USB_CFG_CHECK_CRC 0
/* Define this to 1 if you want that the driver checks integrity of incoming
Expand Down Expand Up @@ -144,6 +145,11 @@ section at the end of this file).
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
* usbdrv.h.
*/
#define USB_CFG_DRIVER_FLASH_PAGE 0
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
* where the driver's constants (descriptors) are located. Or in other words:
* Define this to 1 for boot loaders on the ATMega128.
*/
#define USB_CFG_LONG_TRANSFERS 0
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
* in a single control-in or control-out transfer. Note that the capability
Expand Down Expand Up @@ -349,6 +355,15 @@ section at the end of this file).
#define USB_CFG_DESCR_PROPS_HID_REPORT 0
#define USB_CFG_DESCR_PROPS_UNKNOWN 0


//#define usbMsgPtr_t unsigned short
/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We may define it to
* a scalar type here because gcc generates slightly shorter code for scalar
* arithmetics than for pointer arithmetics. Remove this define for backward
* type compatibility or define it to an 8 bit type if you use data in RAM only
* and all RAM is below 256 bytes (tiny memory model in IAR CC).
*/

/* ----------------------- Optional MCU Description ------------------------ */

/* The following configurations have working defaults in usbdrv.h. You
Expand All @@ -364,6 +379,6 @@ section at the end of this file).
/* #define USB_INTR_ENABLE_BIT INT0 */
/* #define USB_INTR_PENDING GIFR */
/* #define USB_INTR_PENDING_BIT INTF0 */
/* #define USB_INTR_VECTOR SIG_INTERRUPT0 */
/* #define USB_INTR_VECTOR INT0_vect */

#endif /* __usbconfig_h_included__ */
Loading