aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2021-01-23 15:35:08 -0500
committerClyne Sullivan <clyne@bitgloo.com>2021-01-23 15:35:08 -0500
commita4d9689259a7f2eb57473f7fc8e8dd7b2a8e3eaa (patch)
tree9290cccb46fbe70c621583d0f504a122f00df290
parentec2e1fd5c6271bdf45ce22b3bb5cd3b690d92d5b (diff)
cordic test: sqrt
-rw-r--r--source/main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/main.cpp b/source/main.cpp
index dd98980..5afed63 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -89,6 +89,25 @@ int main()
chThdCreateStatic(conversionThreadWA, sizeof(conversionThreadWA),
NORMALPRIO, conversionThread, nullptr);
+ // TEST (success!)
+ /*double input = 0.25L;
+
+ RCC->AHB2ENR |= RCC_AHB2ENR_CORDICEN;
+ uint32_t dummy = 0;
+ while (CORDIC->CSR & CORDIC_CSR_RRDY)
+ dummy = CORDIC->RDATA;
+
+ CORDIC->CSR = (3 << CORDIC_CSR_PRECISION_Pos) |
+ (9 << CORDIC_CSR_FUNC_Pos); // 1 arg, 3 iterations, sqrt
+
+ input *= 0x7FFFFFFF;
+ dummy = input;
+ CORDIC->WDATA = dummy;
+ while (!(CORDIC->CSR & CORDIC_CSR_RRDY));
+ // result:
+ dummy = CORDIC->RDATA; // m cos()
+ double output = (double)dummy / 0x7FFFFFFF;*/
+
main_loop();
}