Compare commits

...

5 Commits

Author SHA1 Message Date
Jack Humbert
ea948a1f2c trying out some different stuff 2018-01-18 16:32:26 -05:00
Jack Humbert
6b58b0c7dd xmega compiling (not flashing yet) 2018-01-16 02:15:21 -05:00
skullydazed
5836d1a06a Fix up the ARM audio support (#2136)
* Get audio working on clueboard/60

* add keys for music mode

* Change doubles to floats

* add keys for all the songs

* revert to the default startup sound

* Remove music mode until we can figure out why it crashes
2018-01-13 23:38:25 -05:00
manofinterests
fd359e23e8 Update info.json 2018-01-12 20:24:48 -08:00
Jack Humbert
4aef0318aa Update info.json 2018-01-12 20:47:39 -05:00
21 changed files with 385 additions and 137 deletions

View File

@@ -34,7 +34,11 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes)
OPT_DEFS += -DAUDIO_ENABLE
MUSIC_ENABLE := 1
SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
SRC += $(QUANTUM_DIR)/audio/audio.c
ifeq ($(PLATFORM),AVR)
SRC += $(QUANTUM_DIR)/audio/audio.c
else
SRC += $(QUANTUM_DIR)/audio/audio_arm.c
endif
SRC += $(QUANTUM_DIR)/audio/voices.c
SRC += $(QUANTUM_DIR)/audio/luts.c
endif

View File

@@ -0,0 +1 @@
#include "_xmega.h"

View File

@@ -0,0 +1,3 @@
#include "quantum.h"
#define KEYMAP(k) { { k } }

48
keyboards/_xmega/config.h Normal file
View File

@@ -0,0 +1,48 @@
#ifndef CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER _SPINDLE
#define PRODUCT XMEGA
#define DESCRIPTION test board
/* key matrix size */
#define MATRIX_ROWS 1
#define MATRIX_COLS 1
/* key matrix pins */
#define MATRIX_ROW_PINS { D0 }
#define MATRIX_COL_PINS { A0 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* number of backlight levels */
// #define BACKLIGHT_PIN B6
// #define BACKLIGHT_LEVELS 5
/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* prevent stuck modifiers */
#define PREVENT_STUCK_MODIFIERS
#undef USE_STATIC_OPTIONS
#define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
#endif

View File

@@ -0,0 +1,5 @@
#include "_xmega.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP(KC_A)
};

56
keyboards/_xmega/rules.mk Normal file
View File

@@ -0,0 +1,56 @@
# MCU name
MCU = atxmega32a4u
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 32000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = XMEGA
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = 48000000
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Boot Section Size in *bytes*
OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
AUDIO_ENABLE = no
RGBLIGHT_ENABLE = no

View File

@@ -3,11 +3,35 @@
#define _______ KC_TRNS
enum keyboard_layers {
_BL,
_FL,
_CL
_BL,
_FL,
_CL
};
enum custom_keycodes {
S_BSKTC = SAFE_RANGE,
S_ODEJY,
S_RCKBY,
S_DOEDR,
S_SCALE,
S_ONEUP,
S_COIN,
S_SONIC,
S_ZELDA
};
#ifdef AUDIO_ENABLE
float song_basketcase[][2] = SONG(BASKET_CASE);
float song_ode_to_joy[][2] = SONG(ODE_TO_JOY);
float song_rock_a_bye_baby[][2] = SONG(ROCK_A_BYE_BABY);
float song_doe_a_deer[][2] = SONG(DOE_A_DEER);
float song_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float song_coin[][2] = SONG(COIN_SOUND);
float song_one_up[][2] = SONG(ONE_UP_SOUND);
float song_sonic_ring[][2] = SONG(SONIC_RING);
float song_zelda_puzzle[][2] = SONG(ZELDA_PUZZLE);
#endif
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
* ,-----------------------------------------------------------.
@@ -33,11 +57,71 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \
_______, _______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______, \
_______, _______, _______, _______, _______, _______, MO(_FL), _______),
_______,_______,_______, _______, _______, _______, MO(_FL), _______),
[_CL] = KEYMAP(
BL_STEP,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,\
BL_STEP,S_BSKTC,S_ODEJY,S_RCKBY,S_DOEDR,S_SCALE,S_ONEUP,S_COIN, S_SONIC,S_ZELDA,_______,_______,_______,_______,_______,\
_______, _______,_______,_______,RESET, _______,_______,_______,_______,_______,_______,_______,_______,_______, \
_______, _______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
_______, _______, _______, _______, _______, _______, MO(_FL), _______)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case S_BSKTC:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_basketcase);
}
return false;
case S_ODEJY:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_ode_to_joy);
}
return false;
case S_RCKBY:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_rock_a_bye_baby);
}
return false;
case S_DOEDR:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_doe_a_deer);
}
return false;
case S_SCALE:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_scale);
}
return false;
case S_ONEUP:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_one_up);
}
return false;
case S_COIN:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_coin);
}
return false;
case S_SONIC:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_sonic_ring);
}
return false;
case S_ZELDA:
if (record->event.pressed) {
stop_all_notes();
PLAY_SONG(song_zelda_puzzle);
}
return false;
}
return true;
}

