Skip to content

Commit c835a28

Browse files
committed
firmware: move trigger_enable to clock_gen.h|c
1 parent ec3d793 commit c835a28

6 files changed

Lines changed: 22 additions & 20 deletions

File tree

firmware/common/clock_gen.c

Lines changed: 16 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(IS_PRALINE)
37-
#include "gpio.h"
38+
#include "fpga.h"
3839
#include "platform_gpio.h"
3940
#endif
4041

@@ -427,6 +428,20 @@ fp_28_36_t sample_rate_set(const fp_28_36_t sample_rate, const bool program)
427428
return resultant_rate;
428429
}
429430

431+
void trigger_enable(const bool enable)
432+
{
433+
#ifdef IS_NOT_PRALINE
434+
if (IS_NOT_PRALINE) {
435+
gpio_write(sgpio_config.gpio_trigger_enable, enable);
436+
}
437+
#endif
438+
#ifdef IS_PRALINE
439+
if (IS_PRALINE) {
440+
fpga_set_trigger_enable(&fpga, enable);
441+
}
442+
#endif
443+
}
444+
430445
#ifdef IS_PRALINE
431446
void p1_ctrl_set(const p1_ctrl_signal_t signal)
432447
{

firmware/common/clock_gen.h

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

4848
fp_28_36_t sample_rate_set(const fp_28_36_t sample_rate, const bool program);
4949

50+
void trigger_enable(const bool enable);
51+
5052
#ifdef IS_PRALINE
5153
typedef enum {
5254
P1_SIGNAL_TRIGGER_IN = 0,

firmware/common/hackrf_core.c

Lines changed: 2 additions & 14 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>
@@ -512,17 +514,3 @@ void pin_setup(void)
512514

513515
sgpio_configure_pin_functions(&sgpio_config);
514516
}
515-
516-
void trigger_enable(const bool enable)
517-
{
518-
#ifdef IS_NOT_PRALINE
519-
if (IS_NOT_PRALINE) {
520-
gpio_write(sgpio_config.gpio_trigger_enable, enable);
521-
}
522-
#endif
523-
#ifdef IS_PRALINE
524-
if (IS_PRALINE) {
525-
fpga_set_trigger_enable(&fpga, enable);
526-
}
527-
#endif
528-
}

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"
@@ -76,8 +74,6 @@ void ssp1_set_mode_ice40(void);
7674
void pin_shutdown(void);
7775
void pin_setup(void);
7876

79-
void trigger_enable(const bool enable);
80-
8177
#ifdef __cplusplus
8278
}
8379
#endif

firmware/common/radio.c

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

2626
#include <libopencm3/cm3/nvic.h>
2727

28+
#include "clock_gen.h"
2829
#include "fixed_point.h"
2930
#include "hackrf_core.h"
3031
#include "mixer.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
#ifdef IS_NOT_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)