Re: [Botix-devel] HAL for Botix
Status: Beta
Brought to you by:
vorik2005
|
From: Ger A. <in...@ge...> - 2005-11-13 12:50:02
|
Hi wouter,
I've edited your documentation so that it works with DOC++.
Basicly a few issues:
A function documentation starts with /** <- double star
If you use the single star, it will be disregarded by doc++
Only if you've got a long and a short description, you should use the
memo field. If there is only a memo field, a seperate page for the
function will not be made.
If there is no parameter or no return, these should not be mentioned.
Thanks!
Greetings,
Ger.
Wouter Houweling schreef:
>Hi all,
>
>Tonight I committed the first version of a HAL for Botix.
>(Botix/Hardware/Hal)
>
>The purpose of the HAL is to provide a controlled layer over the
>hardware, to protect the hardware and ease in debugging. Because the HAL
>knows the purpose of the connected devices and their pins it knows when
>an illegal command is performed: like setting an input pin. This greatly
>reduces errors and creates a safety net for beginners.
>
>Another purpose of the hal is to check and debug the software pin map
>to the hardware pin map by printing out what the HAL knows about the pin
>usage. It is possible to show runtime the status of the devices & pins.
>
>Last but not least: the functional programming can use symbolic device
>names instead of pin address. This very much increases code readability
>and makes it for easy device programming. (No knowledge required *how*
>the device works, let the hal take care of that.)
>
>Short overview of the hall:
>
>- Class: set of devices.
>- Device: abstract device which is connected to zero or more pins.
>- Port: set of pins used for a device.
>- Pin: actual hardware pin.
>- Driver: small function which contains all logic to use a device. (i.e:
>send a ping for a sonar device)
>
>Hal->|-> Class 'Sensor' |-> Device |-> Driver 'srf04'
> | | |-> Pin A1 Input
> | | |-> Pin A2 Output
> | |
> | |-> Device |-> Driver
> | |-> Pin
> |
> |-> Class 'Led' -> etc.
> |
> |-> Ports |-> Pin 1 (owner device 'Sonar1'
> |-> Pin 2 (owner device 'Sonar1'
> |-> Pin 3 (owner device ''
>
>Drivers do not know which actual pins they use, because there is a
>device pin map -> actual pin map. Because of this drivers can be very
>generic.
>
>To keep memory footprint low, all strings are pointers back into rom. As
>always with abstraction some cpu overhead is unavoidable. At this moment
>it is unknown what the performance on an actual embedded cpu (AVR) is.
>
>Controlling the hal works like this:
>
>register_class("switches");
>register_class("leds");
>register_class("sonars");
>
>register_dev("led1",
> find_class("leds"), /* class */
> 1, /* number of pins */
> (PORT []){1, OUTPUT}, /* pin list */
> &generic_led); /* driver */
>
>register_dev("sonar_left"
> find_class("sonars"), /* class */
> 2, /* number of pins */
> (PORT []){1, OUTPUT, 2 INPUT}, /* pin list */
> &generic_led); /* driver */
>
>set_dev("led1", ON);
>int dist = get_dev("sonar1");
>
>A driver looks like this:
>
>float generic_led(int mode) {
> printf("Led driver called!\n");
> switch(mode) {
> case ON: set_pin(1, ON); break;
> case OFF: set_pin(1, ON); break;
> }
>}
>
>You get the idea ;-)
>
>At this moment this concept is working when compiling hal_demo.c on a
>pc. (Botix/Hardware/Hal)
>
>The hal should be directly driven by an protocol stack or small virtual
>machine running on the CPU.
>
>One big problem at this time is memory consumption, I will keep trying
>to reduce the memory footprint.
>
>Let met know what you all think of this!
>
>Greetings,
>Wouter
>
>
>
>
>
>
>
>
>
>-------------------------------------------------------
>SF.Net email is sponsored by:
>Tame your development challenges with Apache's Geronimo App Server. Download
>it for free - -and be entered to win a 42" plasma tv or your very own
>Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
>_______________________________________________
>Botix-devel mailing list
>Bot...@li...
>https://lists.sourceforge.net/lists/listinfo/botix-devel
>
>
|