@@ -340,7 +340,8 @@ impl AnyChannel {
340340 mem_addr : * mut u32 ,
341341 mem_len : usize ,
342342 incr_mem : bool ,
343- data_size : WordSize ,
343+ mem_size : WordSize ,
344+ peripheral_size : WordSize ,
344345 options : TransferOptions ,
345346 ) {
346347 let info = self . info ( ) ;
@@ -380,8 +381,8 @@ impl AnyChannel {
380381 } ) ;
381382 ch. cr ( ) . write ( |w| {
382383 w. set_dir ( dir. into ( ) ) ;
383- w. set_msize ( data_size . into ( ) ) ;
384- w. set_psize ( data_size . into ( ) ) ;
384+ w. set_msize ( mem_size . into ( ) ) ;
385+ w. set_psize ( peripheral_size . into ( ) ) ;
385386 w. set_pl ( options. priority . into ( ) ) ;
386387 w. set_minc ( incr_mem) ;
387388 w. set_pinc ( false ) ;
@@ -414,8 +415,8 @@ impl AnyChannel {
414415 ch. mar ( ) . write_value ( mem_addr as u32 ) ;
415416 ch. ndtr ( ) . write ( |w| w. set_ndt ( mem_len as u16 ) ) ;
416417 ch. cr ( ) . write ( |w| {
417- w. set_psize ( data_size . into ( ) ) ;
418- w. set_msize ( data_size . into ( ) ) ;
418+ w. set_psize ( peripheral_size . into ( ) ) ;
419+ w. set_msize ( mem_size . into ( ) ) ;
419420 w. set_minc ( incr_mem) ;
420421 w. set_dir ( dir. into ( ) ) ;
421422 w. set_teie ( true ) ;
@@ -602,27 +603,28 @@ impl<'a> Transfer<'a> {
602603 buf. len ( ) ,
603604 true ,
604605 W :: size ( ) ,
606+ W :: size ( ) ,
605607 options,
606608 )
607609 }
608610
609611 /// Create a new write DMA transfer (memory to peripheral).
610- pub unsafe fn new_write < W : Word > (
612+ pub unsafe fn new_write < MW : Word , PW : Word > (
611613 channel : impl Peripheral < P = impl Channel > + ' a ,
612614 request : Request ,
613- buf : & ' a [ W ] ,
614- peri_addr : * mut W ,
615+ buf : & ' a [ MW ] ,
616+ peri_addr : * mut PW ,
615617 options : TransferOptions ,
616618 ) -> Self {
617619 Self :: new_write_raw ( channel, request, buf, peri_addr, options)
618620 }
619621
620622 /// Create a new write DMA transfer (memory to peripheral), using raw pointers.
621- pub unsafe fn new_write_raw < W : Word > (
623+ pub unsafe fn new_write_raw < W : Word , PW : Word > (
622624 channel : impl Peripheral < P = impl Channel > + ' a ,
623625 request : Request ,
624626 buf : * const [ W ] ,
625- peri_addr : * mut W ,
627+ peri_addr : * mut PW ,
626628 options : TransferOptions ,
627629 ) -> Self {
628630 into_ref ! ( channel) ;
@@ -636,6 +638,7 @@ impl<'a> Transfer<'a> {
636638 buf. len ( ) ,
637639 true ,
638640 W :: size ( ) ,
641+ W :: size ( ) ,
639642 options,
640643 )
641644 }
@@ -660,6 +663,7 @@ impl<'a> Transfer<'a> {
660663 count,
661664 false ,
662665 W :: size ( ) ,
666+ W :: size ( ) ,
663667 options,
664668 )
665669 }
@@ -673,15 +677,23 @@ impl<'a> Transfer<'a> {
673677 mem_len : usize ,
674678 incr_mem : bool ,
675679 data_size : WordSize ,
680+ peripheral_size : WordSize ,
676681 options : TransferOptions ,
677682 ) -> Self {
678683 assert ! ( mem_len > 0 && mem_len <= 0xFFFF ) ;
679684
680685 channel. configure (
681- _request, dir, peri_addr, mem_addr, mem_len, incr_mem, data_size, options,
686+ _request,
687+ dir,
688+ peri_addr,
689+ mem_addr,
690+ mem_len,
691+ incr_mem,
692+ data_size,
693+ peripheral_size,
694+ options,
682695 ) ;
683696 channel. start ( ) ;
684-
685697 Self { channel }
686698 }
687699
@@ -814,6 +826,7 @@ impl<'a, W: Word> ReadableRingBuffer<'a, W> {
814826 len,
815827 true ,
816828 data_size,
829+ data_size,
817830 options,
818831 ) ;
819832
@@ -966,6 +979,7 @@ impl<'a, W: Word> WritableRingBuffer<'a, W> {
966979 len,
967980 true ,
968981 data_size,
982+ data_size,
969983 options,
970984 ) ;
971985
0 commit comments