@@ -40,9 +40,8 @@ pub enum Port {
4040 /// Port 0 Secure, available on nRF53
4141 #[ cfg( any( feature = "5340-app" ) ) ]
4242 Port0Secure ,
43-
44- /// Port 1, only available on some nRF52 MCUs.
45- #[ cfg( any( feature = "52833" , feature = "52840" ) ) ]
43+ /// Port 1, only available on some nRF52 MCUs and nRF5340.
44+ #[ cfg( any( feature = "52833" , feature = "52840" , feature = "5340-net" ) ) ]
4645 Port1 ,
4746}
4847
@@ -63,18 +62,26 @@ pub struct Pin<MODE> {
6362#[ cfg( feature = "51" ) ]
6463use crate :: pac:: { gpio, GPIO as P0 } ;
6564
66- #[ cfg( any( feature = "5340-app" , feature = "9160" ) ) ]
65+ #[ cfg( any( feature = "5340-app" , feature = "5340-net" , feature = " 9160") ) ]
6766use crate :: pac:: { p0_ns as gpio, P0_NS as P0 } ;
6867
6968#[ cfg( feature = "5340-app" ) ]
7069use crate :: pac:: P0_S ;
7170
72- #[ cfg( not( any( feature = "9160" , feature = "5340-app" , feature = "51" ) ) ) ]
71+ #[ cfg( not( any(
72+ feature = "9160" ,
73+ feature = "5340-app" ,
74+ feature = "5340-net" ,
75+ feature = "51"
76+ ) ) ) ]
7377use crate :: pac:: { p0 as gpio, P0 } ;
7478
7579#[ cfg( any( feature = "52833" , feature = "52840" ) ) ]
7680use crate :: pac:: P1 ;
7781
82+ #[ cfg( feature = "5340-net" ) ]
83+ use crate :: pac:: P1_NS as P1 ;
84+
7885use crate :: hal:: digital:: v2:: { InputPin , OutputPin , StatefulOutputPin } ;
7986use void:: Void ;
8087
@@ -84,7 +91,7 @@ impl<MODE> Pin<MODE> {
8491 Port :: Port0 => 0x00 ,
8592 #[ cfg( any( feature = "5340-app" ) ) ]
8693 Port :: Port0Secure => 0x20 ,
87- #[ cfg( any( feature = "52833" , feature = "52840" ) ) ]
94+ #[ cfg( any( feature = "52833" , feature = "52840" , feature = "5340-net" ) ) ]
8895 Port :: Port1 => 0x20 ,
8996 } ;
9097 Self {
@@ -102,20 +109,30 @@ impl<MODE> Pin<MODE> {
102109
103110 #[ inline]
104111 pub fn pin ( & self ) -> u8 {
105- #[ cfg( any( feature = "52833" , feature = "52840" , feature = "5340-app" ) ) ]
112+ #[ cfg( any(
113+ feature = "52833" ,
114+ feature = "52840" ,
115+ feature = "5340-app" ,
116+ feature = "5340-net"
117+ ) ) ]
106118 {
107119 self . pin_port & 0x1f
108120 }
109121
110- #[ cfg( not( any( feature = "52833" , feature = "52840" , feature = "5340-app" ) ) ) ]
122+ #[ cfg( not( any(
123+ feature = "52833" ,
124+ feature = "52840" ,
125+ feature = "5340-app" ,
126+ feature = "5340-net"
127+ ) ) ) ]
111128 {
112129 self . pin_port
113130 }
114131 }
115132
116133 #[ inline]
117134 pub fn port ( & self ) -> Port {
118- #[ cfg( any( feature = "52833" , feature = "52840" ) ) ]
135+ #[ cfg( any( feature = "52833" , feature = "52840" , feature = "5340-net" ) ) ]
119136 {
120137 if self . pin_port & 0x20 == 0 {
121138 Port :: Port0
@@ -132,8 +149,12 @@ impl<MODE> Pin<MODE> {
132149 Port :: Port0Secure
133150 }
134151 }
135-
136- #[ cfg( not( any( feature = "52833" , feature = "52840" , feature = "5340-app" ) ) ) ]
152+ #[ cfg( not( any(
153+ feature = "52833" ,
154+ feature = "52840" ,
155+ feature = "5340-app" ,
156+ feature = "5340-net"
157+ ) ) ) ]
137158 {
138159 Port :: Port0
139160 }
@@ -147,9 +168,9 @@ impl<MODE> Pin<MODE> {
147168 fn block ( & self ) -> & gpio:: RegisterBlock {
148169 let ptr = match self . port ( ) {
149170 Port :: Port0 => P0 :: ptr ( ) ,
150- #[ cfg( any ( feature = "5340-app" ) ) ]
171+ #[ cfg( feature = "5340-app" ) ]
151172 Port :: Port0Secure => P0_S :: ptr ( ) ,
152- #[ cfg( any( feature = "52833" , feature = "52840" ) ) ]
173+ #[ cfg( any( feature = "52833" , feature = "52840" , feature = "5340-net" ) ) ]
153174 Port :: Port1 => P1 :: ptr ( ) ,
154175 } ;
155176
@@ -339,10 +360,15 @@ pub enum OpenDrainConfig {
339360#[ cfg( feature = "51" ) ]
340361use crate :: pac:: gpio:: pin_cnf;
341362
342- #[ cfg( any( feature = "5340-app" , feature = "9160" ) ) ]
363+ #[ cfg( any( feature = "5340-app" , feature = "5340-net" , feature = " 9160") ) ]
343364use crate :: pac:: p0_ns:: pin_cnf;
344365
345- #[ cfg( not( any( feature = "9160" , feature = "5340-app" , feature = "51" ) ) ) ]
366+ #[ cfg( not( any(
367+ feature = "9160" ,
368+ feature = "5340-app" ,
369+ feature = "5340-net" ,
370+ feature = "51"
371+ ) ) ) ]
346372use crate :: pac:: p0:: pin_cnf;
347373
348374impl OpenDrainConfig {
@@ -647,7 +673,7 @@ gpio!(P0, p0, p0, Port::Port0, [
647673
648674// The p1 types are present in the p0 module generated from the
649675// svd, but we want to export them in a p1 module from this crate.
650- #[ cfg( any( feature = "52833" , feature = "52840" ) ) ]
676+ #[ cfg( any( feature = "52833" , feature = "52840" , feature = "5340-net" ) ) ]
651677gpio ! ( P1 , p0, p1, Port :: Port1 , [
652678 P1_00 : ( p1_00, 0 , Disconnected ) ,
653679 P1_01 : ( p1_01, 1 , Disconnected ) ,
@@ -667,7 +693,7 @@ gpio!(P1, p0, p1, Port::Port1, [
667693 P1_15 : ( p1_15, 15 , Disconnected ) ,
668694] ) ;
669695
670- #[ cfg( any ( feature = "5340-app" ) ) ]
696+ #[ cfg( feature = "5340-app" ) ]
671697gpio ! ( P0_S , p0, p0_s, Port :: Port0Secure , [
672698 P0_00 : ( p0_00, 0 , Disconnected ) ,
673699 P0_01 : ( p0_01, 1 , Disconnected ) ,
0 commit comments