Creating .libs for kicad/eeschema semiautomatically

Well, everyone has to eventually make one. Since we have a cool online utility from C. Rohrbacher http://kicad.rohrbacher.net/quicklib.php This is quite simple. Just fill in all the pins, orient them and you are ready to go…
But if there are over 200 pins,this is getting tiresome. When I was making a lib for at91rm9200 I got tired at 30th pin. And there are 208 of them and it’s quite easy to screw up… So I got a nice idea. Unfortunately, I didn’t find C. Rohrbacher’s email on his site, as well as I saw no sources of the utility. So, it was time for a hackish solution.

We’ll need:

bash (Oh, yeah!)
xdotool
okular (Any other PDF viewr thatcan select text will do)

Step one.
Open the datasheet, find the pin list, select the pins:

Step two.
Copypaste them into a blank file. They should be strictly ordered

Step three
Now a little black magic. Save the following bash script somewhere:

#!/bin/bash
write_pin()
{
xdotool type "$1"
xdotool key Tab Tab Tab Tab Tab Tab
}
 
if [ $# -lt 1 ]; then
  echo "Usage: fill-pins filename"
  exit
fi
 
echo "Starting in 5 seconds..."
sleep 5
 
cat $1|while read line; do
  write_pin "$line"
done

chmod+x, And give it the file with pins you’ve madeearlier. You have 5 seconds to open the browser on page withpins and select PIN1.
The script will do everything by itself. Just relax – it looks pretty funny

And by the way, kill all instances of skype, icq, kopete, irc – these things tend to steal focus from the browser and screw thing up.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.