-
Notifications
You must be signed in to change notification settings - Fork 55
esp32c5: expose LEDC gamma RAM peripheral #397
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
Open
Veanir
wants to merge
2
commits into
esp-rs:main
Choose a base branch
from
Veanir:fix/esp32c5-ledc-gamma-ram-pac
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #[repr(C)] | ||
| #[cfg_attr(feature = "impl-register-debug", derive(Debug))] | ||
| #[doc = "Register block"] | ||
| pub struct RegisterBlock { | ||
| channel: [CHANNEL; 6], | ||
| } | ||
| impl RegisterBlock { | ||
| #[doc = "0x00..0x180 - LEDC gamma fade configuration RAM for channel %s (16 entries, 64 bytes)."] | ||
| #[inline(always)] | ||
| pub const fn channel(&self, n: usize) -> &CHANNEL { | ||
| &self.channel[n] | ||
| } | ||
| #[doc = "Iterator for array of:"] | ||
| #[doc = "0x00..0x180 - LEDC gamma fade configuration RAM for channel %s (16 entries, 64 bytes)."] | ||
| #[inline(always)] | ||
| pub fn channel_iter(&self) -> impl Iterator<Item = &CHANNEL> { | ||
| self.channel.iter() | ||
| } | ||
| } | ||
| #[doc = "LEDC gamma fade configuration RAM for channel %s (16 entries, 64 bytes)."] | ||
| pub use self::channel::CHANNEL; | ||
| #[doc = r"Cluster"] | ||
| #[doc = "LEDC gamma fade configuration RAM for channel %s (16 entries, 64 bytes)."] | ||
| pub mod channel; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #[repr(C)] | ||
| #[cfg_attr(feature = "impl-register-debug", derive(Debug))] | ||
| #[doc = "LEDC gamma fade configuration RAM for channel %s (16 entries, 64 bytes)."] | ||
| pub struct CHANNEL { | ||
| entry: [ENTRY; 16], | ||
| } | ||
| impl CHANNEL { | ||
| #[doc = "0x00..0x40 - LEDC gamma fade configuration RAM entry %s."] | ||
| #[inline(always)] | ||
| pub const fn entry(&self, n: usize) -> &ENTRY { | ||
| &self.entry[n] | ||
| } | ||
| #[doc = "Iterator for array of:"] | ||
| #[doc = "0x00..0x40 - LEDC gamma fade configuration RAM entry %s."] | ||
| #[inline(always)] | ||
| pub fn entry_iter(&self) -> impl Iterator<Item = &ENTRY> { | ||
| self.entry.iter() | ||
| } | ||
| } | ||
| #[doc = "ENTRY (rw) register accessor: LEDC gamma fade configuration RAM entry %s.\n\nYou can [`read`](crate::Reg::read) this register and get [`entry::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`entry::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@entry`] module"] | ||
| pub type ENTRY = crate::Reg<entry::ENTRY_SPEC>; | ||
| #[doc = "LEDC gamma fade configuration RAM entry %s."] | ||
| pub mod entry; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| #[doc = "Register `ENTRY%s` reader"] | ||
| pub type R = crate::R<ENTRY_SPEC>; | ||
| #[doc = "Register `ENTRY%s` writer"] | ||
| pub type W = crate::W<ENTRY_SPEC>; | ||
| #[doc = "Field `DUTY_INC` reader - Configures whether to increase duty in this fade range."] | ||
| pub type DUTY_INC_R = crate::BitReader; | ||
| #[doc = "Field `DUTY_INC` writer - Configures whether to increase duty in this fade range."] | ||
| pub type DUTY_INC_W<'a, REG> = crate::BitWriter<'a, REG>; | ||
| #[doc = "Field `DUTY_CYCLE` reader - Configures PWM overflows between duty updates in this fade range."] | ||
| pub type DUTY_CYCLE_R = crate::FieldReader<u16>; | ||
| #[doc = "Field `DUTY_CYCLE` writer - Configures PWM overflows between duty updates in this fade range."] | ||
| pub type DUTY_CYCLE_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>; | ||
| #[doc = "Field `SCALE` reader - Configures duty delta per update in this fade range."] | ||
| pub type SCALE_R = crate::FieldReader<u16>; | ||
| #[doc = "Field `SCALE` writer - Configures duty delta per update in this fade range."] | ||
| pub type SCALE_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>; | ||
| #[doc = "Field `DUTY_NUM` reader - Configures number of duty updates in this fade range."] | ||
| pub type DUTY_NUM_R = crate::FieldReader<u16>; | ||
| #[doc = "Field `DUTY_NUM` writer - Configures number of duty updates in this fade range."] | ||
| pub type DUTY_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>; | ||
| impl R { | ||
| #[doc = "Bit 0 - Configures whether to increase duty in this fade range."] | ||
| #[inline(always)] | ||
| pub fn duty_inc(&self) -> DUTY_INC_R { | ||
| DUTY_INC_R::new((self.bits & 1) != 0) | ||
| } | ||
| #[doc = "Bits 1:10 - Configures PWM overflows between duty updates in this fade range."] | ||
| #[inline(always)] | ||
| pub fn duty_cycle(&self) -> DUTY_CYCLE_R { | ||
| DUTY_CYCLE_R::new(((self.bits >> 1) & 0x03ff) as u16) | ||
| } | ||
| #[doc = "Bits 11:20 - Configures duty delta per update in this fade range."] | ||
| #[inline(always)] | ||
| pub fn scale(&self) -> SCALE_R { | ||
| SCALE_R::new(((self.bits >> 11) & 0x03ff) as u16) | ||
| } | ||
| #[doc = "Bits 21:30 - Configures number of duty updates in this fade range."] | ||
| #[inline(always)] | ||
| pub fn duty_num(&self) -> DUTY_NUM_R { | ||
| DUTY_NUM_R::new(((self.bits >> 21) & 0x03ff) as u16) | ||
| } | ||
| } | ||
| #[cfg(feature = "impl-register-debug")] | ||
| impl core::fmt::Debug for R { | ||
| fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
| f.debug_struct("ENTRY") | ||
| .field("duty_inc", &self.duty_inc()) | ||
| .field("duty_cycle", &self.duty_cycle()) | ||
| .field("scale", &self.scale()) | ||
| .field("duty_num", &self.duty_num()) | ||
| .finish() | ||
| } | ||
| } | ||
| impl W { | ||
| #[doc = "Bit 0 - Configures whether to increase duty in this fade range."] | ||
| #[inline(always)] | ||
| pub fn duty_inc(&mut self) -> DUTY_INC_W<'_, ENTRY_SPEC> { | ||
| DUTY_INC_W::new(self, 0) | ||
| } | ||
| #[doc = "Bits 1:10 - Configures PWM overflows between duty updates in this fade range."] | ||
| #[inline(always)] | ||
| pub fn duty_cycle(&mut self) -> DUTY_CYCLE_W<'_, ENTRY_SPEC> { | ||
| DUTY_CYCLE_W::new(self, 1) | ||
| } | ||
| #[doc = "Bits 11:20 - Configures duty delta per update in this fade range."] | ||
| #[inline(always)] | ||
| pub fn scale(&mut self) -> SCALE_W<'_, ENTRY_SPEC> { | ||
| SCALE_W::new(self, 11) | ||
| } | ||
| #[doc = "Bits 21:30 - Configures number of duty updates in this fade range."] | ||
| #[inline(always)] | ||
| pub fn duty_num(&mut self) -> DUTY_NUM_W<'_, ENTRY_SPEC> { | ||
| DUTY_NUM_W::new(self, 21) | ||
| } | ||
| } | ||
| #[doc = "LEDC gamma fade configuration RAM entry %s.\n\nYou can [`read`](crate::Reg::read) this register and get [`entry::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`entry::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] | ||
| pub struct ENTRY_SPEC; | ||
| impl crate::RegisterSpec for ENTRY_SPEC { | ||
| type Ux = u32; | ||
| } | ||
| #[doc = "`read()` method returns [`entry::R`](R) reader structure"] | ||
| impl crate::Readable for ENTRY_SPEC {} | ||
| #[doc = "`write(|w| ..)` method takes [`entry::W`](W) writer structure"] | ||
| impl crate::Writable for ENTRY_SPEC { | ||
| type Safety = crate::Unsafe; | ||
| } | ||
| #[doc = "`reset()` method sets ENTRY%s to value 0"] | ||
| impl crate::Resettable for ENTRY_SPEC {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| _add: | ||
| LEDC_GAMMA_RAM: | ||
| description: LEDC gamma fade configuration RAM. | ||
| groupName: LEDC_GAMMA_RAM | ||
| baseAddress: 0x60007400 | ||
| addressBlock: | ||
| - offset: 0x0 | ||
| size: 0x180 | ||
| usage: "Registers" | ||
|
|
||
| LEDC_GAMMA_RAM: | ||
| _add: | ||
| _clusters: | ||
| CHANNEL%s: | ||
| description: LEDC gamma fade configuration RAM for channel %s (16 entries, 64 bytes). | ||
| addressOffset: 0x0 | ||
| dim: 6 | ||
| dimIncrement: 0x40 | ||
| registers: | ||
| ENTRY%s: | ||
| description: LEDC gamma fade configuration RAM entry %s. | ||
| addressOffset: 0x0 | ||
| dim: 16 | ||
| dimIncrement: 0x4 | ||
| access: read-write | ||
| size: 32 | ||
| resetValue: 0x0 | ||
| fields: | ||
| DUTY_INC: | ||
| description: Configures whether to increase duty in this fade range. | ||
| bitOffset: 0 | ||
| bitWidth: 1 | ||
| access: read-write | ||
| DUTY_CYCLE: | ||
| description: Configures PWM overflows between duty updates in this fade range. | ||
| bitOffset: 1 | ||
| bitWidth: 10 | ||
| access: read-write | ||
| SCALE: | ||
| description: Configures duty delta per update in this fade range. | ||
| bitOffset: 11 | ||
| bitWidth: 10 | ||
| access: read-write | ||
| DUTY_NUM: | ||
| description: Configures number of duty updates in this fade range. | ||
| bitOffset: 21 | ||
| bitWidth: 10 | ||
| access: read-write | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
This shouldn't be its own peripheral, but a register block under LEDC, I think? Similar to how ECC and the other crypto drivers define their own little memories.