avr/base/base.c

22 lines
398 B
C

#include "base.h"
rng_t rng_new(uint8_t seed) {
rng_t rng = { .mod = 255, .a = 253, .c = 41, .seed = seed };
return rng;
}
uint8_t rng_sample(rng_t *state) {
state->seed = (state->a * state->seed + state->c) % state->mod;
return state->seed;
}
/*
void strobe_line(gpio_t *line, uint32_t us) {
set_line(line);
_delay_us(us);
clear_line(line);
_delay_us(us);
}
*/