/*
 * rand.c: good enough for flashing led bits
 *
 * file creation: 20231031 0501
 */

#include "py32f0xx_conf.h"



uint8_t done = 0;



void rand_init(uint32_t init)
{
	if (done) return;

	CRC->CR = CRC_CR_RESET;
	while (CRC->CR & CRC_CR_RESET);

	CRC->DR = init;

	done = 1;
}

uint32_t rand()
{
	CRC->DR = 1;
	return CRC->DR;
}