| 90 | } |
| 91 | |
| 92 | bool commit(bool use_dma, bool raise_irq) |
| 93 | { |
| 94 | const state& current_state = _current_state(); |
| 95 | |
| 96 | if(int elements = current_state.elements) |
| 97 | { |
| 98 | const uint16_t* source_ptr = current_state.source_ptr; |
| 99 | const uint16_t* initial_copy_source_ptr = source_ptr + ((display::height() - 1) * elements); |
| 100 | uint16_t* destination_ptr = current_state.destination_ptr; |
| 101 | |
| 102 | if(use_dma) |
| 103 | { |
| 104 | hw::dma::copy_half_words(initial_copy_source_ptr, elements, destination_ptr); |
| 105 | } |
| 106 | else |
| 107 | { |
| 108 | hw::memory::copy_half_words(initial_copy_source_ptr, elements, destination_ptr); |
| 109 | } |
| 110 | |
| 111 | if(raise_irq) |
| 112 | { |
| 113 | hw::dma::start_hdma_irq(_channel, source_ptr, elements, destination_ptr); |
| 114 | } |
| 115 | else |
| 116 | { |
| 117 | hw::dma::start_hdma(_channel, source_ptr, elements, destination_ptr); |
| 118 | } |
| 119 | |
| 120 | return true; |
| 121 | } |
| 122 | |
| 123 | hw::dma::stop_hdma(_channel); |
| 124 | return false; |
| 125 | } |
| 126 | |
| 127 | private: |
| 128 | state _states[2]; |
no test coverage detected