Skip to content

Commit

Permalink
Add ATSAMD20J18A chip
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaizen Wolf committed Dec 27, 2021
1 parent 6fbaf6f commit 5316edf
Show file tree
Hide file tree
Showing 300 changed files with 57,412 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ path = "../pac/atsamd21g"
version = "0.11"
optional = true

[dependencies.atsamd20j]
path = "../pac/atsamd20j"
version = "0.11"
optional = true

[dependencies.atsamd21j]
path = "../pac/atsamd21j"
version = "0.11"
Expand Down Expand Up @@ -170,6 +175,9 @@ samd11c = ["atsamd11c", "samd11"]
samd11c-rt = ["samd11c", "atsamd11c/rt"]
samd11d = ["atsamd11d", "samd11"]
samd11d-rt = ["samd11d", "atsamd11d/rt"]
samd20 = ["device"] # Convenience feature for shared configuration of samd20 chips.
samd20j = ["atsamd20j", "samd20", "min-samd20j"]
samd20j-rt = ["samd20j", "atsamd20j/rt"]
samd21 = ["device"] # Convenience feature for shared configuration of samd21 chips.
samd21e = ["atsamd21e", "samd21"]
samd21e-rt = ["samd21e", "atsamd21e/rt"]
Expand Down
3 changes: 3 additions & 0 deletions hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ pub use atsamd21e as pac;
#[cfg(feature = "samd21g")]
pub use atsamd21g as pac;

#[cfg(feature = "samd20j")]
pub use atsamd20j as pac;

#[cfg(feature = "samd21j")]
pub use atsamd21j as pac;

Expand Down
21 changes: 21 additions & 0 deletions pac/atsamd20j/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "atsamd20j"
description = "Peripheral access API for ATSAMD20J microcontrollers (generated using svd2rust)"
version = "0.1.0"
authors = ["Kaizen Sparc <[email protected]>"]
keywords = ["no-std", "arm", "cortex-m"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/atsamd-rs/atsamd"
readme = "README.md"

[dependencies]
bare-metal = "0.2"
cortex-m = "0.7.3"
vcell = "0.1.2"

[dependencies.cortex-m-rt]
version = "0.7"
optional = true

[features]
rt = ["cortex-m-rt/device"]
16 changes: 16 additions & 0 deletions pac/atsamd20j/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
if env::var_os("CARGO_FEATURE_RT").is_some() {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("device.x"))
.unwrap()
.write_all(include_bytes!("device.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=device.x");
}
println!("cargo:rerun-if-changed=build.rs");
}
25 changes: 25 additions & 0 deletions pac/atsamd20j/device.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
PROVIDE(PM = DefaultHandler);
PROVIDE(SYSCTRL = DefaultHandler);
PROVIDE(WDT = DefaultHandler);
PROVIDE(RTC = DefaultHandler);
PROVIDE(EIC = DefaultHandler);
PROVIDE(NVMCTRL = DefaultHandler);
PROVIDE(EVSYS = DefaultHandler);
PROVIDE(SERCOM0 = DefaultHandler);
PROVIDE(SERCOM1 = DefaultHandler);
PROVIDE(SERCOM2 = DefaultHandler);
PROVIDE(SERCOM3 = DefaultHandler);
PROVIDE(SERCOM4 = DefaultHandler);
PROVIDE(SERCOM5 = DefaultHandler);
PROVIDE(TC0 = DefaultHandler);
PROVIDE(TC1 = DefaultHandler);
PROVIDE(TC2 = DefaultHandler);
PROVIDE(TC3 = DefaultHandler);
PROVIDE(TC4 = DefaultHandler);
PROVIDE(TC5 = DefaultHandler);
PROVIDE(TC6 = DefaultHandler);
PROVIDE(TC7 = DefaultHandler);
PROVIDE(ADC = DefaultHandler);
PROVIDE(AC = DefaultHandler);
PROVIDE(DAC = DefaultHandler);

