@@ -38,11 +38,12 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
3838 let called: Cell < Option < ( u32 , ) > > = Cell :: new ( None ) ;
3939 share:: scope ( |subscribe| {
4040 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
41- let val = S :: command ( DRIVER_NUM , command:: SET_BRIGHTNESS , value as u32 , 0 ) . to_result ( ) ;
41+ S :: command ( DRIVER_NUM , command:: SET_BRIGHTNESS , value as u32 , 0 )
42+ . to_result :: < ( ) , _ > ( ) ?;
4243 loop {
4344 S :: yield_wait ( ) ;
4445 if let Some ( ( _, ) ) = called. get ( ) {
45- return val ;
46+ return Ok ( ( ) ) ;
4647 }
4748 }
4849 } )
@@ -53,11 +54,11 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
5354 let called: Cell < Option < ( u32 , ) > > = Cell :: new ( None ) ;
5455 share:: scope ( |subscribe| {
5556 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
56- let val = S :: command ( DRIVER_NUM , command:: SET_INVERT_ON , 0 , 0 ) . to_result ( ) ;
57+ S :: command ( DRIVER_NUM , command:: SET_INVERT_ON , 0 , 0 ) . to_result :: < ( ) , _ > ( ) ? ;
5758 loop {
5859 S :: yield_wait ( ) ;
5960 if let Some ( ( _, ) ) = called. get ( ) {
60- return val ;
61+ return Ok ( ( ) ) ;
6162 }
6263 }
6364 } )
@@ -68,11 +69,11 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
6869 let called: Cell < Option < ( u32 , ) > > = Cell :: new ( None ) ;
6970 share:: scope ( |subscribe| {
7071 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
71- let val = S :: command ( DRIVER_NUM , command:: SET_INVERT_OFF , 0 , 0 ) . to_result ( ) ;
72+ S :: command ( DRIVER_NUM , command:: SET_INVERT_OFF , 0 , 0 ) . to_result :: < ( ) , _ > ( ) ? ;
7273 loop {
7374 S :: yield_wait ( ) ;
7475 if let Some ( ( _, ) ) = called. get ( ) {
75- return val ;
76+ return Ok ( ( ) ) ;
7677 }
7778 }
7879 } )
@@ -119,6 +120,9 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
119120 share:: scope ( |subscribe| {
120121 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
121122 let val = S :: command ( DRIVER_NUM , command:: GET_ROTATION , 0 , 0 ) . to_result ( ) ;
123+ if val. is_err ( ) {
124+ return val;
125+ }
122126 loop {
123127 S :: yield_wait ( ) ;
124128 if let Some ( ( _, ) ) = called. get ( ) {
@@ -153,17 +157,17 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
153157 let called: Cell < Option < ( u32 , ) > > = Cell :: new ( None ) ;
154158 share:: scope ( |subscribe| {
155159 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
156- let val = S :: command (
160+ S :: command (
157161 DRIVER_NUM ,
158162 command:: SET_RESOLUTION ,
159163 width as u32 ,
160164 height as u32 ,
161165 )
162- . to_result ( ) ;
166+ . to_result :: < ( ) , _ > ( ) ? ;
163167 loop {
164168 S :: yield_wait ( ) ;
165169 if let Some ( ( _, ) ) = called. get ( ) {
166- return val ;
170+ return Ok ( ( ) ) ;
167171 }
168172 }
169173 } )
@@ -179,12 +183,12 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
179183 let called: Cell < Option < ( u32 , ) > > = Cell :: new ( None ) ;
180184 share:: scope ( |subscribe| {
181185 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
182- let val =
183- S :: command ( DRIVER_NUM , command :: SET_PIXEL_FORMAT , format as u32 , 0 ) . to_result ( ) ;
186+ S :: command ( DRIVER_NUM , command :: SET_PIXEL_FORMAT , format as u32 , 0 )
187+ . to_result :: < ( ) , _ > ( ) ? ;
184188 loop {
185189 S :: yield_wait ( ) ;
186190 if let Some ( ( _, ) ) = called. get ( ) {
187- return val ;
191+ return Ok ( ( ) ) ;
188192 }
189193 }
190194 } )
@@ -197,11 +201,11 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
197201 let called: Cell < Option < ( u32 , ) > > = Cell :: new ( None ) ;
198202 share:: scope ( |subscribe| {
199203 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
200- let val = S :: command ( DRIVER_NUM , command:: SET_WRITE_FRAME , data1, data2) . to_result ( ) ;
204+ S :: command ( DRIVER_NUM , command:: SET_WRITE_FRAME , data1, data2) . to_result :: < ( ) , _ > ( ) ? ;
201205 loop {
202206 S :: yield_wait ( ) ;
203207 if let Some ( ( _, ) ) = called. get ( ) {
204- return val ;
208+ return Ok ( ( ) ) ;
205209 }
206210 }
207211 } )
@@ -221,11 +225,11 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
221225 let ( allow_ro, subscribe) = handle. split ( ) ;
222226 S :: allow_ro :: < C , DRIVER_NUM , { allow_ro:: WRITE_BUFFER_ID } > ( allow_ro, s) ?;
223227 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
224- let val = S :: command ( DRIVER_NUM , command:: WRITE , s. len ( ) as u32 , 0 ) . to_result ( ) ;
228+ S :: command ( DRIVER_NUM , command:: WRITE , s. len ( ) as u32 , 0 ) . to_result :: < ( ) , _ > ( ) ? ;
225229 loop {
226230 S :: yield_wait ( ) ;
227231 if let Some ( ( _, ) ) = called. get ( ) {
228- return val ;
232+ return Ok ( ( ) ) ;
229233 }
230234 }
231235 } )
@@ -249,11 +253,11 @@ impl<S: Syscalls, C: Config> Screen<S, C> {
249253 let ( allow_ro, subscribe) = handle. split ( ) ;
250254 S :: allow_ro :: < C , DRIVER_NUM , { allow_ro:: WRITE_BUFFER_ID } > ( allow_ro, s) ?;
251255 S :: subscribe :: < _ , _ , C , DRIVER_NUM , { subscribe:: WRITE } > ( subscribe, & called) ?;
252- let val = S :: command ( DRIVER_NUM , command:: FILL , 0 , 0 ) . to_result ( ) ;
256+ S :: command ( DRIVER_NUM , command:: FILL , 0 , 0 ) . to_result :: < ( ) , _ > ( ) ? ;
253257 loop {
254258 S :: yield_wait ( ) ;
255259 if let Some ( ( _, ) ) = called. get ( ) {
256- return val ;
260+ return Ok ( ( ) ) ;
257261 }
258262 }
259263 } )
0 commit comments