projects
/
labortage2013badge.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0e317c8
)
some minor editings
author
bg
<daniel.otte@rub.de>
Sat, 19 Oct 2013 15:30:45 +0000
(17:30 +0200)
committer
bg
<daniel.otte@rub.de>
Sat, 19 Oct 2013 15:30:45 +0000
(17:30 +0200)
firmware/main.c
patch
|
blob
|
history
diff --git
a/firmware/main.c
b/firmware/main.c
index 54476a0e7a1ad143a0f53c42392f12421fa41d08..5bcb9345f1a0bb06390884dde38c1f7d00d5f4f7 100644
(file)
--- a/
firmware/main.c
+++ b/
firmware/main.c
@@
-1,10
+1,10
@@
/* Name: main.c
/* Name: main.c
- * Project:
hid-custom-rq exampl
e
- * Author:
Christian Starkjohann
- * Creation Date: 20
08-04-07
+ * Project:
labortage-2013-badg
e
+ * Author:
bg (bg@das-labor.org)
+ * Creation Date: 20
13-10-16
* Tabsize: 4
* Tabsize: 4
- * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
- * License: GNU GPL v
2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
+ * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
, (c) Daniel Otte
+ * License: GNU GPL v
3
* This Revision: $Id: main.c 692 2008-11-07 15:07:40Z cs $
*/
* This Revision: $Id: main.c 692 2008-11-07 15:07:40Z cs $
*/
@@
-13,12
+13,12
@@
This example should run on most AVRs with only little changes. No special
hardware resources except INT0 are used. You may have to change usbconfig.h for
different I/O pins for USB. Please note that USB D+ must be the INT0 pin, or
at least be connected to INT0 as well.
hardware resources except INT0 are used. You may have to change usbconfig.h for
different I/O pins for USB. Please note that USB D+ must be the INT0 pin, or
at least be connected to INT0 as well.
-We assume that an LED is connected to port B bit 0. If you connect it to a
-different port or bit, change the macros below:
*/
*/
+
#define BUTTON_PIN 4
#define SIMPLE_COUNTER 1
#define BUTTON_PIN 4
#define SIMPLE_COUNTER 1
+#define NO_CHECK 1
#include <stdint.h>
#include <string.h>
#include <stdint.h>
#include <string.h>
@@
-32,7
+32,6
@@
different port or bit, change the macros below:
#include <avr/pgmspace.h> /* required by usbdrv.h */
#include "usbdrv.h"
#include <avr/pgmspace.h> /* required by usbdrv.h */
#include "usbdrv.h"
-#include "oddebug.h" /* This is also an example for using debug macros */
#include "requests.h" /* The custom request numbers we use */
#include "hotp.h"
#if !SIMPLE_COUNTER
#include "requests.h" /* The custom request numbers we use */
#include "hotp.h"
#if !SIMPLE_COUNTER
@@
-109,7
+108,7
@@
static union __attribute__((packed)) {
static uint8_t current_command;
static uint8_t current_command;
-typedef struct {
+typedef struct
__attribute__((packed))
{
uint8_t modifier;
uint8_t reserved;
uint8_t keycode[6];
uint8_t modifier;
uint8_t reserved;
uint8_t keycode[6];
@@
-127,8
+126,6
@@
void memory_clean(void) {
secret_length_b = 0;
}
secret_length_b = 0;
}
-#define NO_CHECK 1
-
static
uint8_t secret_set(void){
#if !NO_CHECK
static
uint8_t secret_set(void){
#if !NO_CHECK
@@
-308,6
+305,9
@@
usbMsgLen_t usbFunctionSetup(uchar data[8])
uni_buffer.w8[0] = eeprom_read_byte(&reset_counter_ee);
return 1;
case CUSTOM_RQ_SET_DIGITS:
uni_buffer.w8[0] = eeprom_read_byte(&reset_counter_ee);
return 1;
case CUSTOM_RQ_SET_DIGITS:
+ if (rq->wValue.bytes[0] < 6) {
+ rq->wValue.bytes[0] = 6;
+ }
if (rq->wValue.bytes[0] > 9) {
rq->wValue.bytes[0] = 9;
}
if (rq->wValue.bytes[0] > 9) {
rq->wValue.bytes[0] = 9;
}