You have to write your own tokenizer. scanf() functions aren't available. Other normal C string functions are however available.
fgets(token, sizeof(token), stdin);
strchr() from string.h can easily used to find delimeter. And ctype.h has all the isspace() and friends.
strtol() is available for converting string to numbers.
Thanks for the replay. I had used this syntax fgets(token, sizeof(token), stdin); for string input but here is a limitation. If I declarer the length of token =10
char token[10];
then I need to give 10 char input for going to next step.
If I give 1-9 input and press enter to proceed for next step, it doesn't work.
Can you please help me to overcome this limitation?
fgets() man page wrote:
fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A terminating null byte ('\0') is stored after the last character in the buffer.
char *nl= strchr(token, '\n');
if (nl)*nl = '\0';
else printf("Longer line than expected\n");
I need a favor from you. Can you please let me know the exact address of RX and TX pin of VS1010D mini demo board? From the datasheet of VS1010 I'm bit confused about the RX, TX pin correct address.
How to manually toggle the RX and TX pin by configuring the RX and TX pin as GPIO pin?
RX0 is GPIO1_8, TX0 GPIO1_9, TX1 GPIO1_10, RX1 GPIO1_11
From vo_gpio.h there are the functions. When you want to get back to UART console, remember to call GpioSetAsPeripheral() function or else you don't have console.
gpio functions have pins as (gpio port << 4) |( port pin & 0xf) which gives uart pins: 0x18, 0x19, 0x1a, 0x1b values to be used with those functions.