1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2024-12-22 07:18:52 -05:00

Merge pull request #5 from dsprenkels/atmega32u4

Add support for atmega32u4 chip
This commit is contained in:
Raphaël Assénat 2019-07-16 16:06:14 -04:00 committed by GitHub
commit 59c2627f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -54,10 +54,10 @@ justflash: $(HEXFILE)
./scripts/wait_then_flash.sh $(CPU) $(HEXFILE) ./scripts/wait_then_flash.sh $(CPU) $(HEXFILE)
chip_erase: chip_erase:
dfu-programmer atmega32u2 erase dfu-programmer $(CPU) erase
reset: reset:
dfu-programmer atmega32u2 reset dfu-programmer $(CPU) reset
restart: restart:
- ./scripts/enter_bootloader.sh - ./scripts/enter_bootloader.sh

4
usb.c
View File

@ -785,7 +785,7 @@ void usb_doTasks(void)
} }
} }
#if defined(__AVR_ATmega32U2__) #if defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega32U4__)
/* Atmega32u2 datasheet 8.11.6, PLLCSR. /* Atmega32u2 datasheet 8.11.6, PLLCSR.
* But register summary says PLLP0... */ * But register summary says PLLP0... */
@ -851,9 +851,11 @@ void usb_init(const struct usb_parameters *params)
USBCON |= (1<<FRZCLK); // initial value USBCON |= (1<<FRZCLK); // initial value
#ifdef UHWCON #ifdef UHWCON
UHWCON |= (1<<UVREGE); // Enable USB pad regulator UHWCON |= (1<<UVREGE); // Enable USB pad regulator
#if defined(UIDE) && defined(UIMOD)
UHWCON &= ~(1<<UIDE); UHWCON &= ~(1<<UIDE);
UHWCON |= (1<UIMOD); UHWCON |= (1<UIMOD);
#endif #endif
#endif
#ifdef UPOE #ifdef UPOE
UPOE = 0; // Disable direct drive of USB pins UPOE = 0; // Disable direct drive of USB pins