-
Notifications
You must be signed in to change notification settings - Fork 215
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
Add support for ATmega8 #384
Conversation
b312cee
to
bbc517d
Compare
Thank you for that.
So, this PR is functionally already done. The thing is that I am not happy with the design choices I made, do you have any better idea on how to proceed? I am mainly not happy about the watchdog panic!()'s and usart without a proper macro. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry for only getting back to this PR now... Thanks for your work on ATmega8 support, anyway!
I've left some comments below, regarding the design topics you mentioned. For USART I do not see a great solution right now either, especially considering additional requirements which now came up for ATmega128A in #397...
Thank you for these comments, it's no problem at all that you could get to this PR now and not sooner. I think I have made all the changes you suggested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thank you!
Adds support for ATmega8 (Rahix/avr-device#112 has to be resolved first for this to work correctly).
ATmega8 is more challenging in some ways, because it does not work like the atmegas that were already implemented
My current solutions
I implemented a new macro that is named
impl_eeprom_atmega_old
. I am not sure if this name fits.I added paste macro and passed in a string name of the register
I created a no_didr macro that does not contain anything in the relevant method. I don't think there is anything else to be done in that method, but I may be wrong here. I have not used ADCs that much.
as ATmega8 looks very specific regarding USART, I decided to not even create a macro, but instead implement it directly in atmega-hal/wdt.rs. There is a few differences to usart macro, namely UCSRC and UBRRH are functions, UCSRC has to have set URSEL to one (that says UCSRC should be set instead of UBRRH as they share the same location in memory). UBRR is set by UBRRH and UBRRL instead of just UBRR.
I have used the closest values and put panic!() to 4k ms and 8k ms. I think there should be a better solution than this...
What do you think about these changes? Do you have better idea how to implement ATmega8?
I have tested EEPROM, USART, ADCs (and using ports of course) so far. I will try to test the rest in short time.