|
1 | 1 | /* |
2 | | - * Copyright 2022 Great Scott Gadgets |
| 2 | + * Copyright 2022-2026 Great Scott Gadgets |
3 | 3 | * |
4 | 4 | * This file is part of HackRF. |
5 | 5 | * |
|
19 | 19 | * Boston, MA 02110-1301, USA. |
20 | 20 | */ |
21 | 21 |
|
22 | | -#include "clkin.h" |
| 22 | +#include "clock_io.h" |
23 | 23 |
|
| 24 | +#include <stdbool.h> |
24 | 25 | #include <stdint.h> |
25 | 26 |
|
26 | 27 | #include <libopencm3/lpc43xx/timer.h> |
|
30 | 31 | #include <libopencm3/lpc43xx/creg.h> |
31 | 32 |
|
32 | 33 | #include "gpdma.h" |
| 34 | +#include "gpio.h" |
| 35 | +#include "hackrf_core.h" |
33 | 36 | #ifdef IS_PRALINE |
34 | | - #include "gpio.h" |
| 37 | + #include "fpga.h" |
35 | 38 | #include "platform_gpio.h" |
36 | 39 | #endif |
37 | 40 |
|
@@ -120,9 +123,45 @@ uint32_t clkin_frequency(void) |
120 | 123 | return TIMER2_CR3 * (1000 / MEASUREMENT_WINDOW_MS); |
121 | 124 | } |
122 | 125 |
|
| 126 | +void trigger_enable(const bool enable) |
| 127 | +{ |
| 128 | +#ifdef IS_NOT_PRALINE |
| 129 | + if (IS_NOT_PRALINE) { |
| 130 | + gpio_write(sgpio_config.gpio_trigger_enable, enable); |
| 131 | + } |
| 132 | +#endif |
| 133 | +#ifdef IS_PRALINE |
| 134 | + if (IS_PRALINE) { |
| 135 | + fpga_set_trigger_enable(&fpga, enable); |
| 136 | + } |
| 137 | +#endif |
| 138 | +} |
| 139 | + |
123 | 140 | #ifdef IS_PRALINE |
124 | 141 | void clkin_ctrl_set(const clkin_signal_t signal) |
125 | 142 | { |
126 | 143 | gpio_write(platform_gpio()->clkin_ctrl, signal & 1); |
127 | 144 | } |
| 145 | + |
| 146 | +void p1_ctrl_set(const p1_ctrl_signal_t signal) |
| 147 | +{ |
| 148 | + const platform_gpio_t* gpio = platform_gpio(); |
| 149 | + |
| 150 | + gpio_write(gpio->p1_ctrl0, signal & 1); |
| 151 | + gpio_write(gpio->p1_ctrl1, (signal >> 1) & 1); |
| 152 | + gpio_write(gpio->p1_ctrl2, (signal >> 2) & 1); |
| 153 | +} |
| 154 | + |
| 155 | +void p2_ctrl_set(const p2_ctrl_signal_t signal) |
| 156 | +{ |
| 157 | + const platform_gpio_t* gpio = platform_gpio(); |
| 158 | + |
| 159 | + gpio_write(gpio->p2_ctrl0, signal & 1); |
| 160 | + gpio_write(gpio->p2_ctrl1, (signal >> 1) & 1); |
| 161 | +} |
| 162 | + |
| 163 | +void pps_out_set(const uint8_t value) |
| 164 | +{ |
| 165 | + gpio_write(platform_gpio()->pps_out, value & 1); |
| 166 | +} |
128 | 167 | #endif |
0 commit comments