snapshot hardware

pull/18/head
Jesse Vincent 10 years ago
parent 3b6cc9f0b9
commit a164b574b4

@ -9,6 +9,7 @@ keyboardio.bootloader.extended_fuses=0xcb
keyboardio.bootloader.path=caterina keyboardio.bootloader.path=caterina
keyboardio.bootloader.file=Caterina-keyboardio.hex keyboardio.bootloader.file=Caterina-keyboardio.hex
keyboardio.bootloader.unlock_bits=0x3F keyboardio.bootloader.unlock_bits=0x3F
keyboardio.bootloader.tool=avrdude
keyboardio.bootloader.lock_bits=0x2F keyboardio.bootloader.lock_bits=0x2F
keyboardio.build.mcu=atmega32u4 keyboardio.build.mcu=atmega32u4
keyboardio.build.f_cpu=16000000L keyboardio.build.f_cpu=16000000L
@ -17,21 +18,34 @@ keyboardio.build.pid=0x8037
keyboardio.build.core=keyboardio keyboardio.build.core=keyboardio
keyboardio.build.variant=model00 keyboardio.build.variant=model00
symmetric60.build.board=AVR_MICRO
symmetric60.name=Keyboardio Symmetric 60 symmetric60.name=Keyboardio Symmetric 60
symmetric60.upload.tool=avrdude
symmetric60.upload.protocol=avr109 symmetric60.upload.protocol=avr109
symmetric60.upload.maximum_size=28672 symmetric60.upload.maximum_size=28672
symmetric60.upload.maximum_data_size=2560
symmetric60.upload.speed=57600 symmetric60.upload.speed=57600
symmetric60.upload.disable_flushing=true symmetric60.upload.disable_flushing=true
symmetric60.upload.use_1200bps_touch=true
symmetric60.upload.wait_for_upload_port=true
symmetric60.bootloader.tool=avrdude
symmetric60.bootloader.low_fuses=0xff symmetric60.bootloader.low_fuses=0xff
symmetric60.bootloader.high_fuses=0xd8 symmetric60.bootloader.high_fuses=0xd8
symmetric60.bootloader.extended_fuses=0xcb symmetric60.bootloader.extended_fuses=0xcb
symmetric60.bootloader.path=caterina symmetric60.bootloader.file=caterina/Caterina-Micro.hex
symmetric60.bootloader.file=Caterina-symmetric60.hex
symmetric60.bootloader.unlock_bits=0x3F symmetric60.bootloader.unlock_bits=0x3F
symmetric60.bootloader.lock_bits=0x2F symmetric60.bootloader.lock_bits=0x2F
symmetric60.build.mcu=atmega32u4 symmetric60.build.mcu=atmega32u4
symmetric60.build.f_cpu=16000000L symmetric60.build.f_cpu=16000000L
symmetric60.build.vid=0x2341 symmetric60.build.vid=0x2341
symmetric60.build.pid=0x8037 symmetric60.build.pid=0x8037
symmetric60.build.usb_product="Keyboardio Symmetric60"
symmetric60.build.board=AVR_MICRO
symmetric60.build.core=keyboardio symmetric60.build.core=keyboardio
symmetric60.build.variant=symmetric60 symmetric60.build.variant=symmetric60
symmetric60.build.extra_flags={build.usb_flags}

