Skip to content

Commit cf85efc

Browse files
committed
sun_usb: Add build option for sun mouse support
1 parent ff1b743 commit cf85efc

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

converter/sun_usb/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ COMMAND_ENABLE ?= yes # Commands for debug and configuration
6262
UNIMAP_ENABLE = yes
6363
KEYMAP_SECTION_ENABLE = yes
6464

65+
SUN_MOUSE_ENABLE ?= yes # Sun mouse support
66+
6567

6668
# Boot Section Size in bytes
6769
# Teensy halfKay 512
@@ -89,6 +91,12 @@ else
8991
SRC := $(KEYMAP_FILE).c $(SRC)
9092
endif
9193

94+
ifeq (yes,$(strip $(SUN_MOUSE_ENABLE)))
95+
OPT_DEFS += -DSUN_MOUSE_ENABLE=1
96+
else
97+
OPT_DEFS += -DSUN_MOUSE_ENABLE=0
98+
endif
99+
92100

93101
# Search Path
94102
VPATH += $(TARGET_DIR)

converter/sun_usb/Makefile.atmega32u4

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
TARGET = sun_usb_atmega32u4
22
MCU = atmega32u4
33

4+
SUN_MOUSE_ENABLE = no # Sun mouse support
5+
46
include Makefile
57

converter/sun_usb/sun_usb.c

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2929
#include "host.h"
3030

3131

32+
#if !defined(SUN_MOUSE_ENABLE)
33+
# define SUN_MOUSE_ENABLE 1
34+
#endif
35+
3236
// Timer count
3337
#define BAUD 1200
3438
#define PRESCALE 8
@@ -156,6 +160,7 @@ ISR(TIMER1_COMPA_vect)
156160
}
157161

158162

163+
#if SUN_MOUSE_ENABLE
159164
//
160165
// mouse uart
161166
//
@@ -224,6 +229,7 @@ ISR(TIMER1_COMPC_vect)
224229
break;
225230
}
226231
}
232+
#endif
227233

228234

229235
void hook_early_init(void)
@@ -265,11 +271,13 @@ void hook_early_init(void)
265271
EICRA |= (1 << ISC21) | (1 << ISC20);
266272
EIMSK |= (1 << INT2);
267273

274+
#if SUN_MOUSE_ENABLE
268275
// mouse init
269276
suart_init(&ms_suart);
270277
// enable interrupt on rising edge for mouse
271278
EICRB |= (1 << ISC51) |(1 << ISC50);
272279
EIMSK |= (1 << INT5);
280+
#endif
273281

274282
sei();
275283
}
@@ -296,6 +304,7 @@ void hook_late_init(void)
296304
* the device seems to fail to follow movement and send wrong value when dragging it rapidly.
297305
* it causes opposite direction movement in the result. encoder speed limit? if not a bug in my code.
298306
*/
307+
#if SUN_MOUSE_ENABLE
299308
void hook_main_loop(void)
300309
{
301310
static uint8_t n = 0;
@@ -338,6 +347,7 @@ void hook_main_loop(void)
338347
}
339348
n = (n + 1) % 5;
340349
}
350+
#endif
341351

342352

343353
/*

0 commit comments

Comments
 (0)