add function for random sequence generation
parent
3fe135db8f
commit
c562d43cec
|
|
@ -1,6 +1,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <esp_random.h>
|
||||||
|
|
||||||
|
|
||||||
#define SEQ_MAX_LEN 8
|
#define SEQ_MAX_LEN 8
|
||||||
|
|
||||||
|
|
@ -12,6 +14,11 @@
|
||||||
// CV Out
|
// CV Out
|
||||||
// Gate Out
|
// Gate Out
|
||||||
|
|
||||||
|
void gen_rand_seq(uint8_t *sequence) {
|
||||||
|
for (uint8_t i = 0; i < SEQ_MAX_LEN; i++) {
|
||||||
|
sequence[i] = esp_random() % 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
|
|
@ -24,6 +31,8 @@ void app_main(void)
|
||||||
for (uint8_t step = 0; step < seq_len; step++) {
|
for (uint8_t step = 0; step < seq_len; step++) {
|
||||||
printf("%i", sequence[step]);
|
printf("%i", sequence[step]);
|
||||||
}
|
}
|
||||||
|
gen_rand_seq(sequence);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in New Issue