One suggestion we have received has been to offer API access to the software functionality.
We would welcome ideas as to what people would like to be able to access and do through the API.
Initial suggestions are being able to control the three LEDs on the Retro-Printer module, for custom status indicators.
API Access
API Access
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
Re: API Access
As per http://forum.retroprinter.com/viewtopic.php?f=3&t=9 we are now making the necessary changes to the PCB to allow software control of the LEDs and the offline switch, so API access is a real possibility
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
Re: API Access
What is the best way to implement the API access??
Would a retroprinter.h be sufficient which allows you to access the functions to turn on / off the LEDs in C be sufficient?
I guess we should also add a function to read the status of the offline switch - so that could be used for a different function.
Would a retroprinter.h be sufficient which allows you to access the functions to turn on / off the LEDs in C be sufficient?
I guess we should also add a function to read the status of the offline switch - so that could be used for a different function.
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
Re: API Access
In the absence of any comment, I have created an rpleds.h file, so that you can add access to the software LEDs by simply compiling your C program with
This adds 3 functions:
initialize_leds() sets up the led variables, turns on the blue (power) LED and turns everything else off, so must be called first.
It will be called by the Retro-Printer software, so can be ignored for now.
led_on("green");
led_on("blue");
led_on("red");
are 3 simple calls to switch on the 3 leds in turn
led_off does the opposite.
I will then create a new config file which allows you to say which of these leds are to be controlled externally in which case, the Retro-Printer software will not turn them on/off (other than calling initialize_leds() ).
Code: Select all
gcc test.c rpleds.o -o test
Code: Select all
void initialize_leds();
void led_on(char *ledname);
void led_off(char *ledname);
It will be called by the Retro-Printer software, so can be ignored for now.
led_on("green");
led_on("blue");
led_on("red");
are 3 simple calls to switch on the 3 leds in turn
led_off does the opposite.
I will then create a new config file which allows you to say which of these leds are to be controlled externally in which case, the Retro-Printer software will not turn them on/off (other than calling initialize_leds() ).
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
Re: API Access
We have now switched to using the wiringpi - so the instructions are different.
In order to control the LEDs, you will need to link in the file rpleds.o to your C program, so create your new C source code (say test.c) in /home/pi/temp/sdl/escparser and add the lines:
You then have access to 4 functions:
void wiringPiSetup();
void initialize_leds();
void led_on(char *ledname);
void led_off(char *ledname);
So your program needs to include:
to set up the led variables and turns off all LEDs, so must be called first.
You can then control the three LEDs with the commands:
switch on the specified LED.
You then compile your program with:
In order to control the LEDs, you will need to link in the file rpleds.o to your C program, so create your new C source code (say test.c) in /home/pi/temp/sdl/escparser and add the lines:
Code: Select all
#include <wiringPi.h>
#include "library/rpleds.h"
void wiringPiSetup();
void initialize_leds();
void led_on(char *ledname);
void led_off(char *ledname);
So your program needs to include:
Code: Select all
wiringPiSetup();
initialize_leds();
You can then control the three LEDs with the commands:
Code: Select all
led_on("green");
led_on("blue");
led_on("red");
You then compile your program with:
Code: Select all
gcc test.c rpleds.o -o test -lwiringPi
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module
Also Involved in:
Icephorm