deviation

This commit is contained in:
Kuba 2023-10-31 13:29:31 +00:00
parent 9bf6c53893
commit 106ca83d64
3 changed files with 7 additions and 0 deletions

View File

@ -139,6 +139,9 @@ ResultAndArg poll_control_pipe() {
if(rds) printf("OFF\n"); else printf("ON\n"); if(rds) printf("OFF\n"); else printf("ON\n");
resarg.res = CONTROL_PIPE_RDS_SET; resarg.res = CONTROL_PIPE_RDS_SET;
resarg.arg = (char)rds; resarg.arg = (char)rds;
} else if(fifo[0] == 'D' && fifo[1] == 'E' && fifo[2] == 'V') {
resarg.res = CONTROL_PIPE_DEVIATION_SET;
resarg.arg = atoi(arg);
} }
} }
return resarg; return resarg;

View File

@ -15,6 +15,7 @@
#define CONTROL_PIPE_PI_SET 8 #define CONTROL_PIPE_PI_SET 8
#define CONTROL_PIPE_PWR_SET 9 #define CONTROL_PIPE_PWR_SET 9
#define CONTROL_PIPE_RDS_SET 10 #define CONTROL_PIPE_RDS_SET 10
#define CONTROL_PIPE_DEVIATION_SET 11
typedef struct { typedef struct {
int res; int res;

View File

@ -192,6 +192,9 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
} else if(pollResult.res == CONTROL_PIPE_PWR_SET) { } else if(pollResult.res == CONTROL_PIPE_PWR_SET) {
pad_reg[GPIO_PAD_0_27] = 0x5a000018 + (int)pollResult.arg; pad_reg[GPIO_PAD_0_27] = 0x5a000018 + (int)pollResult.arg;
pad_reg[GPIO_PAD_28_45] = 0x5a000018 + (int)pollResult.arg; pad_reg[GPIO_PAD_28_45] = 0x5a000018 + (int)pollResult.arg;
} else if(pollResult.res == CONTROL_PIPE_DEVIATION_SET) {
deviation = pollResult.arg;
deviation_scale_factor= 0.1 * (deviation );
} }
} }