Commit 31989b20e61d6d08e6efde594cf4a9ac0efabcb8

Con Kolivas 2014-01-09T12:25:42

Revert "Hard code the osc6 programmed on nanofury for now." This reverts commit c31cb6d09aa0cd302efd527a160322980d14b97b.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/libbitfury.c b/libbitfury.c
index 80d5ae5..37861f0 100644
--- a/libbitfury.c
+++ b/libbitfury.c
@@ -163,8 +163,10 @@ void spi_config_reg(struct bitfury_info *info, int cfgreg, int ena)
 
 void spi_set_freq(struct bitfury_info *info)
 {
-	unsigned char osc6[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00 };
+	uint64_t freq;
+	const uint8_t *osc6 = (unsigned char *)&freq;
 
+	freq = (1ULL << info->osc6_bits) - 1ULL;
 	spi_add_data(info, 0x6000, osc6, 8); /* Program internal on-die slow oscillator frequency */
 }