Skip to content

Commit

Permalink
Clean up ATSAM ifdefs (qmk#8808)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and jakobaa committed Jul 7, 2020
1 parent 8efc4fd commit e3ddee6
Show file tree
Hide file tree
Showing 10 changed files with 418 additions and 202 deletions.
20 changes: 9 additions & 11 deletions tmk_core/protocol/arm_atsam/usb/conf_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,34 +116,32 @@
* @{
*/
//! Interface callback definition
#ifdef KBD
# define UDI_HID_KBD_ENABLE_EXT() main_kbd_enable()
# define UDI_HID_KBD_DISABLE_EXT() main_kbd_disable()
//#define UDI_HID_KBD_CHANGE_LED(value) ui_kbd_led(value)
#endif
#define UDI_HID_KBD_ENABLE_EXT() main_kbd_enable()
#define UDI_HID_KBD_DISABLE_EXT() main_kbd_disable()
//#define UDI_HID_KBD_CHANGE_LED(value) ui_kbd_led(value)

#ifdef NKRO
#ifdef NKRO_ENABLE
# define UDI_HID_NKRO_ENABLE_EXT() main_nkro_enable()
# define UDI_HID_NKRO_DISABLE_EXT() main_nkro_disable()
//#define UDI_HID_NKRO_CHANGE_LED(value) ui_kbd_led(value)
//#define UDI_HID_NKRO_CHANGE_LED(value) ui_kbd_led(value)
#endif

#ifdef EXK
#ifdef EXTRAKEY_ENABLE
# define UDI_HID_EXK_ENABLE_EXT() main_exk_enable()
# define UDI_HID_EXK_DISABLE_EXT() main_exk_disable()
#endif

#ifdef CON
#ifdef CONSOLE_ENABLE
# define UDI_HID_CON_ENABLE_EXT() main_con_enable()
# define UDI_HID_CON_DISABLE_EXT() main_con_disable()
#endif

#ifdef MOU
#ifdef MOUSE_ENABLE
# define UDI_HID_MOU_ENABLE_EXT() main_mou_enable()
# define UDI_HID_MOU_DISABLE_EXT() main_mou_disable()
#endif

#ifdef RAW
#ifdef RAW_ENABLE
# define UDI_HID_RAW_ENABLE_EXT() main_raw_enable()
# define UDI_HID_RAW_DISABLE_EXT() main_raw_disable()
# define UDI_HID_RAW_RECEIVE(buffer, len) main_raw_receive(buffer, len)
Expand Down
15 changes: 7 additions & 8 deletions tmk_core/protocol/arm_atsam/usb/main_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "samd51j18a.h"
#include "conf_usb.h"
#include "udd.h"
#ifdef RAW

#ifdef RAW_ENABLE
# include "raw_hid.h"
#endif

Expand All @@ -34,17 +35,15 @@ void main_remotewakeup_enable(void) { ui_wakeup_enable(); }

void main_remotewakeup_disable(void) { ui_wakeup_disable(); }

#ifdef KBD
volatile bool main_b_kbd_enable = false;
bool main_kbd_enable(void) {
main_b_kbd_enable = true;
return true;
}

void main_kbd_disable(void) { main_b_kbd_enable = false; }
#endif

#ifdef NKRO
#ifdef NKRO_ENABLE
volatile bool main_b_nkro_enable = false;
bool main_nkro_enable(void) {
main_b_nkro_enable = true;
Expand All @@ -54,7 +53,7 @@ bool main_nkro_enable(void) {
void main_nkro_disable(void) { main_b_nkro_enable = false; }
#endif

#ifdef EXK
#ifdef EXTRAKEY_ENABLE
volatile bool main_b_exk_enable = false;
bool main_exk_enable(void) {
main_b_exk_enable = true;
Expand All @@ -64,7 +63,7 @@ bool main_exk_enable(void) {
void main_exk_disable(void) { main_b_exk_enable = false; }
#endif

#ifdef CON
#ifdef CONSOLE_ENABLE
volatile bool main_b_con_enable = false;
bool main_con_enable(void) {
main_b_con_enable = true;
Expand All @@ -74,7 +73,7 @@ bool main_con_enable(void) {
void main_con_disable(void) { main_b_con_enable = false; }
#endif

#ifdef MOU
#ifdef MOUSE_ENABLE
volatile bool main_b_mou_enable = false;
bool main_mou_enable(void) {
main_b_mou_enable = true;
Expand All @@ -84,7 +83,7 @@ bool main_mou_enable(void) {
void main_mou_disable(void) { main_b_mou_enable = false; }
#endif

#ifdef RAW
#ifdef RAW_ENABLE
volatile bool main_b_raw_enable = false;
bool main_raw_enable(void) {
main_b_raw_enable = true;
Expand Down
2 changes: 1 addition & 1 deletion tmk_core/protocol/arm_atsam/usb/udi_cdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include "stdarg.h"
#include "tmk_core/protocol/arm_atsam/clks.h"

#ifdef CDC
#ifdef VIRTSER_ENABLE

# ifdef UDI_CDC_LOW_RATE
# ifdef USB_DEVICE_HS_SUPPORT
Expand Down
6 changes: 3 additions & 3 deletions tmk_core/protocol/arm_atsam/usb/udi_cdc.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#ifndef _UDI_CDC_H_
#define _UDI_CDC_H_

#ifdef CDC
#ifdef VIRTSER_ENABLE

# include "conf_usb.h"
# include "usb_protocol.h"
Expand Down Expand Up @@ -346,7 +346,7 @@ typedef struct {
char buf[CDC_INBUF_SIZE];
} inbuf_t;

#else // CDC
#else // VIRTSER_ENABLE

// keep these to accommodate calls if remaining
# define CDC_PRINTBUF_SIZE 1
Expand All @@ -362,7 +362,7 @@ typedef struct {

extern inbuf_t inbuf;

#endif // CDC
#endif // VIRTSER_ENABLE

uint32_t CDC_print(char* printbuf);
int CDC_printf(const char* _Format, ...);
Expand Down
Loading

0 comments on commit e3ddee6

Please sign in to comment.