Skip to content

Commit 7e469ff

Browse files
committed
firmware: move trigger_enable to clock_gen.h|c
1 parent 6392765 commit 7e469ff

6 files changed

Lines changed: 17 additions & 15 deletions

File tree

firmware/common/clock_gen.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <stdint.h>
2525

26+
#include "gpio.h"
2627
#include "hackrf_core.h"
2728
#include "hackrf_ui.h"
2829
#include "i2c_bus.h"
@@ -34,7 +35,7 @@
3435
#include "portapack.h"
3536
#endif
3637
#if defined(PRALINE)
37-
#include "gpio.h"
38+
#include "fpga.h"
3839
#include "platform_gpio.h"
3940
#endif
4041

@@ -327,6 +328,15 @@ fp_40_24_t sample_rate_set(const fp_40_24_t sample_rate, const bool program)
327328
return resultant_rate;
328329
}
329330

331+
void trigger_enable(const bool enable)
332+
{
333+
#if defined(PRALINE)
334+
fpga_set_trigger_enable(&fpga, enable);
335+
#else
336+
gpio_write(sgpio_config.gpio_trigger_enable, enable);
337+
#endif
338+
}
339+
330340
#ifdef PRALINE
331341
void p1_ctrl_set(const p1_ctrl_signal_t signal)
332342
{

firmware/common/clock_gen.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ clock_source_t activate_best_clock_source(void);
4545

4646
fp_40_24_t sample_rate_set(const fp_40_24_t sample_rate, const bool program);
4747

48+
void trigger_enable(const bool enable);
49+
4850
#ifdef PRALINE
4951
typedef enum {
5052
P1_SIGNAL_TRIGGER_IN = 0,

firmware/common/hackrf_core.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* Boston, MA 02110-1301, USA.
2222
*/
2323

24+
#include <stdbool.h>
25+
2426
#include <libopencm3/lpc43xx/memorymap.h>
2527
#include <libopencm3/lpc43xx/scu.h>
2628
#include <libopencm3/lpc43xx/ssp.h>
@@ -449,12 +451,3 @@ void pin_setup(void)
449451

450452
sgpio_configure_pin_functions(&sgpio_config);
451453
}
452-
453-
void trigger_enable(const bool enable)
454-
{
455-
#ifndef PRALINE
456-
gpio_write(sgpio_config.gpio_trigger_enable, enable);
457-
#else
458-
fpga_set_trigger_enable(&fpga, enable);
459-
#endif
460-
}

firmware/common/hackrf_core.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
extern "C" {
2828
#endif
2929

30-
#include <stdbool.h>
31-
3230
#include "cpld_jtag.h"
3331
#include "i2c_bus.h"
3432
#include "i2c_lpc.h"
@@ -74,8 +72,6 @@ void ssp1_set_mode_ice40(void);
7472
void pin_shutdown(void);
7573
void pin_setup(void);
7674

77-
void trigger_enable(const bool enable);
78-
7975
#ifdef __cplusplus
8076
}
8177
#endif

firmware/common/radio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <libopencm3/cm3/nvic.h>
2525

26+
#include "clock_gen.h"
2627
#include "fixed_point.h"
2728
#include "hackrf_core.h"
2829
#include "hackrf_ui.h"

firmware/common/sgpio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "platform_scu.h"
3333
#include "sgpio.h"
3434
#if !defined(PRALINE)
35-
#include "hackrf_core.h"
35+
#include "clock_gen.h"
3636
#endif
3737

3838
static void update_q_invert(sgpio_config_t* const config);

0 commit comments

Comments
 (0)