@ -56,10 +56,6 @@ static uint32_t CurrAddress;
*/ */
static bool RunBootloader = true; static bool RunBootloader = true;
/* Pulse generation counters to keep track of the time remaining for each pulse type */
#define TX_RX_LED_PULSE_PERIOD 100
uint16_t TxLEDPulse = 0; // time remaining for Tx LED pulse
uint16_t RxLEDPulse = 0; // time remaining for Rx LED pulse
/* Bootloader timeout timer */ /* Bootloader timeout timer */
#define TIMEOUT_PERIOD 8000 #define TIMEOUT_PERIOD 8000
@ -82,28 +78,11 @@ void StartSketch(void)
MCUCR = (1 << IVCE); MCUCR = (1 << IVCE);
MCUCR = 0; MCUCR = 0;
L_LED_OFF();
TX_LED_OFF();
RX_LED_OFF();
/* jump to beginning of application space */ /* jump to beginning of application space */
__asm__ volatile("jmp 0x0000"); __asm__ volatile("jmp 0x0000");
} }
/* Breathing animation on L LED indicates bootloader is running */
uint16_t LLEDPulse;
void LEDPulse(void)
{
LLEDPulse++;
uint8_t p = LLEDPulse >> 8;
if (p > 127)
p = 254-p;
p += p;
if (((uint8_t)LLEDPulse) > p)
L_LED_OFF();
else
L_LED_ON();
}
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously /** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until it times out or is instructed to exit. * runs the bootloader processing routine until it times out or is instructed to exit.
@ -129,7 +108,7 @@ int main(void)
StartSketch(); StartSketch();
} else if ((mcusr_state & (1<<WDRF)) && (bootKeyPtrVal != bootKey) && (pgm_read_word(0) != 0xFFFF)) { } else if ((mcusr_state & (1<<WDRF)) && (bootKeyPtrVal != bootKey) && (pgm_read_word(0) != 0xFFFF)) {
// If it looks like an "accidental" watchdog reset then start the sketch. // If it looks like an "accidental" watchdog reset then start the sketch.
StartSketch(); // StartSketch();
} }
/* Setup hardware required for the bootloader */ /* Setup hardware required for the bootloader */
@ -148,7 +127,6 @@ int main(void)
if (Timeout > TIMEOUT_PERIOD) if (Timeout > TIMEOUT_PERIOD)
RunBootloader = false; RunBootloader = false;
LEDPulse();
} }
/* Disconnect from the host - USB interface will be reset later along with the AVR */ /* Disconnect from the host - USB interface will be reset later along with the AVR */
@ -172,11 +150,7 @@ void SetupHardware(void)
MCUCR = (1 << IVCE); MCUCR = (1 << IVCE);
MCUCR = (1 << IVSEL); MCUCR = (1 << IVSEL);
LED_SETUP();
CPU_PRESCALE(0); CPU_PRESCALE(0);
L_LED_OFF();
TX_LED_OFF();
RX_LED_OFF();
/* Initialize TIMER1 to handle bootloader timeout and LED tasks. /* Initialize TIMER1 to handle bootloader timeout and LED tasks.
* With 16 MHz clock and 1/64 prescaler, timer 1 is clocked at 250 kHz * With 16 MHz clock and 1/64 prescaler, timer 1 is clocked at 250 kHz
@ -200,11 +174,6 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
TCNT1H = 0; TCNT1H = 0;
TCNT1L = 0; TCNT1L = 0;
/* Check whether the TX or RX LED one-shot period has elapsed. if so, turn off the LED */
if (TxLEDPulse && !(--TxLEDPulse))
TX_LED_OFF();
if (RxLEDPulse && !(--RxLEDPulse))
RX_LED_OFF();
if (pgm_read_word(0) != 0xFFFF) if (pgm_read_word(0) != 0xFFFF)
Timeout++; Timeout++;
@ -444,8 +413,6 @@ static void WriteNextResponseByte(const uint8_t Response)
/* Write the next byte to the IN endpoint */ /* Write the next byte to the IN endpoint */
Endpoint_Write_8(Response); Endpoint_Write_8(Response);
TX_LED_ON();
TxLEDPulse = TX_RX_LED_PULSE_PERIOD;
} }
#define STK_OK 0x10 #define STK_OK 0x10
@ -474,8 +441,6 @@ void CDC_Task(void)
if (!(Endpoint_IsOUTReceived())) if (!(Endpoint_IsOUTReceived()))
return; return;
RX_LED_ON();
RxLEDPulse = TX_RX_LED_PULSE_PERIOD;
/* Read in the bootloader command (first byte sent from host) */ /* Read in the bootloader command (first byte sent from host) */
uint8_t Command = FetchNextCommandByte(); uint8_t Command = FetchNextCommandByte();

