- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am writing a program that takes command strings off a UART bluetooth module (see attached). I have the parser working and initially thought I would only have a handful of commands. I am now finding out I will need many more commands.
I have it setup currently in an inefficient manner, a way that make it difficult to add additional commands. I will be re-writing the main c program to scan an array of commands that I wish to define in the header.
What is the best method to store a long list of character strings in a header so I do not have to use the #define specifier over and over, then redefine them in an array?
Thanks
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
lookup table of string commands
When I take this literally, I would create an array of strings which I could index and search for occurence of a given item.
To shorten the needed code, I would extend the array of strings to an array of structs containing the address of the function that handles the command.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To put it more simply, what I wish to do is create a lookup table of string commands that my main program will reference.
What is the best method to do this? Is this typically done in a header?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
lookup table of string commands
When I take this literally, I would create an array of strings which I could index and search for occurence of a given item.
To shorten the needed code, I would extend the array of strings to an array of structs containing the address of the function that handles the command.
Bob