Skip to content

Commit ef06820

Browse files
committed
lpc1756 Bugfix dma enable RX and TX flipped
1 parent 5c9fcf7 commit ef06820

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

targets/core/nxp/lpc17xx/ssp.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,12 @@ namespace klib::core::lpc17xx::io {
297297
template <bool Enable, bool Read>
298298
static void dma_enable() {
299299
// set the new state
300-
Ssp::port->DMACR = (Ssp::port->DMACR & ~(0x1 << Read)) | (Enable << Read);
300+
if constexpr (Read) {
301+
Ssp::port->DMACR = (Ssp::port->DMACR & (~0x1)) | Enable;
302+
}
303+
else {
304+
Ssp::port->DMACR = (Ssp::port->DMACR & (~(0x1 << 1))) | (Enable << 1);
305+
}
301306
}
302307

303308
/**
@@ -325,7 +330,7 @@ namespace klib::core::lpc17xx::io {
325330
/**
326331
* @brief Returns the read/write transfer width of the ssp
327332
*
328-
* @return uint32_t* const
333+
* @return uint32_t
329334
*/
330335
template <bool Read>
331336
static uint32_t dma_width() {

0 commit comments

Comments
 (0)