Monday, October 29, 2012

Arduino controller - 2

 This blog post is continuation of the previous post. I have made some changes to the software on the host side. Most important among them is that now you can a have a configuration file that describes what ports on the board are available. One more change is that, as opposed to earlier, now you can select the serial port directly from the GUI rather than specifying it within a configuration file.
Here is a sample configuration file (for Arduino Duemilanove):

Tuesday, October 9, 2012

Arduino controller


This project is based on Arduino Platform.
This current project implements a software architecture which eases the Arduino related peripheral operations such as Analog out(pwm), digital read/write and analog read operations. The core of the project is implemented in “trans_layer.cpp”. The central object in this project is “TransLayer” which has following methods:
TransLayer ()(constructor)
AddService()
SeeServices()
LookForService()
MainLoop()

Services here I am referring to are actually functions that accomplish certain task such as turning on an LED or reading Analog voltage at a given pin. The list of services are maintained within a linked list. The construct in this project (TransLayer()) initializes the head and tail pointers for the linked list. The linked list is list of data object of type service_list whose deceleration is:

struct service_list /**< Struct for holding service list */
{
call_back_ptr service_function; /**< call back function pointer */
char service_flag; /**< Packet service flag for which this service responds*/ service_ptr next_service;
};

call_back_ptr is the function pointer to the call back function. The service_flag is a char which uniquely represents the service. To add a service, AddService() should be used. It accepts a function pointer, to be used as call back function when the character which corresponds to the second argument to this function is received.