@@ -61,14 +61,17 @@ mod sealed {
6161 pub trait ChannelGroup {
6262 const CHG : usize ;
6363 }
64+
65+ pub trait PpiSealed { }
66+ pub trait PpiChannelGroupSealed { }
6467}
65- use sealed:: { Channel , ChannelGroup , Event , NotFixed , Task } ;
68+ use sealed:: { Channel , ChannelGroup , Event , NotFixed , PpiChannelGroupSealed , PpiSealed , Task } ;
6669
6770pub struct TaskAddr ( pub ( crate ) u32 ) ;
6871pub struct EventAddr ( pub ( crate ) u32 ) ;
6972
7073/// Trait to represent a Programmable Peripheral Interconnect channel.
71- pub trait Ppi {
74+ pub trait Ppi : PpiSealed {
7275 /// Enables the channel.
7376 fn enable ( & mut self ) ;
7477
@@ -93,7 +96,7 @@ pub trait ConfigurablePpi: Ppi {
9396}
9497
9598/// Trait for a PPI channel group.
96- pub trait PpiChannelGroup {
99+ pub trait PpiChannelGroup : PpiChannelGroupSealed {
97100 /// Returns reference to `tasks_chg[x].en` endpoint for enabling channel group.
98101 fn task_enable ( & self ) -> & Reg < u32 , _EN > ;
99102 /// Returns reference to `tasks_chg[x].dis` endpoint for disabling channel group.
@@ -108,6 +111,7 @@ pub trait PpiChannelGroup {
108111
109112// All unsafe `ptr` calls only uses registers atomically, and only changes the resources owned by
110113// the type (guaranteed by the abstraction).
114+ impl < P : Channel > PpiSealed for P { }
111115impl < P : Channel > Ppi for P {
112116 #[ inline( always) ]
113117 fn enable ( & mut self ) {
@@ -151,6 +155,7 @@ impl<P: Channel + NotFixed> ConfigurablePpi for P {
151155 }
152156}
153157
158+ impl < G : ChannelGroup > PpiChannelGroupSealed for G { }
154159impl < G : ChannelGroup > PpiChannelGroup for G {
155160 #[ inline( always) ]
156161 fn task_enable ( & self ) -> & Reg < u32 , _EN > {
0 commit comments