diff options
-rw-r--r-- | software/avr.README | 2 | ||||
-rw-r--r-- | software/avr.defines.mk | 8 | ||||
-rw-r--r-- | software/avr.lib/led.c | 12 | ||||
-rw-r--r-- | software/avr.lib/serialio.c | 44 | ||||
-rw-r--r-- | software/avr.lib/serialio.h | 32 | ||||
-rw-r--r-- | software/avr.lib/util.c | 9 |
6 files changed, 103 insertions, 4 deletions
diff --git a/software/avr.README b/software/avr.README index a822bda..beafdcb 100644 --- a/software/avr.README +++ b/software/avr.README @@ -43,7 +43,7 @@ Build Getting the source via subversion: ---------------------------------- -svn co https://svn.spreadspace.org/avr/trunk avr +git clone git://git.spreadspace.org/avr.git cd avr diff --git a/software/avr.defines.mk b/software/avr.defines.mk index c2b92eb..cf0e361 100644 --- a/software/avr.defines.mk +++ b/software/avr.defines.mk @@ -120,6 +120,14 @@ ifeq ($(BOARD_TYPE),teenstep) PROG := DFU LUFA_BOARD = NONE endif +ifeq ($(BOARD_TYPE),rhmixxx) + MCU := at90usb1286 + ARCH = AVR8 + F_CPU := 16000000 + F_USB = $(F_CPU) + PROG := DFU + LUFA_BOARD = NONE +endif ifeq ($(BOARD_TYPE),arduinoUno) MCU := atmega328p ARCH = AVR8 diff --git a/software/avr.lib/led.c b/software/avr.lib/led.c index 593d97b..fd2754e 100644 --- a/software/avr.lib/led.c +++ b/software/avr.lib/led.c @@ -29,13 +29,15 @@ #elif defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__) || defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) || \ defined(__BOARD_arduinoNG__) || defined(__BOARD_arduino2009v2__) || defined(__BOARD_arduino2009__) || defined(__BOARD_arduino10000__) || \ defined(__BOARD_hhd70dongle__) || defined(__BOARD_rda1846dongle__) || defined(__BOARD_culV3__) || \ - defined(__BOARD_slowpandongle1__) || defined(__BOARD_slowpandongle2__) || defined(__BOARD_teenstep__) + defined(__BOARD_slowpandongle1__) || defined(__BOARD_slowpandongle2__) || defined(__BOARD_teenstep__) || \ + defined(__BOARD_rhmixxx__) #define NUM_LEDS 1 #else #define NUM_LEDS 0 #endif -#if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__) || defined(__BOARD_minimus__) || defined(__BOARD_minimus32__) +#if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__) || defined(__BOARD_minimus__) || defined(__BOARD_minimus32__) || \ + defined(__BOARD_rhmixxx__) #define LED_DIR 0 #else #define LED_DIR 1 @@ -76,6 +78,12 @@ #define LED_PINNUM 5 #endif +#if defined(__BOARD_rhmixxx__) +#define LED_PORT PORTE +#define LED_DDR DDRE +#define LED_PINNUM 0 +#endif + void led_init(void) { #if NUM_LEDS >= 1 diff --git a/software/avr.lib/serialio.c b/software/avr.lib/serialio.c new file mode 100644 index 0000000..fde2935 --- /dev/null +++ b/software/avr.lib/serialio.c @@ -0,0 +1,44 @@ +/* + * spreadspace avr utils + * + * + * Copyright (C) 2014 Christian Pointner <equinox@spreadspace.org> + * + * This file is part of spreadspace avr utils. + * + * spreadspace avr utils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * spreadspace avr utils is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdio.h> + +#include "serialio.h" +#include "LUFA/Drivers/Peripheral/Serial.h" + +static FILE serial_stream; + +void serialio_init(const uint32_t baudrate, const uint8_t doublespeed) +{ + Serial_Init(baudrate, doublespeed); + Serial_CreateStream(&serial_stream); + stdin = stdout = stderr = &serial_stream; +} + +void serialio_task(void) +{ +} + +int16_t serialio_bytes_received(void) +{ + return (int16_t)Serial_IsCharReceived(); +} diff --git a/software/avr.lib/serialio.h b/software/avr.lib/serialio.h new file mode 100644 index 0000000..3b0781e --- /dev/null +++ b/software/avr.lib/serialio.h @@ -0,0 +1,32 @@ +/* + * spreadspace avr utils + * + * + * Copyright (C) 2014 Christian Pointner <equinox@spreadspace.org> + * + * This file is part of spreadspace avr utils. + * + * spreadspace avr utils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * spreadspace avr utils is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SPREADAVR_serialio_h_INCLUDED +#define SPREADAVR_serialio_h_INCLUDED + +#include <stdint.h> + +void serialio_init(const uint32_t baudrate, const uint8_t doublespeed); +void serialio_task(void); +int16_t serialio_bytes_received(void); + +#endif diff --git a/software/avr.lib/util.c b/software/avr.lib/util.c index 104f2b6..7442b2c 100644 --- a/software/avr.lib/util.c +++ b/software/avr.lib/util.c @@ -66,6 +66,8 @@ void jtag_disable(void) #define BOOTLOADER_VEC 0x3800 #elif defined(__BOARD_slowpandongle1__) || defined(__BOARD_slowpandongle2__) || defined(__BOARD_teenstep__) #define BOOTLOADER_VEC 0x3800 +#elif defined(__BOARD_rhmixxx__) + #define BOOTLOADER_VEC 0xF000 #else #define BOOTLOADER_VEC 0x0000 #endif @@ -78,7 +80,7 @@ void reset2bootloader(void) #if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__) || defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) || \ defined(__BOARD_hhd70dongle__) || defined(__BOARD_rda1846dongle__) || defined(__BOARD_culV3__) || \ defined(__BOARD_slowpandongle1__) || defined(__BOARD_slowpandongle2__) || defined(__BOARD_teenstep__) || \ - defined(__BOARD_minimus__) || defined(__BOARD_minimus32__) + defined(__BOARD_rhmixxx__) || defined(__BOARD_minimus__) || defined(__BOARD_minimus32__) cli(); // disable watchdog, if enabled // disable all peripherals @@ -122,6 +124,11 @@ void reset2bootloader(void) TIMSK0 = 0; TIMSK1 = 0; TIMSK3 = 0; TIMSK4 = 0; UCSR1B = 0; TWCR = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; TWCR = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0; + #elif defined(__BOARD_rhmixxx__) + EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0; + TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0; + DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; + PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0; #endif start_bootloader(); #endif |