summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-01-19 18:30:57 -0800
committerKeith Packard <keithp@keithp.com>2016-01-19 18:30:57 -0800
commit02fd767ab60a9957faa2bff29c62ed954abc34e7 (patch)
treef0fa7d34d00457ee7bf13db2010406c7c25c2370
parente5be0be35f724507d7efff48339a297df73d2641 (diff)
src/chaoskey-v0.1: Add HV enable support
Turn on the HV supply when the OS starts. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/chaoskey-v0.1/ao_chaoskey.c8
-rw-r--r--src/chaoskey-v0.1/ao_pins.h5
2 files changed, 13 insertions, 0 deletions
diff --git a/src/chaoskey-v0.1/ao_chaoskey.c b/src/chaoskey-v0.1/ao_chaoskey.c
index 48c8bf04..c9490184 100644
--- a/src/chaoskey-v0.1/ao_chaoskey.c
+++ b/src/chaoskey-v0.1/ao_chaoskey.c
@@ -20,6 +20,12 @@
#include <ao_crc.h>
#include <ao_trng_send.h>
+static void
+ao_hv_init(void)
+{
+ ao_enable_output(AO_HV_ENABLE_PORT, AO_HV_ENABLE_BIT, AO_HV_ENABLE_PIN, 1);
+}
+
void main(void)
{
ao_led_init(LEDS_AVAILABLE);
@@ -33,6 +39,8 @@ void main(void)
ao_usb_init();
+ ao_hv_init();
+
ao_trng_send_init();
ao_led_off(AO_LED_RED);
diff --git a/src/chaoskey-v0.1/ao_pins.h b/src/chaoskey-v0.1/ao_pins.h
index 72963dba..8f3eb7b1 100644
--- a/src/chaoskey-v0.1/ao_pins.h
+++ b/src/chaoskey-v0.1/ao_pins.h
@@ -57,6 +57,11 @@
#define AO_NUM_ADC 1
+/* HV enable */
+
+#define AO_HV_ENABLE_PORT (&stm_gpioa)
+#define AO_HV_ENABLE_BIT 8
+
/* CRC */
#define AO_CRC_WIDTH 32
#define AO_CRC_INIT 0xffffffff