forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
323 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef SUSPEND_AVR_H | ||
#define SUSPEND_AVR_H | ||
|
||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <avr/sleep.h> | ||
#include <avr/wdt.h> | ||
#include <avr/interrupt.h> | ||
|
||
|
||
#define wdt_intr_enable(value) \ | ||
__asm__ __volatile__ ( \ | ||
"in __tmp_reg__,__SREG__" "\n\t" \ | ||
"cli" "\n\t" \ | ||
"wdr" "\n\t" \ | ||
"sts %0,%1" "\n\t" \ | ||
"out __SREG__,__tmp_reg__" "\n\t" \ | ||
"sts %0,%2" "\n\t" \ | ||
: /* no outputs */ \ | ||
: "M" (_SFR_MEM_ADDR(_WD_CONTROL_REG)), \ | ||
"r" (_BV(_WD_CHANGE_BIT) | _BV(WDE)), \ | ||
"r" ((uint8_t) ((value & 0x08 ? _WD_PS3_MASK : 0x00) | \ | ||
_BV(WDIE) | (value & 0x07)) ) \ | ||
: "r0" \ | ||
) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "bootloader.h" | ||
|
||
|
||
void bootloader_jump(void) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <stdbool.h> | ||
|
||
|
||
void suspend_power_down(void) {} | ||
bool suspend_wakeup_condition(void) { return true; } | ||
void suspend_wakeup_init(void) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <cstdarg> | ||
//#include <stdarg.h> | ||
#include "mbed.h" | ||
#include "mbed/xprintf.h" | ||
|
||
|
||
#define STRING_STACK_LIMIT 120 | ||
|
||
/* mbed Serial */ | ||
Serial ser(UART_TX, UART_RX); | ||
|
||
/* TODO: Need small implementation for embedded */ | ||
int xprintf(const char* format, ...) | ||
{ | ||
/* copy from mbed/common/RawSerial.cpp */ | ||
std::va_list arg; | ||
va_start(arg, format); | ||
int len = vsnprintf(NULL, 0, format, arg); | ||
if (len < STRING_STACK_LIMIT) { | ||
char temp[STRING_STACK_LIMIT]; | ||
vsprintf(temp, format, arg); | ||
ser.puts(temp); | ||
} else { | ||
char *temp = new char[len + 1]; | ||
vsprintf(temp, format, arg); | ||
ser.puts(temp); | ||
delete[] temp; | ||
} | ||
va_end(arg); | ||
return len; | ||
|
||
/* Fail: __builtin_va_arg_pack? | ||
* https://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Constructing-Calls.html#Constructing-Calls | ||
void *arg = __builtin_apply_args(); | ||
void *ret = __builtin_apply((void*)(&(ser.printf)), arg, 100); | ||
__builtin_return(ret) | ||
*/ | ||
/* Fail: varargs can not be passed to printf | ||
//int r = ser.printf("test %i\r\n", 123); | ||
va_list arg; | ||
va_start(arg, format); | ||
int r = ser.printf(format, arg); | ||
va_end(arg); | ||
return r; | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef XPRINTF_H | ||
#define XPRINTF_H | ||
|
||
//#define xprintf(format, ...) __xprintf(format, ##__VA_ARGS__) | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
int xprintf(const char *format, ...); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef PROGMEM_H | ||
#define PROGMEM_H 1 | ||
|
||
#if defined(__AVR__) | ||
# include <avr/pgmspace.h> | ||
#elif defined(__arm__) | ||
# define PROGMEM | ||
# define pgm_read_byte(p) *(p) | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,79 @@ | ||
COMMON_DIR = common | ||
OBJECTS += \ | ||
$(OBJDIR)/$(COMMON_DIR)/mbed/timer.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/mbed/xprintf.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/action.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/action_tapping.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/action_macro.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/action_layer.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/action_util.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/host.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/keymap.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/keyboard.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/util.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/mbed/suspend.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/mbed/timer.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/mbed/xprintf.o \ | ||
$(OBJDIR)/$(COMMON_DIR)/mbed/bootloader.o \ | ||
|
||
INCLUDE_PATHS += \ | ||
-I$(TMK_DIR)/$(COMMON_DIR) | ||
|
||
CC_FLAGS += -include $(CONFIG_H) | ||
|
||
|
||
|
||
# Option modules | ||
ifdef BOOTMAGIC_ENABLE | ||
$(error Not Supported) | ||
OBJECTS += $(OBJDIR)/$(COMMON_DIR)/bootmagic.o | ||
OBJECTS += $(OBJDIR)/$(COMMON_DIR)/mbed/eeprom.o | ||
OPT_DEFS += -DBOOTMAGIC_ENABLE | ||
endif | ||
|
||
ifdef MOUSEKEY_ENABLE | ||
OBJECTS += $(OBJDIR)/$(COMMON_DIR)/mousekey.o | ||
OPT_DEFS += -DMOUSEKEY_ENABLE | ||
OPT_DEFS += -DMOUSE_ENABLE | ||
endif | ||
|
||
ifdef EXTRAKEY_ENABLE | ||
$(error Not Supported) | ||
OPT_DEFS += -DEXTRAKEY_ENABLE | ||
endif | ||
|
||
ifdef CONSOLE_ENABLE | ||
$(error Not Supported) | ||
OPT_DEFS += -DCONSOLE_ENABLE | ||
else | ||
OPT_DEFS += -DNO_PRINT | ||
OPT_DEFS += -DNO_DEBUG | ||
endif | ||
|
||
ifdef COMMAND_ENABLE | ||
$(error Not Supported) | ||
SRC += $(COMMON_DIR)/command.c | ||
OPT_DEFS += -DCOMMAND_ENABLE | ||
endif | ||
|
||
ifdef NKRO_ENABLE | ||
$(error Not Supported) | ||
OPT_DEFS += -DNKRO_ENABLE | ||
endif | ||
|
||
ifdef SLEEP_LED_ENABLE | ||
$(error Not Supported) | ||
SRC += $(COMMON_DIR)/sleep_led.c | ||
OPT_DEFS += -DSLEEP_LED_ENABLE | ||
OPT_DEFS += -DNO_SUSPEND_POWER_DOWN | ||
endif | ||
|
||
ifdef BACKLIGHT_ENABLE | ||
$(error Not Supported) | ||
SRC += $(COMMON_DIR)/backlight.c | ||
OPT_DEFS += -DBACKLIGHT_ENABLE | ||
endif | ||
|
||
# $(OBJDIR)/$(COMMON_DIR)/keyboard.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/keymap.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/bootloader.o \ | ||
# $(OBJDIR)/$(COMMON_DIR)/suspend.o \ | ||
ifdef KEYMAP_SECTION_ENABLE | ||
$(error Not Supported) | ||
OPT_DEFS += -DKEYMAP_SECTION_ENABLE | ||
EXTRALDFLAGS = -Wl,-L$(TOP_DIR),-Tldscript_keymap_avr5.x | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef CONFIG_H | ||
#define CONFIG_H | ||
|
||
#define MATRIX_ROWS 1 | ||
#define MATRIX_COLS 1 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.