some experiments with a chinese stm8s103
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
stm8s_experiments/User/main.c

32 lines
527 B

7 years ago
#include "stm8s.h"
#include "bootstrap.h"
7 years ago
#include "fncgen.h"
7 years ago
7 years ago
FG_Instance fgi;
7 years ago
void main(void)
{
7 years ago
u16 t;
bool x = FALSE;
7 years ago
SimpleInit();
7 years ago
FG_SPI_Init();
7 years ago
7 years ago
FG_Init(&fgi, GPIOC, GPIO_PIN_4);
FG_SetFreq(&fgi, FREQ0, HZ_REG(4000));
FG_SetFreq(&fgi, FREQ1, HZ_REG(2500));
FG_SetWaveform(&fgi, WFM_SINE);
FG_Cmd(&fgi, ENABLE);
t = ms_now();
7 years ago
while (1) {
7 years ago
if (ms_loop_elapsed(&t, 100)) {
7 years ago
LED_Toggle();
7 years ago
// Switching freq banks - connect a speaker to hear 2-tone beeping!
x = !x;
FG_FreqSwitch(&fgi, x);
7 years ago
}
}
}