src/chaoskey-v0.1: Add HV enable support
authorKeith Packard <keithp@keithp.com>
Wed, 20 Jan 2016 02:30:57 +0000 (18:30 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 20 Jan 2016 02:30:57 +0000 (18:30 -0800)
Turn on the HV supply when the OS starts.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/chaoskey-v0.1/ao_chaoskey.c
src/chaoskey-v0.1/ao_pins.h

index 48c8bf04b59ffb62193846c28047cc178d9b4d52..c94901846c566514c97046a448fa9e72d49fdf6b 100644 (file)
 #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);
index 72963dbab9eb955832107d2ff296a94b0379744d..8f3eb7b1b7bdf78c1e3896cf811654d6ac06da18 100644 (file)
 
 #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