I parsed the Arduino boards.txt and created new BoardTypes for Arduinos which can have different processors and require different parameters - wondering what parameters the "Phoenix 2.0" requires. So, I'm guessing the selection process you select on "name" - and the tools, compilers etc specified in the file and in other downloades, are key'd by that name ?įor example if I choose, "Phoenix 2.0" what does that change ? I like that they have it in json, nicer than the old Arduino property files. If a dot is in "board" - the upload command will beĪrgs.add("arduino:avr:" + parts + ":cpu=" + parts) this is the BoardTypes parsed from boards.txt. Now I've got to figure out which PinDefinitions belong with which Arduino boardTypes. )Īll of this should handle all Arduino boards and is generic enough to handle all the Microcontrollers I can think of. Which means you can build a list of PinDefinitions based on a board type without having to create an instance of the board (. PinDefinitions Microcontroller.createPinDefintions(String boardType) The next part is using the BoardType.board to create the PinDefinitions I'll be adding getBoardTypes() to Microcontroller interface - all microcontrollers should be able to easily implment this. Each BoardType contains a " name"," board" and " id" - Name is what is displayed, and board is a unique string key, and id is a unique integer. I've added a new method to Arduino.getBoardTypes() - this returns a list of board types. If we choose to support upload - I think we have to support sending the correct processor type (especially if its not atmega328, which 'might' be default for the compiler. Although I would prefer this method, if Arduino & its firmware was capable of providing all the necessary information. exe for Windows.Setting the arduino board type needs to come from the user's UI or helper functions like tBoardUno().Ĭurrently the board can set the type, by data coming back from the board. Project files are included for Visual Studio 10 and a command-line. The code also comes with main.c which contains a whole bunch of examples and runs as a command-line utility to query JSON files. It makes it easy to read JSON and put the values into native C variables, arrays or structures according to your application. It does not so much parse the JSON as traverse it - looking for the element you are interested in, It can be used to extract terminal values ( strings, numbers, etc.) as well as whole objects or arrays. It does not malloc() any memory, it only needs some stack for the function recursion. The code is written in pure C, it's all in jRead.c and jRead.h, it has no dependencies so it should compile on any system for any target. I've looked at several C++ JSON parsers and they all have a learning curve and have to use structures or classes to represent nodes of the JSON.įurthermore, exclamations like "All I want is a few values out of this load of JSON!", "How the ? do I use this API for such a simple job ?", "I don't care about writing a JSON reply - that's the EASY bit !" and "my embedded target isn't made of memory!" are all reasons why I ended up writing jRead. In many cases, handling JSON in C or C++ is a real pain. If you are really adventurous, there are two more functions and a few optional 'helper functions'. JRead( pJsonText, pQueryString, pOutputStruct )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |