Update pi_fm_rds.c

This commit is contained in:
David RICQ 2014-07-19 19:32:06 +02:00
parent f2df2b10b8
commit a2038ef556
1 changed files with 4 additions and 2 deletions

View File

@ -269,7 +269,7 @@ map_peripheral(uint32_t base, uint32_t len)
#define DATA_SIZE 5000 #define DATA_SIZE 5000
int tx(uint32_t carrier_freq, uint32_t volume, char *audio_file, uint16_t pi, char *ps, char *rt, int16_t ppm, char *control_pipe) { int tx(uint32_t carrier_freq, float volume, char *audio_file, uint16_t pi, char *ps, char *rt, int16_t ppm, char *control_pipe) {
int i, fd, pid; int i, fd, pid;
char pagemap_fn[64]; char pagemap_fn[64];
@ -517,7 +517,7 @@ int main(int argc, char **argv) {
char *audio_file = NULL; char *audio_file = NULL;
char *control_pipe = NULL; char *control_pipe = NULL;
uint32_t carrier_freq = 107900000; uint32_t carrier_freq = 107900000;
uint32_t volume = 100; float volume = 100;
char *ps = NULL; char *ps = NULL;
char *rt = "PiFmRds: live FM-RDS transmission from the RaspberryPi"; char *rt = "PiFmRds: live FM-RDS transmission from the RaspberryPi";
uint16_t pi = 0x1234; uint16_t pi = 0x1234;
@ -542,6 +542,8 @@ int main(int argc, char **argv) {
} else if(strcmp("-vol", arg)==0 && param != NULL) { } else if(strcmp("-vol", arg)==0 && param != NULL) {
i++; i++;
volume = atof(param); volume = atof(param);
if(volume < 0)
fatal("Incorrect volume specification. Must be positive\n");
} else if(strcmp("-pi", arg)==0 && param != NULL) { } else if(strcmp("-pi", arg)==0 && param != NULL) {
i++; i++;
pi = (uint16_t) strtol(param, NULL, 16); pi = (uint16_t) strtol(param, NULL, 16);