View File

@@ -23,7 +23,7 @@
void backlight_init_ports(void) {
printf("backlight_init_ports()\n");
#ifdef BACKLIGHT_ENABLE
palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOB, 8);
#endif
}
@@ -41,13 +41,8 @@ void backlight_set(uint8_t level) {
#endif
}
void led_init_ports() {
printf("led_init_ports()\n");
palSetPadMode(GPIOB, 7, PAL_MODE_OUTPUT_PUSHPULL);
}
void led_set_kb(uint8_t usb_led) {
printf("led_init_ports()\n");
printf("led_set_kb(%d)\n", usb_led);
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// Turn capslock on
palSetPad(GPIOB, 7);

View File

@@ -71,10 +71,7 @@ void matrix_init(void) {
memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t));
/* Setup capslock */
// palSetPadMode(GPIOB, 7, PAL_MODE_OUTPUT_PUSHPULL);
// palClearPad(GPIOB, 7);
palClearPad(GPIOB, 7); // Turn off capslock
matrix_init_quantum();
}
@@ -138,6 +135,7 @@ uint8_t matrix_scan(void) {
debouncing_time = timer_read();
}
}
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
for (int row = 0; row < MATRIX_ROWS; row++) {
matrix[row] = 0;

View File

@@ -50,5 +50,5 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
CUSTOM_MATRIX = yes # Custom matrix file
#AUDIO_ENABLE = yes
AUDIO_ENABLE = yes
# SERIAL_LINK_ENABLE = yes

View File

@@ -7,7 +7,7 @@
"height": 5,
"layouts": {
"KEYMAP": {
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0.5, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":14, "y":1, "w":1.5}, {"x":0.75, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":14, "y":2, "w":2.25}, {"x":1.25, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":13, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":0.25, "y":4, "w":1.25}, {"x":1.5, "y":4, "w":1.25}, {"x":2.75, "y":4, "w":1.25}, {"x":9, "y":4, "w":6.25}, {"x":10.25, "y":4, "w":1.25}, {"x":11.5, "y":4, "w":1.25}, {"x":12.75, "y":4, "w":1.25}, {"x":14, "y":4, "w":1.25}]
"layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"~", "x":13, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2}, {"label":"Enter", "x":13.75, "y":2, "w":1.25}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"label":"iso", "x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"fn", "x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.5}, {"label":"Win", "x":1.5, "y":4}, {"label":"Alt", "x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":5}, {"x":9, "y":4}, {"x":10, "y":4}, {"label":"Win", "x":11, "y":4, "w":1.5}, {"label":"Menu", "x":12.5, "y":4}, {"label":"Ctrl", "x":13.5, "y":4, "w":1.5}, {"label":"|", "x":13.75, "y":5}]
}
}
}