@ -49,14 +49,14 @@
# USB vendor ID (VID) # USB vendor ID (VID)
# reuse of this VID by others is forbidden by USB-IF # reuse of this VID by others is forbidden by USB-IF
# official Arduino LLC VID # official Arduino LLC VID
# VID = 0x2341 VID = 0x2341
# USB product ID (PID) # USB product ID (PID)
# official Leonardo PID # official Leonardo PID
# PID = 0x0036 # PID = 0x0036
# official Micro PID # official Micro PID
# PID = 0x0037 PID = 0x0037
# official Esplora PID # official Esplora PID
# PID = 0x003C # PID = 0x003C
@ -127,7 +127,7 @@ OBJDIR = .
# Path to the LUFA library # Path to the LUFA library
LUFA_PATH = ../../../../../../LUFA/LUFA-111009 LUFA_PATH = ../../../../../../../../git/LUFA/LUFA-111009
# LUFA library compile-time options and predefined tokens # LUFA library compile-time options and predefined tokens

@ -1 +1,103 @@
# Arduino AVR Core and platform.
# ------------------------------
# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Keyboardio Keyboards name=Keyboardio Keyboards
# AVR compile variables
# ---------------------
# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
# -w flag added to avoid printing a wrong warning http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
# This is fixed in gcc 4.8.3 and will be removed as soon as we update the toolchain
compiler.c.elf.flags=-w -Os -Wl,--gc-sections
compiler.c.elf.cmd=avr-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=avr-g++
compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
compiler.ar.cmd=avr-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=avr-objcopy
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2hex.flags=-O ihex -R .eeprom
compiler.elf2hex.cmd=avr-objcopy
compiler.ldflags=
compiler.size.cmd=avr-size
# This can be overriden in boards.txt
build.extra_flags=
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.S.extra_flags=
compiler.cpp.extra_flags=
compiler.ar.extra_flags=
compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags=
# AVR compile patterns
# --------------------
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile S files
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
## Create eeprom
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
## Create hex
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
# AVR Uploader/Programmers tools
# ------------------------------
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
tools.avrdude.upload.params.verbose=-v
tools.avrdude.upload.params.quiet=-q -q
tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"
tools.avrdude.program.params.verbose=-v
tools.avrdude.program.params.quiet=-q -q
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
tools.avrdude.erase.params.verbose=-v
tools.avrdude.erase.params.quiet=-q -q
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m
tools.avrdude.bootloader.params.verbose=-v
tools.avrdude.bootloader.params.quiet=-q -q
tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.platform.path}/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m
# USB Default Flags
# Default blank usb manufacturer will be filled it at compile time
# - from numeric vendor ID, set to Unknown otherwise
build.usb_manufacturer=
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'

@ -93,15 +93,15 @@
#define NUM_DIGITAL_PINS 30 #define NUM_DIGITAL_PINS 30
#define NUM_ANALOG_INPUTS 12 #define NUM_ANALOG_INPUTS 12
#define TXLED0 PORTD &= ~(1<<5) #define TXLED0
#define TXLED1 PORTD |= (1<<5) #define TXLED1
#define RXLED0 PORTB &= ~(1<<0) #define RXLED0
#define RXLED1 PORTB |= (1<<0) #define RXLED1
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0), TXLED0, RXLED0 #define TX_RX_LED_INIT
#define SDA 2 #define SDA 2
#define SCL 3 #define SCL 3
#define LED_BUILTIN 13 #define LED_BUILTIN
// Map SPI port to 'new' pins D14..D17 // Map SPI port to 'new' pins D14..D17
#define SS 17 #define SS 17
@ -219,9 +219,9 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PE, // D7 - PE6 PE, // D7 - PE6
PB, // D8 - PB4 PB, // D8 - PB4
PB, // D9 - PB5 PB, // D9 - PB5 // this is a change by jesse for the sym60
PB, // D10 - PB6 PB, // D10 - PB6
PB, // D11 - PB7 PD, // D11 - PB7 -- changed to D5
PD, // D12 - PD6 PD, // D12 - PD6
PC, // D13 - PC7 PC, // D13 - PC7
@ -258,7 +258,7 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
_BV(4), // D8 - PB4 _BV(4), // D8 - PB4
_BV(5), // D9 - PB5 _BV(5), // D9 - PB5
_BV(6), // D10 - PB6 _BV(6), // D10 - PB6
_BV(7), // D11 - PB7 _BV(5), // D11 - PB7
_BV(6), // D12 - PD6 _BV(6), // D12 - PD6
_BV(7), // D13 - PC7 _BV(7), // D13 - PC7

Loading…
Cancel
Save