@@ -61,14 +61,17 @@ mod sealed {
61
61
pub trait ChannelGroup {
62
62
const CHG : usize ;
63
63
}
64
+
65
+ pub trait PpiSealed { }
66
+ pub trait PpiChannelGroupSealed { }
64
67
}
65
- use sealed:: { Channel , ChannelGroup , Event , NotFixed , Task } ;
68
+ use sealed:: { Channel , ChannelGroup , Event , NotFixed , PpiChannelGroupSealed , PpiSealed , Task } ;
66
69
67
70
pub struct TaskAddr ( pub ( crate ) u32 ) ;
68
71
pub struct EventAddr ( pub ( crate ) u32 ) ;
69
72
70
73
/// Trait to represent a Programmable Peripheral Interconnect channel.
71
- pub trait Ppi {
74
+ pub trait Ppi : PpiSealed {
72
75
/// Enables the channel.
73
76
fn enable ( & mut self ) ;
74
77
@@ -93,7 +96,7 @@ pub trait ConfigurablePpi: Ppi {
93
96
}
94
97
95
98
/// Trait for a PPI channel group.
96
- pub trait PpiChannelGroup {
99
+ pub trait PpiChannelGroup : PpiChannelGroupSealed {
97
100
/// Returns reference to `tasks_chg[x].en` endpoint for enabling channel group.
98
101
fn task_enable ( & self ) -> & Reg < u32 , _EN > ;
99
102
/// Returns reference to `tasks_chg[x].dis` endpoint for disabling channel group.
@@ -108,6 +111,7 @@ pub trait PpiChannelGroup {
108
111
109
112
// All unsafe `ptr` calls only uses registers atomically, and only changes the resources owned by
110
113
// the type (guaranteed by the abstraction).
114
+ impl < P : Channel > PpiSealed for P { }
111
115
impl < P : Channel > Ppi for P {
112
116
#[ inline( always) ]
113
117
fn enable ( & mut self ) {
@@ -151,6 +155,7 @@ impl<P: Channel + NotFixed> ConfigurablePpi for P {
151
155
}
152
156
}
153
157
158
+ impl < G : ChannelGroup > PpiChannelGroupSealed for G { }
154
159
impl < G : ChannelGroup > PpiChannelGroup for G {
155
160
#[ inline( always) ]
156
161
fn task_enable ( & self ) -> & Reg < u32 , _EN > {
0 commit comments