View File

@@ -10,7 +10,7 @@
"width": 12,
"height": 5,
"layouts": {
"LAYOUT_preonic_mit": {
"KEYMAP": {
"key_count": 59,
"layout": [
{ "w": 1, "x": 0, "y": 0 },
@@ -138,4 +138,4 @@
{ "w": 1, "x": 11, "y": 4 } ]
}
}
}
}

View File

@@ -18,7 +18,6 @@
#include "ch.h"
#include "hal.h"
#include <stdio.h>
#include <string.h>
#include "print.h"
#include "keymap.h"

View File

@@ -53,127 +53,127 @@
// Note Timbre
// Changes how the notes sound
#define TIMBRE_12 0.125
#define TIMBRE_25 0.250
#define TIMBRE_50 0.500
#define TIMBRE_75 0.750
#define TIMBRE_12 0.125f
#define TIMBRE_25 0.250f
#define TIMBRE_50 0.500f
#define TIMBRE_75 0.750f
#define TIMBRE_DEFAULT TIMBRE_50
// Notes - # = Octave
#define NOTE_REST 0.00
#define NOTE_REST 0.00f
/* These notes are currently bugged
#define NOTE_C0 16.35
#define NOTE_CS0 17.32
#define NOTE_D0 18.35
#define NOTE_DS0 19.45
#define NOTE_E0 20.60
#define NOTE_F0 21.83
#define NOTE_FS0 23.12
#define NOTE_G0 24.50
#define NOTE_GS0 25.96
#define NOTE_A0 27.50
#define NOTE_AS0 29.14
#define NOTE_B0 30.87
#define NOTE_C1 32.70
#define NOTE_CS1 34.65
#define NOTE_D1 36.71
#define NOTE_DS1 38.89
#define NOTE_E1 41.20
#define NOTE_F1 43.65
#define NOTE_FS1 46.25
#define NOTE_G1 49.00
#define NOTE_GS1 51.91
#define NOTE_A1 55.00
#define NOTE_AS1 58.27
#define NOTE_C0 16.35f
#define NOTE_CS0 17.32f
#define NOTE_D0 18.35f
#define NOTE_DS0 19.45f
#define NOTE_E0 20.60f
#define NOTE_F0 21.83f
#define NOTE_FS0 23.12f
#define NOTE_G0 24.50f
#define NOTE_GS0 25.96f
#define NOTE_A0 27.50f
#define NOTE_AS0 29.14f
#define NOTE_B0 30.87f
#define NOTE_C1 32.70f
#define NOTE_CS1 34.65f
#define NOTE_D1 36.71f
#define NOTE_DS1 38.89f
#define NOTE_E1 41.20f
#define NOTE_F1 43.65f
#define NOTE_FS1 46.25f
#define NOTE_G1 49.00f
#define NOTE_GS1 51.91f
#define NOTE_A1 55.00f
#define NOTE_AS1 58.27f
*/
#define NOTE_B1 61.74
#define NOTE_C2 65.41
#define NOTE_CS2 69.30
#define NOTE_D2 73.42
#define NOTE_DS2 77.78
#define NOTE_E2 82.41
#define NOTE_F2 87.31
#define NOTE_FS2 92.50
#define NOTE_G2 98.00
#define NOTE_GS2 103.83
#define NOTE_A2 110.00
#define NOTE_AS2 116.54
#define NOTE_B2 123.47
#define NOTE_C3 130.81
#define NOTE_CS3 138.59
#define NOTE_D3 146.83
#define NOTE_DS3 155.56
#define NOTE_E3 164.81
#define NOTE_F3 174.61
#define NOTE_FS3 185.00
#define NOTE_G3 196.00
#define NOTE_GS3 207.65
#define NOTE_A3 220.00
#define NOTE_AS3 233.08
#define NOTE_B3 246.94
#define NOTE_C4 261.63
#define NOTE_CS4 277.18
#define NOTE_D4 293.66
#define NOTE_DS4 311.13
#define NOTE_E4 329.63
#define NOTE_F4 349.23
#define NOTE_FS4 369.99
#define NOTE_G4 392.00
#define NOTE_GS4 415.30
#define NOTE_A4 440.00
#define NOTE_AS4 466.16
#define NOTE_B4 493.88
#define NOTE_C5 523.25
#define NOTE_CS5 554.37
#define NOTE_D5 587.33
#define NOTE_DS5 622.25
#define NOTE_E5 659.26
#define NOTE_F5 698.46
#define NOTE_FS5 739.99
#define NOTE_G5 783.99
#define NOTE_GS5 830.61
#define NOTE_A5 880.00
#define NOTE_AS5 932.33
#define NOTE_B5 987.77
#define NOTE_C6 1046.50
#define NOTE_CS6 1108.73
#define NOTE_D6 1174.66
#define NOTE_DS6 1244.51
#define NOTE_E6 1318.51
#define NOTE_F6 1396.91
#define NOTE_FS6 1479.98
#define NOTE_G6 1567.98
#define NOTE_GS6 1661.22
#define NOTE_A6 1760.00
#define NOTE_AS6 1864.66
#define NOTE_B6 1975.53
#define NOTE_C7 2093.00
#define NOTE_CS7 2217.46
#define NOTE_D7 2349.32
#define NOTE_DS7 2489.02
#define NOTE_E7 2637.02
#define NOTE_F7 2793.83
#define NOTE_FS7 2959.96
#define NOTE_G7 3135.96
#define NOTE_GS7 3322.44
#define NOTE_A7 3520.00
#define NOTE_AS7 3729.31
#define NOTE_B7 3951.07
#define NOTE_C8 4186.01
#define NOTE_CS8 4434.92
#define NOTE_D8 4698.64
#define NOTE_DS8 4978.03
#define NOTE_E8 5274.04
#define NOTE_F8 5587.65
#define NOTE_FS8 5919.91
#define NOTE_G8 6271.93
#define NOTE_GS8 6644.88
#define NOTE_A8 7040.00
#define NOTE_AS8 7458.62
#define NOTE_B8 7902.13
#define NOTE_B1 61.74f
#define NOTE_C2 65.41f
#define NOTE_CS2 69.30f
#define NOTE_D2 73.42f
#define NOTE_DS2 77.78f
#define NOTE_E2 82.41f
#define NOTE_F2 87.31f
#define NOTE_FS2 92.50f
#define NOTE_G2 98.00f
#define NOTE_GS2 103.83f
#define NOTE_A2 110.00f
#define NOTE_AS2 116.54f
#define NOTE_B2 123.47f
#define NOTE_C3 130.81f
#define NOTE_CS3 138.59f
#define NOTE_D3 146.83f
#define NOTE_DS3 155.56f
#define NOTE_E3 164.81f
#define NOTE_F3 174.61f
#define NOTE_FS3 185.00f
#define NOTE_G3 196.00f
#define NOTE_GS3 207.65f
#define NOTE_A3 220.00f
#define NOTE_AS3 233.08f
#define NOTE_B3 246.94f
#define NOTE_C4 261.63f
#define NOTE_CS4 277.18f
#define NOTE_D4 293.66f
#define NOTE_DS4 311.13f
#define NOTE_E4 329.63f
#define NOTE_F4 349.23f
#define NOTE_FS4 369.99f
#define NOTE_G4 392.00f
#define NOTE_GS4 415.30f
#define NOTE_A4 440.00f
#define NOTE_AS4 466.16f
#define NOTE_B4 493.88f
#define NOTE_C5 523.25f
#define NOTE_CS5 554.37f
#define NOTE_D5 587.33f
#define NOTE_DS5 622.25f
#define NOTE_E5 659.26f
#define NOTE_F5 698.46f
#define NOTE_FS5 739.99f
#define NOTE_G5 783.99f
#define NOTE_GS5 830.61f
#define NOTE_A5 880.00f
#define NOTE_AS5 932.33f
#define NOTE_B5 987.77f
#define NOTE_C6 1046.50f
#define NOTE_CS6 1108.73f
#define NOTE_D6 1174.66f
#define NOTE_DS6 1244.51f
#define NOTE_E6 1318.51f
#define NOTE_F6 1396.91f
#define NOTE_FS6 1479.98f
#define NOTE_G6 1567.98f
#define NOTE_GS6 1661.22f
#define NOTE_A6 1760.00f
#define NOTE_AS6 1864.66f
#define NOTE_B6 1975.53f
#define NOTE_C7 2093.00f
#define NOTE_CS7 2217.46f
#define NOTE_D7 2349.32f
#define NOTE_DS7 2489.02f
#define NOTE_E7 2637.02f
#define NOTE_F7 2793.83f
#define NOTE_FS7 2959.96f
#define NOTE_G7 3135.96f
#define NOTE_GS7 3322.44f
#define NOTE_A7 3520.00f
#define NOTE_AS7 3729.31f
#define NOTE_B7 3951.07f
#define NOTE_C8 4186.01f
#define NOTE_CS8 4434.92f
#define NOTE_D8 4698.64f
#define NOTE_DS8 4978.03f
#define NOTE_E8 5274.04f
#define NOTE_F8 5587.65f
#define NOTE_FS8 5919.91f
#define NOTE_G8 6271.93f
#define NOTE_GS8 6644.88f
#define NOTE_A8 7040.00f
#define NOTE_AS8 7458.62f
#define NOTE_B8 7902.13f
// Flat Aliases
#define NOTE_DF0 NOTE_CS0

