RISC-V/V003/hello/generator.cpp
2024-05-07 11:46:49 +02:00

14 lines
394 B
C++

#include "generator.h"
extern "C" const uint16_t sin_tab[0x100];
uint16_t Generator::step() {
const uint16_t v = sin_tab [base >> 24];
base += incr;
return v;
}
unsigned int Generator::Send(uint16_t * const ptr, const unsigned int len) {
for (unsigned n=0u; n<len; n++) ptr [n] = step();
if (ms_count) ms_count -= 1u; // průchod zde je za 1 ms přesně
return len;
}