Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds AT90USB162 support #11570

Merged
merged 3 commits into from
Jan 30, 2021
Merged

Adds AT90USB162 support #11570

merged 3 commits into from
Jan 30, 2021

Conversation

daskygit
Copy link
Member

@daskygit daskygit commented Jan 15, 2021

Description

Adds support for the AT90USB162.

After my previous PR failure I hope this one is smoother. I've ran make all:default and there are failures with some boards but they appear to happen on develop as well. I've compiled and flashed AT90USB162, ATmega32u4 and STM32F401 boards using this branch.

I've added preliminary support into spi_master, uart and serial but I've not tested these features but the registers, bits and pins line up with the datasheet. I've been able to test the changes to backlight_avr on a couple of accessible pins with hardware pwm. I'm a little unsure about the edit I've made to the max eeprom address in dynamic_keymap.c as it doesn't make an exception for the 16u2?

The MCU has no ADCs or support for I2C. I found a datasheet while creating a the first pull request stating the ATmega16u2 is functional equivalent to the AT90USB162 which lines up with the edits I've made.

I'm expecting to have missed something but hopefully not too much.

Edit:
For context this is to port existing hardware to QMK, I appreciate there's not likely going to be much call for this MCU. Any who thanks for your help and time.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@daskygit
Copy link
Member Author

Also I forgot to ask, in common_features there's a comment saying ATmegaxxU2 doesn't have a hardware MUL instruction.

When checking the avr instruction set they're listed as AVRe+ cores that should have the instruction with the only missing instructions being "ELPM, EIJMP, EICALL". It wouldn't be the first time the datasheets were wrong about something.

I've added the AT90USB162 as a precaution considering the ATmega16u2 should be a replacement and I guess the only downside being performance.

bootloader.mk Outdated Show resolved Hide resolved
bootloader.mk Outdated Show resolved Hide resolved
bootloader.mk Outdated Show resolved Hide resolved
data/schemas/keyboard.jsonschema Outdated Show resolved Hide resolved
docs/feature_backlight.md Show resolved Hide resolved
quantum/backlight/backlight_avr.c Outdated Show resolved Hide resolved
quantum/config_common.h Outdated Show resolved Hide resolved
quantum/mcu_selection.mk Outdated Show resolved Hide resolved
quantum/mcu_selection.mk Outdated Show resolved Hide resolved
tmk_core/common/uart.c Outdated Show resolved Hide resolved
@daskygit
Copy link
Member Author

Resolved merge conflicts with uart.c and keyboard.jsonschema.

@drashna drashna merged commit d92ffd1 into qmk:develop Jan 30, 2021
@daskygit daskygit deleted the at90usb162 branch February 6, 2021 01:16
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* at90usb162 support

* fix missing bracket

* Apply suggestions from code review

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants