summaryrefslogtreecommitdiff
path: root/project/Core/Src/Activties/activity13.c
blob: 19eb0a4d169c7ec68f64b0fc9e7e4ca69ba174c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * activity13.c
 *
 *  Created on: Nov 18, 2025
 *      Author: sowgro
 */
#include <stdint.h>
#include <stdio.h>
#include "systick.h"

//write 1s for half the freq and 0s for the other half
void play_freq(uint8_t hz) {
	uint32_t rollover =herz_to_systicks(hz);
	int count = systick_get_count();
	if ((count % rollover) < (rollover >> 1))
		printf("1");
	else
		printf("0");
}

void activity13_run() {
	init_systick();
	for(;;) {
		play_freq(1);
	}
}