summaryrefslogtreecommitdiff
path: root/keyboards/handwired/symmetric70_proto/local_features.mk
blob: e5cd31a615c33433c8b8d9bbc44ef02c229cfdee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# matrix.c testing options
#  set MATRIX_IO_DELAY macro
#    make MTEST=mdelay0   symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
#    make MTEST=mdelay=1  symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
#    make MTEST=mdelay=10  symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
#  set DEBUG_MATRIX_SCAN_RATE_ENABLE yes
#    make MTEST=scan symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
#  set MATRIX_DEBUG_DELAY and MATRIX_IO_DELAY macro
#    make MTEST=matrix_debug_delay,mdelay0 symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash
#  set MATRIX_DEBUG_SCAN
#    make MTEST=matrix_debug_scan symmetric70_proto/{promicro|proton_c}/{fast|normal}:default:flash

ifneq ($(strip $(MTEST)),)
  define KEYBOARD_OPTION_PARSE
    # parse 'consle', 'scan', 'no-scan', 'mdelay=?', 'mdelay0',
    #       'adaptive_delay', 'always_delay', 'matrix_debug_delay', 'matrix_debug_scan'
    $(if $(SHOW_PARSE),$(info parse .$1.))  #for debug  'make SHOW_PARSE=y ...'
    ifeq ($(strip $1),console)
        CONSOLE_ENABLE = yes
    endif
    ifeq ($(strip $1),scan)
        DEBUG_MATRIX_SCAN_RATE_ENABLE = yes
    endif
    ifeq ($(strip $1),no-scan)
        DEBUG_MATRIX_SCAN_RATE_ENABLE = no
    endif
    ifneq ($(filter mdelay=%,$1),)
        MDELAY = $(patsubst mdelay=%,%,$1)
    endif
    ifeq ($(strip $1),mdelay0)
        MDELAY = 0
    endif
    ifeq ($(strip $1),common_delay)
        MATRIX_COMMON_DELAY = yes
    endif
    ifeq ($(strip $1),adaptive_delay)
        ADAPTIVE_DELAY = yes
    endif
    ifeq ($(strip $1),adaptive_delay2)
        ADAPTIVE_DELAY2 = yes
    endif
    ifeq ($(strip $1),adaptive_delay_fast)
        ADAPTIVE_DELAY_FAST = yes
    endif
    ifeq ($(strip $1),always_delay)
        ALWAYS_DELAY = yes
    endif
    ifeq ($(strip $1),matrix_debug_delay)
        MATRIX_DEBUG_DELAY = yes
        MATRIX_DEBUG_SCAN = no
    endif
    ifeq ($(strip $1),matrix_debug_scan)
        MATRIX_DEBUG_DELAY = no
        MATRIX_DEBUG_SCAN = yes
    endif
  endef # end of KEYMAP_OPTION_PARSE

  COMMA=,
  $(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(MTEST)),  \
      $(call KEYBOARD_OPTION_PARSE,$(A_OPTION_NAME))))
endif

ifneq ($(strip $(MDELAY)),)
    OPT_DEFS += -DMATRIX_IO_DELAY=$(strip $(MDELAY))
endif

ifeq ($(strip $(ADAPTIVE_DELAY)),yes)
    OPT_DEFS += -DMATRIX_IO_DELAY_ADAPTIVE
endif

ifeq ($(strip $(ADAPTIVE_DELAY2)),yes)
    OPT_DEFS += -DMATRIX_IO_DELAY_ADAPTIVE2
endif

ifeq ($(strip $(ADAPTIVE_DELAY_FAST)),yes)
    OPT_DEFS += -DMATRIX_IO_DELAY_ADAPTIVE_FAST
endif

ifeq ($(strip $(ALWAYS_DELAY)),yes)
    OPT_DEFS += -DMATRIX_IO_DELAY_ALWAYS
endif

ifeq ($(strip $(MATRIX_DEBUG_DELAY)),yes)
    OPT_DEFS += -DMATRIX_DEBUG_DELAY
    DEBUG_CONFIG = yes
endif

ifeq ($(strip $(MATRIX_DEBUG_SCAN)),yes)
    OPT_DEFS += -DMATRIX_DEBUG_SCAN
    DEBUG_CONFIG = yes
endif

ifeq ($(strip $(DEBUG_CONFIG)),yes)
    # include "debug_config.h" from {promicro|proton_c}/config.h
    OPT_DEFS += -DDEBUG_CONFIG
endif

ifeq ($(strip $(MATRIX_COMMON_DELAY)),yes)
    # use matrix_output_unselect_delay() in matrix_common.c
    OPT_DEFS += -DMATRIX_IO_DELAY_DEFAULT
endif

$(info -)
$(info -  DEBUG_MATRIX_SCAN_RATE_ENABLE = $(DEBUG_MATRIX_SCAN_RATE_ENABLE))
$(info -  CONSOLE_ENABLE      = $(CONSOLE_ENABLE))
$(info -  MDELAY              = $(MDELAY))
$(info -  MATRIX_COMMON_DELAY = $(MATRIX_COMMON_DELAY))
$(info -  OPT_DEFS            = $(OPT_DEFS))