Currently I have a main.c, main.h, uart.c and uart.h and in my uart .h I define the baudrates for my uarts.
#define BAUDRATE1 19200//9600 #define BAUDRATE2 19200//9600
now in my uart init function (inside uart.c)I use that defined baudrate to initialize my uart. My question is, is it possible to have the BAUDRATE2 changed from a user entry in the main? My goal is to have user select whether they want to send a file or just run the program normally. When sending files, my baud rate has to be set to 9600 (because of the IC im using) and normal is 19200 (because of the rest of IC's).
Now if a user selects yes he wants to send a file, then I tried to #undef BAUDRATE2 and #define BAUDRATE2 = 9600 and then I recall uartinit, but when I print out BAUDRATE2, its still 19200. I think its because its defined in the uart.h and it will keep getting the values from there. I can't seem to come up with a way around it.
Thanks in advance, I'll also post if I figure a way to achieve this.