-
Notifications
You must be signed in to change notification settings - Fork 237
Add ATtiny84A support #459
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
//! Common HAL (hardware abstraction layer) for ATtiny* microcontrollers. | ||
//! | ||
//! **Note**: This version of the documentation was built for | ||
#![cfg_attr(feature = "attiny84a", doc = "**ATtiny84a**.")] | ||
#![cfg_attr(feature = "attiny85", doc = "**ATtiny85**.")] | ||
#![cfg_attr(feature = "attiny88", doc = "**ATtiny88**.")] | ||
#![cfg_attr(feature = "attiny167", doc = "**ATtiny167**.")] | ||
|
@@ -25,6 +26,7 @@ compile_error!( | |
|
||
Please select one of the following | ||
|
||
* attiny84a | ||
* attiny85 | ||
* attiny88 | ||
* attiny167 | ||
|
@@ -35,6 +37,9 @@ compile_error!( | |
#[cfg(feature = "attiny84")] | ||
pub use avr_device::attiny84 as pac; | ||
|
||
#[cfg(feature = "attiny84a")] | ||
pub use avr_device::attiny84a as pac; | ||
|
||
/// Reexport of `attiny85` from `avr-device` | ||
#[cfg(feature = "attiny85")] | ||
pub use avr_device::attiny85 as pac; | ||
|
@@ -96,6 +101,13 @@ macro_rules! pins { | |
$crate::Pins::new($p.PORTA, $p.PORTB) | ||
}; | ||
} | ||
#[cfg(feature = "attiny84a")] | ||
#[macro_export] | ||
macro_rules! pins { | ||
($p:expr) => { | ||
$crate::Pins::new($p.PORTA, $p.PORTB) | ||
}; | ||
} | ||
Comment on lines
+104
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, just augment the -#[cfg(feature = "attiny84")]
+#[cfg(any(feature = "attiny84", feature = "attiny84a"))]
#[macro_export]
macro_rules! pins {
($p:expr) => { |
||
#[cfg(feature = "attiny85")] | ||
#[macro_export] | ||
macro_rules! pins { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,13 @@ avr_hal_generic::impl_port_traditional! { | |
B: crate::pac::PORTB = [0, 1, 2, 3], | ||
} | ||
} | ||
#[cfg(feature = "attiny84a")] | ||
avr_hal_generic::impl_port_traditional! { | ||
enum Ports { | ||
A: crate::pac::PORTA = [0, 1, 2, 3, 4, 5, 6, 7], | ||
B: crate::pac::PORTB = [0, 1, 2, 3], | ||
} | ||
} | ||
Comment on lines
+27
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of duplicating the values from -#[cfg(feature = "attiny84")]
+#[cfg(any(feature = "attiny84", feature = "attiny84a"))]
avr_hal_generic::impl_port_traditional! { |
||
|
||
#[cfg(feature = "attiny85")] | ||
avr_hal_generic::impl_port_traditional! { | ||
|
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.
So, this is a multi-level issue:
First of all, to not build the ADC module for this chip, it would be better to disable it at crate level. Here:
avr-hal/mcu/attiny-hal/src/lib.rs
Lines 65 to 69 in 21342dc
However, the chip does have an ADC so this code shouldn't fail to compile. The reason it does is probably that registers in
avr-device
are not correctly defined. I've already investigated this and opened Rahix/avr-device#151 to fix it.So I think the best course of action is to wait for the change to land in
avr-device
and then things should just work without the#[cfg(not())]
line.