GPIO coding for Armadeus – the real thing

Some time ago I wrote a post about accessing GPIO using Armadeus and added code example. I really just copied what was already available and didn’t test it – well, I didn’t have a need… until now.

And I found out the hard way, that it is not working…

… but .. here is working example 🙂

#include <stdio.h>
#include <stdlib.h>

#define IN "in\n"
#define OUT "out\n"
#define LOW "0\n"
#define HIGH "1\n"
#define A0 "50"

int main(){
    sprintf(file,"/sys/class/gpio/export");
    f = fopen(file, "w");
    fprintf(f,A0);
    fclose(f);

    sprintf(file,"/sys/class/gpio/gpio%s/direction", A0);
    f = fopen(file, "w");
    fprintf(f, OUT);
    fclose(f);    

    sprintf(file,"/sys/class/gpio/gpio%s/value", A0);
    f = fopen(file, "w");
    fprintf(f, HIGH);        
    fclose(f);
    return 0;
}

KiCAD and (free)routing

Users of KiCAD can use free routing, but the web page added to the KiCAD is not available anymore.

You can still grab a compiled version of freerouter.

Since I am using mac I had to change fereeroute.jnlp. It should be enough to just change the path of the codebase, but it wasn’t. That’s why I’m listing the whole file  here.

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Freeroute -->

<jnlp 
   spec="6.0+"
   codebase="file:////Users/bostjan/peskovnik/kicad/bin" 
   href="freeroute.jnlp">
   <information>
      <title>Routing Application</title>
      <vendor>FreeRouting</vendor>
      <description>Printed Circuit Board Routing Application</description>
      <homepage href="http://www.freerouting.net"/>
   </information>
   <resources>     
       <jar download="eager" href="router.jar"/>   
	<java version="1.6+" java-vm-args="-Xmx1024m"/>
   </resources>
   <application-desc main-class="gui.MainApplication">
      <argument>-webstart</argument> 
   </application-desc>
</jnlp>