@@ -31,9 +31,10 @@ namespace platform
3131 *
3232 * TODO: say something about the nature of implementation
3333 *
34- * @tparam DmaChannelTX DMA channel for sending
34+ * @tparam DmaChannelTX DMA channel for sending
3535 *
36- * @author Marton Ledneczki, Raphael Lehmann
36+ * @author Marton Ledneczki
37+ * @author Raphael Lehmann
3738 * @ingroup modm_platform_i2s modm_platform_i2s_{{id}}
3839 */
3940template <class DmaChannelTx>
@@ -46,10 +47,11 @@ class I2sMaster{{ id }} : public modm::I2sMaster
4647 Peripheral::Spi{{ id }}, DmaBase::Signal::Tx>::Request;
4748 };
4849
49- public:
50+ public: // TBD: private?
5051 using Hal = I2sHal{{ id }};
5152
5253
54+ public:
5355 template< class... Signals >
5456 static void
5557 connect()
@@ -83,11 +85,12 @@ public:
8385 Hal::initialize(odd_factor ? Hal::OddFactor::Enabled : Hal::OddFactor::Disabled,
8486 i2s_div);
8587
88+ dmaError = false;
8689 Dma::TxChannel::configure(
8790 DmaBase::DataTransferDirection::MemoryToPeripheral, DmaBase::MemoryDataSize::Bit16,
8891 DmaBase::PeripheralDataSize::Bit16, DmaBase::MemoryIncrementMode::Increment,
8992 DmaBase::PeripheralIncrementMode::Fixed, dmaPriority,
90- DmaBase::CircularMode::Disabled, DmaBase::DoubleBufferMode::Enabled );
93+ DmaBase::CircularMode::Disabled);
9194 Dma::TxChannel::setPeripheralAddress(SPI{{ id }}_BASE + 0x0c);
9295 Dma::TxChannel::setTransferErrorIrqHandler(handleDmaTransferError);
9396 Dma::TxChannel::enableInterruptVector();
@@ -97,40 +100,29 @@ public:
97100 }
98101
99102 static inline void
100- setTxBufferAddresses(uintptr_t first_address, uintptr_t second_address , std::size_t length)
103+ setTxBufferAddresses(uintptr_t address , std::size_t length)
101104 {
102- Dma::TxChannel::setMemoryAddress(first_address);
103- Dma::TxChannel::setMemoryAddress2(second_address);
105+ Dma::TxChannel::setMemoryAddress(address);
104106 Dma::TxChannel::setDataLength(length);
105107 }
106108
107109 static inline void
108- setTxBufferAddress1(uintptr_t first_address)
109- {
110- Dma::TxChannel::setMemoryAddress(first_address);
111- }
112-
113- static inline void
114- setTxBufferAddress2( uintptr_t second_address)
115- {
116- Dma::TxChannel::setMemoryAddress2(second_address);
117- }
118-
119- static inline bool
120- isBuffer1Active()
110+ setTransferCompleteIrqHandler(DmaBase::IrqHandler handleDmaTransferComplete)
121111 {
122- return Dma::TxChannel::isPrimaryBufferActive( );
112+ Dma::TxChannel::setTransferCompleteIrqHandler(handleDmaTransferComplete );
123113 }
124114
125115 static inline void
126116 start()
127117 {
128118 Dma::TxChannel::start();
119+ Hal::start();
129120 }
130121
131122 static inline void
132123 stop()
133124 {
125+ //Hal::stop();
134126 Dma::TxChannel::stop();
135127 }
136128
0 commit comments