Add reset.

This commit is contained in:
Phil Hagelberg 2019-07-03 20:31:42 -07:00
parent d2a39a5cc4
commit 1b49ec4319
3 changed files with 16 additions and 2 deletions

View file

@ -11,8 +11,7 @@
(define (set-layer n)
(lambda () (set! current-layer (vector-ref layers n))))
(define (reset)
#f) ;; TODO: uh, seriously. I need this. how.
(define (reset) (call-c-func "reset"))
;;;; layers

View file

@ -601,3 +601,14 @@ ISR(USB_COM_vect)
}
UECONX = (1<<STALLRQ) | (1<<EPEN); // stall
}
void reset(void) {
UDCON = 1; USBCON = (1<<FRZCLK); UCSR1B = 0;
// _delay_ms(5);
EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
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;
*(uint16_t *)0x0800 = 0x7777;
wdt_enable(WDTO_120MS);
};

View file

@ -12,6 +12,10 @@ extern uint8_t keyboard_modifier_keys;
extern uint8_t keyboard_keys[6];
extern volatile uint8_t keyboard_leds;
#include <avr/wdt.h>
// #include <util/delay.h>
void reset(void);
// This file does not include the HID debug functions, so these empty
// macros replace them with nothing, so users can compile code that
// has calls to these functions.