Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4941

General • Re: N phase shifted pwm signals

$
0
0
Just do this on the CPU using DMA.

Code:

    typedef uint32_t custom_t[5];        custom_t lut[4][10];        template <typename T> inline void PWM<T>::build_period(custom_t *result, uint8_t v0, uint8_t v1, uint8_t v2, uint8_t v3) {        if (result == nullptr) return;            SIMD::SIMD_QUARTER<T> *c[4] = { get_table(v0 % 10, 0), get_table(v1 % 10, 1), get_table(v2 % 10,  2), get_table(v3 % 10, 3) };            for (uint32_t i = 0; i < 5; i++) {            // Superscalar Operation (forgive the loads)            SIMD::SIMD_QUARTER<T> p = *c[0] | *c[1] | *c[2] | *c[3];                        (*result)[i] = p.v;            // Superscalar operation            for (uint32_t j = 0; j < 4; j++)                ++c[j];        }    }        template class PWM<uint32_t>;

Statistics: Posted by dthacher — Wed Nov 06, 2024 9:43 am



Viewing all articles
Browse latest Browse all 4941

Trending Articles