cubesky I just search on notochord source code to find how to add custom device, but nothing found.
The thing is that the current notochord is an old dinosaur. It was the first program to be created for the Chordata framework several years ago when the actual scope of the project was not really defined. It then grew during the years to incorporate the different required features without a predefined plan. The result is a somewhat messy codebase that is hard to expand and maintain even for us. That's why we are practically rebuilding it from scratch with the new notochord module.
That's to say: even if the architecture it's prepared to incorporate custom sensors, it might be tricky to add the required code to the notochord
You should start by creating a class derived from Chordata::I2C_Node
as the Chordata::K_Ceptor
class in Chordata_node.h
.
This class should override the virtual void bang()
method.
Upon startup the notochord creates an instance of the Chordata::Timer
and configures it with the required sensor read rate. It then fills it up with the different types of nodes in the XML hierarchy, for now the nodes are of type K_Ceptor
and Branch
. They both expose the bang()
method which includes the code required to make the read/write and data processing of the nodes . The Timer takes care of doing this action at the correct rate and order to open/close the correct gates and walk all the hierarchy tree.
In order to get your custom nodes into the Timer you would need to modify the Chordata::Armature_Parser::parseNode
method creating the code specific to your case.
Last but not least, the XML is linted against a schema, any unexpected XML structure passed to the notochord will result in an error and a halt in the execution. In order to add a new type of content in the XML you would need to declare it in the Chordata.xsd
file which is of the XML schema definition for the input XML. This is a quite specific language written in XML, perhaps the easiest way to go if you are not familiar with it is that if you get to this point just tell us how you want to structure the new XML and we apply the required changes to the XSD