156 changes: 156 additions & 0 deletions pac/atsamd20j/src/ac.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control A"]
pub ctrla: CTRLA,
#[doc = "0x01 - Control B"]
pub ctrlb: CTRLB,
#[doc = "0x02 - Event Control"]
pub evctrl: EVCTRL,
#[doc = "0x04 - Interrupt Enable Clear"]
pub intenclr: INTENCLR,
#[doc = "0x05 - Interrupt Enable Set"]
pub intenset: INTENSET,
#[doc = "0x06 - Interrupt Flag Status and Clear"]
pub intflag: INTFLAG,
_reserved6: [u8; 1usize],
#[doc = "0x08 - Status A"]
pub statusa: STATUSA,
#[doc = "0x09 - Status B"]
pub statusb: STATUSB,
#[doc = "0x0a - Status C"]
pub statusc: STATUSC,
_reserved9: [u8; 1usize],
#[doc = "0x0c - Window Control"]
pub winctrl: WINCTRL,
_reserved10: [u8; 3usize],
#[doc = "0x10 - Comparator Control n"]
pub compctrl: [COMPCTRL; 2],
_reserved11: [u8; 8usize],
#[doc = "0x20 - Scaler n"]
pub scaler: [SCALER; 2],
}
#[doc = "Control A\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrla](ctrla) module"]
pub type CTRLA = crate::Reg<u8, _CTRLA>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _CTRLA;
#[doc = "`read()` method returns [ctrla::R](ctrla::R) reader structure"]
impl crate::Readable for CTRLA {}
#[doc = "`write(|w| ..)` method takes [ctrla::W](ctrla::W) writer structure"]
impl crate::Writable for CTRLA {}
#[doc = "Control A"]
pub mod ctrla;
#[doc = "Control B\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ctrlb](ctrlb) module"]
pub type CTRLB = crate::Reg<u8, _CTRLB>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _CTRLB;
#[doc = "`write(|w| ..)` method takes [ctrlb::W](ctrlb::W) writer structure"]
impl crate::Writable for CTRLB {}
#[doc = "Control B"]
pub mod ctrlb;
#[doc = "Event Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [evctrl](evctrl) module"]
pub type EVCTRL = crate::Reg<u16, _EVCTRL>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _EVCTRL;
#[doc = "`read()` method returns [evctrl::R](evctrl::R) reader structure"]
impl crate::Readable for EVCTRL {}
#[doc = "`write(|w| ..)` method takes [evctrl::W](evctrl::W) writer structure"]
impl crate::Writable for EVCTRL {}
#[doc = "Event Control"]
pub mod evctrl;
#[doc = "Interrupt Enable Clear\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [intenclr](intenclr) module"]
pub type INTENCLR = crate::Reg<u8, _INTENCLR>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _INTENCLR;
#[doc = "`read()` method returns [intenclr::R](intenclr::R) reader structure"]
impl crate::Readable for INTENCLR {}
#[doc = "`write(|w| ..)` method takes [intenclr::W](intenclr::W) writer structure"]
impl crate::Writable for INTENCLR {}
#[doc = "Interrupt Enable Clear"]
pub mod intenclr;
#[doc = "Interrupt Enable Set\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [intenset](intenset) module"]
pub type INTENSET = crate::Reg<u8, _INTENSET>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _INTENSET;
#[doc = "`read()` method returns [intenset::R](intenset::R) reader structure"]
impl crate::Readable for INTENSET {}
#[doc = "`write(|w| ..)` method takes [intenset::W](intenset::W) writer structure"]
impl crate::Writable for INTENSET {}
#[doc = "Interrupt Enable Set"]
pub mod intenset;
#[doc = "Interrupt Flag Status and Clear\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [intflag](intflag) module"]
pub type INTFLAG = crate::Reg<u8, _INTFLAG>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _INTFLAG;
#[doc = "`read()` method returns [intflag::R](intflag::R) reader structure"]
impl crate::Readable for INTFLAG {}
#[doc = "`write(|w| ..)` method takes [intflag::W](intflag::W) writer structure"]
impl crate::Writable for INTFLAG {}
#[doc = "Interrupt Flag Status and Clear"]
pub mod intflag;
#[doc = "Status A\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [statusa](statusa) module"]
pub type STATUSA = crate::Reg<u8, _STATUSA>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _STATUSA;
#[doc = "`read()` method returns [statusa::R](statusa::R) reader structure"]
impl crate::Readable for STATUSA {}
#[doc = "Status A"]
pub mod statusa;
#[doc = "Status B\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [statusb](statusb) module"]
pub type STATUSB = crate::Reg<u8, _STATUSB>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _STATUSB;
#[doc = "`read()` method returns [statusb::R](statusb::R) reader structure"]
impl crate::Readable for STATUSB {}
#[doc = "Status B"]
pub mod statusb;
#[doc = "Status C\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [statusc](statusc) module"]
pub type STATUSC = crate::Reg<u8, _STATUSC>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _STATUSC;
#[doc = "`read()` method returns [statusc::R](statusc::R) reader structure"]
impl crate::Readable for STATUSC {}
#[doc = "Status C"]
pub mod statusc;
#[doc = "Window Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [winctrl](winctrl) module"]
pub type WINCTRL = crate::Reg<u8, _WINCTRL>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _WINCTRL;
#[doc = "`read()` method returns [winctrl::R](winctrl::R) reader structure"]
impl crate::Readable for WINCTRL {}
#[doc = "`write(|w| ..)` method takes [winctrl::W](winctrl::W) writer structure"]
impl crate::Writable for WINCTRL {}
#[doc = "Window Control"]
pub mod winctrl;
#[doc = "Comparator Control n\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [compctrl](compctrl) module"]
pub type COMPCTRL = crate::Reg<u32, _COMPCTRL>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _COMPCTRL;
#[doc = "`read()` method returns [compctrl::R](compctrl::R) reader structure"]
impl crate::Readable for COMPCTRL {}
#[doc = "`write(|w| ..)` method takes [compctrl::W](compctrl::W) writer structure"]
impl crate::Writable for COMPCTRL {}
#[doc = "Comparator Control n"]
pub mod compctrl;
#[doc = "Scaler n\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [scaler](scaler) module"]
pub type SCALER = crate::Reg<u8, _SCALER>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _SCALER;
#[doc = "`read()` method returns [scaler::R](scaler::R) reader structure"]
impl crate::Readable for SCALER {}
#[doc = "`write(|w| ..)` method takes [scaler::W](scaler::W) writer structure"]
impl crate::Writable for SCALER {}
#[doc = "Scaler n"]
pub mod scaler;
Loading

0 comments on commit 5316edf

Please sign in to comment.