it didn't work

This commit is contained in:
Kuba 2023-10-29 07:47:22 +00:00
parent c3c6b2f476
commit 55735c9afc
3 changed files with 3 additions and 16 deletions

View File

@ -21,15 +21,13 @@
static volatile uint32_t *pad_reg;
int fd;
int drds_;
FILE *f_ctl;
/*
* Opens a file (pipe) to be used to control the RDS coder, in non-blocking mode.
*/
int open_control_pipe(char *filename, volatile uint32_t *padreg, int drds)
int open_control_pipe(char *filename, volatile uint32_t *padreg)
{
drds_ = drds;
pad_reg = padreg;
fd = open(filename, O_RDWR | O_NONBLOCK);
if(fd == -1) return -1;
@ -139,16 +137,6 @@ int poll_control_pipe() {
printf("RT B set to: \"%s\"\n", arg);
res = CONTROL_PIPE_RT_SET;
}
} else if(strlen(fifo) > 5 && fifo[4] == ' ') {
char *arg = fifo+5;
if(arg[strlen(arg)-1] == '\n') arg[strlen(arg)-1] = 0;
if(fifo[0] == 'D' && fifo[1] == 'R' && fifo[2] == 'D' && fifo[3] == 'S') {
int drds = ( strcmp(arg, "ON") == 0 );
drds_ = drds;
printf("Set DRDS to ");
if(drds) printf("ON\n"); else printf("OFF\n");
res = CONTROL_PIPE_DRDS_SET;
}
}
return res;

View File

@ -14,8 +14,7 @@
#define CONTROL_PIPE_AB_SET 7
#define CONTROL_PIPE_PI_SET 8
#define CONTROL_PIPE_PWR_SET 9
#define CONTROL_PIPE_DRDS_SET 10
extern int open_control_pipe(char *filename, volatile uint32_t *padreg, int drds);
extern int open_control_pipe(char *filename, volatile uint32_t *padreg);
extern int close_control_pipe();
extern int poll_control_pipe();

View File

@ -144,7 +144,7 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
// Initialize the control pipe reader
if(control_pipe) {
if(open_control_pipe(control_pipe, pad_reg, drds) == 0) {
if(open_control_pipe(control_pipe, pad_reg) == 0) {
printf("Reading control commands on %s.\n", control_pipe);
} else {
printf("Failed to open control pipe: %s.\n", control_pipe);