|
|
|
@ -7,6 +7,11 @@ unsigned int adc_read(void);
|
|
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
|
|
|
|
while ((RCC->CR & 0x00000002) == 0) {;} // wait till MSI is ready
|
|
|
|
|
FLASH->ACR |= 2; // Add two wait-states for 48MHz operation
|
|
|
|
|
RCC->CR = (RCC->CR & ~0x000000F0) | 0x000000B0 | RCC_CR_MSIRGSEL; // Switch to 48 MHz clock
|
|
|
|
|
while ((RCC->CR & 0x00000002) == 0) {;} // wait till MSI is ready
|
|
|
|
|
|
|
|
|
|
adc_init();
|
|
|
|
|
|
|
|
|
|
// DAC initialization:
|
|
|
|
@ -29,7 +34,7 @@ int main(void)
|
|
|
|
|
yprev = y;
|
|
|
|
|
|
|
|
|
|
// Add some delay between samples
|
|
|
|
|
for (int i = 0; i < 100; ++i);
|
|
|
|
|
//for (int i = 0; i < 100; ++i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|