@@ -243,6 +243,18 @@ macro_rules! generate_reg_read {
243243 }
244244
245245 impl [ <$servo_name: camel Controller >] {
246+ #[ doc = concat!( "Read raw register *" , stringify!( $name) , "* (addr: " , stringify!( $addr) , ", type: " , stringify!( <$conv as Conversion >:: UsiType ) , ")" ) ]
247+ pub fn [ <read_raw_ $reg_name>] (
248+ & mut self ,
249+ ids: & [ u8 ] ,
250+ ) -> $crate:: Result <Vec <$reg_type>> {
251+ [ <sync_read_raw_ $reg_name>] (
252+ self . dph. as_ref( ) . unwrap( ) ,
253+ self . serial_port. as_mut( ) . unwrap( ) . as_mut( ) ,
254+ ids,
255+ )
256+ }
257+
246258 #[ doc = concat!( "Read register *" , stringify!( $name) , "* (addr: " , stringify!( $addr) , ", type: " , stringify!( $reg_type) , ")" ) ]
247259 pub fn [ <read_ $reg_name>] (
248260 & mut self ,
@@ -259,6 +271,20 @@ macro_rules! generate_reg_read {
259271 #[ cfg( feature = "python" ) ]
260272 #[ pymethods]
261273 impl [ <$servo_name: camel SyncController >] {
274+ #[ doc = concat!( "Read raw register *" , stringify!( $name) , "* (addr: " , stringify!( $addr) , ", type: " , stringify!( $reg_type) , ")" ) ]
275+ pub fn [ <read_raw_ $reg_name>] (
276+ & self ,
277+ py: Python ,
278+ ids: & Bound <' _, pyo3:: types:: PyList >,
279+ ) -> PyResult <PyObject > {
280+ let ids = ids. extract:: <Vec <u8 >>( ) ?;
281+
282+ let x = self . 0 . lock( ) . unwrap( ) . [ <read_raw_ $reg_name>] ( & ids)
283+ . map_err( |e| pyo3:: exceptions:: PyRuntimeError :: new_err( e. to_string( ) ) ) ?;
284+ let l = pyo3:: types:: PyList :: new( py, x. clone( ) ) ?;
285+ Ok ( l. into( ) )
286+ }
287+
262288 #[ doc = concat!( "Read register *" , stringify!( $name) , "* (addr: " , stringify!( $addr) , ", type: " , stringify!( $reg_type) , ")" ) ]
263289 pub fn [ <read_ $reg_name>] (
264290 & self ,
@@ -400,6 +426,20 @@ macro_rules! generate_reg_write {
400426 }
401427
402428 impl [ <$servo_name: camel Controller >] {
429+ #[ doc = concat!( "Write raw register *" , stringify!( $name) , "* (addr: " , stringify!( $addr) , ", type: " , stringify!( $reg_type) , ")" ) ]
430+ pub fn [ <write_raw_ $reg_name>] (
431+ & mut self ,
432+ ids: & [ u8 ] ,
433+ values: & [ $reg_type] ,
434+ ) -> $crate:: Result <( ) > {
435+ [ <sync_write_raw_ $reg_name>] (
436+ self . dph. as_ref( ) . unwrap( ) ,
437+ self . serial_port. as_mut( ) . unwrap( ) . as_mut( ) ,
438+ ids,
439+ values,
440+ )
441+ }
442+
403443 #[ doc = concat!( "Write register *" , stringify!( $name) , "* (addr: " , stringify!( $addr) , ", type: " , stringify!( <$conv as Conversion >:: UsiType ) , ")" ) ]
404444 pub fn [ <write_ $reg_name>] (
405445 & mut self ,
@@ -418,6 +458,20 @@ macro_rules! generate_reg_write {
418458 #[ cfg( feature = "python" ) ]
419459 #[ pymethods]
420460 impl [ <$servo_name: camel SyncController >] {
461+ #[ doc = concat!( "Write raw register *" , stringify!( $name) , "* (addr: " , stringify!( $addr) , ", type: " , stringify!( $reg_type) , ")" ) ]
462+ pub fn [ <write_raw_ $reg_name>] (
463+ & self ,
464+ ids: Bound <' _, pyo3:: types:: PyList >,
465+ values: Bound <' _, pyo3:: types:: PyList >,
466+ ) -> PyResult <( ) > {
467+ let ids = ids. extract:: <Vec <u8 >>( ) ?;
468+ let values = values. extract:: <Vec <$reg_type>>( ) ?;
469+
470+ self . 0 . lock( ) . unwrap( ) . [ <write_raw_ $reg_name>] ( & ids, & values) . map_err( |e| {
471+ pyo3:: exceptions:: PyRuntimeError :: new_err( e. to_string( ) )
472+ } )
473+ }
474+
421475 #[ doc = concat!( "Write register *" , stringify!( $name) , "* (addr: " , stringify!( $addr) , ", type: " , stringify!( $reg_type) , ")" ) ]
422476 pub fn [ <write_ $reg_name>] (
423477 & self ,
0 commit comments