View File

@@ -53,6 +53,24 @@
E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4),
#define CLUEBOARD_SOUND \
HD_NOTE(_C3), HD_NOTE(_D3), HD_NOTE(_E3), HD_NOTE(_F3), HD_NOTE(_G3), HD_NOTE(_A4), HD_NOTE(_B4), HD_NOTE(_C4)
/*
HD_NOTE(_G3), HD_NOTE(_E3), HD_NOTE(_C3), \
Q__NOTE(_E3), Q__NOTE(_C3), Q__NOTE(_G3), \
Q__NOTE(_E3)
*/
/*
HD_NOTE(_C3), HD_NOTE(_G3), HD_NOTE(_E3), \
Q__NOTE(_G3), Q__NOTE(_E3), Q__NOTE(_G3), \
Q__NOTE(_F3)
*/
#define BASKET_CASE \
QD_NOTE(_G3), E__NOTE(_F3), E__NOTE(_E3), Q__NOTE(_F3), M__NOTE(_G3, 8+32), Q__NOTE(_REST), \
Q__NOTE(_B4), Q__NOTE(_C4), Q__NOTE(_B4), E__NOTE(_A4), Q__NOTE(_G3), M__NOTE(_G3, 8+32), Q__NOTE(_REST), \
Q__NOTE(_B4), Q__NOTE(_C4), Q__NOTE(_B4), E__NOTE(_A4), Q__NOTE(_G3), Q__NOTE(_G3), Q__NOTE(_G3), Q__NOTE(_G3), E__NOTE(_A4), E__NOTE(_C4), QD_NOTE(_B4), HD_NOTE(_B4)
#define STARTUP_SOUND \
E__NOTE(_E6), \
E__NOTE(_A6), \

