Skip to content

Commit

Permalink
generate_DC, generate_DC_LO was added.
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinSudakov committed Aug 23, 2018
1 parent 7eae646 commit df9df47
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,12 @@ GENERATOR_DIR = Test/generate
COMM_DIR = Examples/Communication/C
XADC_DIR = Test/xadc
LA_TEST_DIR = api2/test
GENERATE_DC_DIR = generate_DC

.PHONY: examples rp_communication
.PHONY: lcr bode monitor monitor_old generator acquire calib calibrate laboardtest
.PHONY: lcr bode monitor monitor_old generator acquire calib calibrate laboardtest generate_DC

examples: lcr bode monitor monitor_old generator acquire calib
examples: lcr bode monitor monitor_old generator acquire calib generate_DC
# calibrate laboardtest

lcr:
Expand Down Expand Up @@ -296,6 +297,11 @@ laboardtest: api2
rp_communication:
make -C $(COMM_DIR)

generate_DC: api
$(MAKE) -C $(GENERATE_DC_DIR)
cp $(GENERATE_DC_DIR)/generate_DC $(INSTALL_DIR)/bin/
cp $(GENERATE_DC_DIR)/generate_DC_LO $(INSTALL_DIR)/bin/

################################################################################
# Red Pitaya ecosystem and tools
################################################################################
Expand Down Expand Up @@ -440,4 +446,5 @@ clean:
make -C $(LIBRPAPP_DIR) clean
make -C $(LIBRPLCR_DIR) clean
make -C $(COMM_DIR) clean
make -C $(GENERATE_DC_DIR) clean
apps-free-clean
17 changes: 17 additions & 0 deletions generate_DC/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CC = $(CROSS_COMPILE)gcc

CFLAGS = -g -std=gnu99 -Wall -Werror
CFLAGS += -I../api/include
LFLAGS = -L../api/lib
LIBS = -lm -lpthread -lrp

SRCS=$(wildcard *.c)
OBJS=$(SRCS:.c=)

all: $(OBJS)

%: %.c
$(CC) $(CFLAGS) $(LFLAGS) $< -o $@ $(LIBS)

clean:
$(RM) $(OBJS)
44 changes: 44 additions & 0 deletions generate_DC/generate_DC.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Red Pitaya C API example Generating continuous signal
* This application generates a specific signal */

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>

#include "redpitaya/rp.h"

int main(int argc, char **argv){

/* Print error, if rp_Init() function failed */
if(rp_Init() != RP_OK){
fprintf(stderr, "Rp api init failed!\n");
}

/* Generator reset */
rp_GenReset();

/* Generating frequency */
rp_GenFreq(RP_CH_1, 0);
rp_GenFreq(RP_CH_2, 0);

/* Generating wave form */
rp_GenWaveform(RP_CH_1, RP_WAVEFORM_DC);
rp_GenWaveform(RP_CH_2, RP_WAVEFORM_DC);

/* Generating amplitude */
rp_GenAmp(RP_CH_1, 0.9);
rp_GenOffset(RP_CH_1, 0);

rp_GenAmp(RP_CH_2, 0.9);
rp_GenOffset(RP_CH_2, 0);

/* Enable channel */
rp_GenOutEnable(RP_CH_1);
rp_GenOutEnable(RP_CH_2);

/* Releasing resources */
rp_Release();

return 0;
}
44 changes: 44 additions & 0 deletions generate_DC/generate_DC_LO.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Red Pitaya C API example Generating continuous signal
* This application generates a specific signal */

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>

#include "redpitaya/rp.h"

int main(int argc, char **argv){

/* Print error, if rp_Init() function failed */
if(rp_Init() != RP_OK){
fprintf(stderr, "Rp api init failed!\n");
}

/* Generator reset */
rp_GenReset();

/* Generating frequency */
rp_GenFreq(RP_CH_1, 0);
rp_GenFreq(RP_CH_2, 0);

/* Generating wave form */
rp_GenWaveform(RP_CH_1, RP_WAVEFORM_DC);
rp_GenWaveform(RP_CH_2, RP_WAVEFORM_DC);

/* Generating amplitude */
rp_GenAmp(RP_CH_1, 0.45);
rp_GenOffset(RP_CH_1, 0);

rp_GenAmp(RP_CH_2, 0.45);
rp_GenOffset(RP_CH_2, 0);

/* Enable channel */
rp_GenOutEnable(RP_CH_1);
rp_GenOutEnable(RP_CH_2);

/* Releasing resources */
rp_Release();

return 0;
}

0 comments on commit df9df47

Please sign in to comment.