View File

@@ -6,7 +6,9 @@
#include <avr/wdt.h>
#include <util/delay.h>
#include "bootloader.h"
#include <avr/boot.h>
#ifndef __AVR_XMEGA__
#include <avr/boot.h>
#endif
#ifdef PROTOCOL_LUFA
#include <LUFA/Drivers/USB/USB.h>
@@ -152,7 +154,7 @@ void bootloader_jump(void) {
#else // Assume remaining boards are DFU, even if the flag isn't set
#ifndef __AVR_ATmega32A__ // no USB - maybe BOOTLOADER_BOOTLOADHID instead though?
#ifdef BOOTLOADER_BOOTLOADHID // no USB - maybe BOOTLOADER_BOOTLOADHID instead though?
UDCON = 1;
USBCON = (1<<FRZCLK); // disable USB
UCSR1B = 0;
@@ -178,6 +180,11 @@ void bootloader_jump(void) {
#define MCUSR MCUCSR
#endif
#ifdef __AVR_XMEGA__
#define MCUSR RST_STATUS
#define WDRF RST_WDRF_bp
#endif
/* this runs before main() */
void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3")));
void bootloader_jump_after_watchdog_reset(void)

View File

@@ -20,6 +20,11 @@
#endif /* AUDIO_ENABLE */
#ifdef __AVR_XMEGA__
#define wdt_intr_enable(value) wdt_enable(value)
#else
#define wdt_intr_enable(value) \
__asm__ __volatile__ ( \
@@ -37,6 +42,7 @@ __asm__ __volatile__ ( \
: "r0" \
)
#endif
void suspend_idle(uint8_t time)
{
@@ -134,6 +140,7 @@ void suspend_wakeup_init(void)
led_set(host_keyboard_leds());
}
#ifndef __AVR_XMEGA__
#ifndef NO_SUSPEND_POWER_DOWN
/* watchdog timeout */
ISR(WDT_vect)
@@ -148,3 +155,4 @@ ISR(WDT_vect)
}
}
#endif
#endif

View File

@@ -7,6 +7,7 @@
#include <avr/wdt.h>
#include <avr/interrupt.h>
#ifndef __AVR_XMEGA__
#define wdt_intr_enable(value) \
__asm__ __volatile__ ( \
@@ -25,3 +26,5 @@ __asm__ __volatile__ ( \
)
#endif
#endif

View File

@@ -43,6 +43,7 @@ void timer_init(void)
# error "Timer prescaler value is NOT vaild."
#endif
#ifndef __AVR_XMEGA__
#ifndef __AVR_ATmega32A__
// Timer0 CTC mode
TCCR0A = 0x02;
@@ -58,6 +59,13 @@ void timer_init(void)
OCR0 = TIMER_RAW_TOP;
TIMSK = (1 << OCIE0);
#endif
#else
TCC0.CTRLE = 0x01; // set timer in 8bit mode (default is 16 bits)
TCC0.INTCTRLA = 0x02; // Interrupt Enable register A (enable INT for tc0 (medium level))
TCC0.PER = 132; // set period to 228 khz
TCC0.PERBUF = 132; // buffer for writing to TCC0.PER.
TCC0.CTRLA = prescaler; // clk=30324000 H
#endif
}
inline
@@ -117,11 +125,15 @@ uint32_t timer_elapsed32(uint32_t last)
}
// excecuted once per 1ms.(excess for just timer count?)
#ifndef __AVR_XMEGA__
#ifndef __AVR_ATmega32A__
#define TIMER_INTERRUPT_VECTOR TIMER0_COMPA_vect
#else
#define TIMER_INTERRUPT_VECTOR TIMER0_COMP_vect
#endif
#else
#define TIMER_INTERRUPT_VECTOR TCE0_OVF_vect
#endif
ISR(TIMER_INTERRUPT_VECTOR, ISR_NOBLOCK)
{
timer_count++;

View File

@@ -1082,6 +1082,7 @@ void virtser_send(const uint8_t byte)
******************************************************************************/
static void setup_mcu(void)
{
#ifndef __AVR_XMEGA__
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
@@ -1091,6 +1092,7 @@ static void setup_mcu(void)
CLKPR = (1 << CLKPCE);
CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
#endif
}
static void setup_usb(void)

View File

@@ -61,6 +61,11 @@ extern host_driver_t lufa_driver;
}
#endif
#ifdef __AVR_XMEGA__
#define MCUSR RST_STATUS
#define WDRF RST_WDRF_bp
#endif
/* extra report structure */
typedef struct {
uint8_t report_id;