Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

for now we start with the dumb, slow gamma calculation

  • Loading branch information...
commit 4e04fa359f629e43e62ae2ae9c50b2db3d4a7948 1 parent b9e6963
@interactive-matter interactive-matter authored
View
14 app_ledtile/src/led/ledprocess/ledprocess.h
@@ -42,6 +42,18 @@
//#define PER_PIXEL_ADJUSTMENT
/*
+ * Routine to add defaults values to the GAMMA LUT and the per pixel adjustement values, if configured.
+ * This routine is very slow due to the gamma calculation. And it should only be called from your applicaiton as last resort.
+ * Normally you would store tha gamma (and if configured the per pixel adjustements in flash). How this is handled in your application
+ * is part of the application.
+ */
+#ifdef __XC__
+void ledprocess_set_defaults();
+#else
+void ledprocess_set_defaults();
+#endif
+
+/*
* COLOUR PROCESSING
*
* Colour processing of pixel data. Receives pixel data and commands from the
@@ -53,10 +65,8 @@
* cOut - Streaming bidirectional pixel output
*/
#ifdef __XC__
-void ledprocess_init();
int ledprocess_commands(streaming chanend cLedCmd, streaming chanend cOut, int oeen);
#else
-void ledprocess_init();
int ledprocess_commands(unsigned cLedCmd, unsigned cOut, int oeen);
#endif
View
9 app_ledtile/src/led/ledprocess/ledprocess.xc
@@ -13,9 +13,10 @@
**/
#include <xs1.h>
#include <xclib.h>
+#include <print.h>
#include "led.h"
#include "ledprocess.h"
-#include "print.h"
+#include "gamma_lut_builder.h"
//8 bit color intensity adjustements
unsigned char intensityadjust[3] = {0xFF, 0xFF, 0xFF};
@@ -23,11 +24,15 @@ unsigned char intensityadjust[3] = {0xFF, 0xFF, 0xFF};
unsigned short gammaLUT[3][256];
#pragma unsafe arrays
-void ledprocess_init()
+void ledprocess_set_defaults()
{
// Init pixintensity
//TODO this is rubbish here. 1st it does not work 2nd this should be done in the aaplication or so, not the driver (see mbi5026)
//TODO may be this should be renamed to init-defaults and be a fall back if there is no applicaiton routine
+ //anyway we initialive the gamma lut for now
+ for (int c=0; c<3; c++) {
+ buildGammaLUT(gammaLUT[c]);
@variar
variar added a note

As far as I understand, initial values for each color are the same. Calculating initial table only for gammaLUT[0] and coping it to gammaLUT[1] and gammaLUT[2] might be a little bit faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ }
#ifdef PER_PIXEL_ADJUSTMENT
for (int i=0; i<(FRAME_HEIGHT*FRAME_WIDTH*3); i++)
{
View
36 app_ledtile/src/main.xc
@@ -145,26 +145,30 @@ int main(void)
//TODO we must find a way to select the correct led driver at startup - perhaps from flash??
//this needs to be done so taht each led driver can define & use the pins it wants to use
+ on stdcore[0]: {
+ //for now it is enough to get some default values
+ ledprocess_set_defaults(); //TODO this should be part of the ethernet application (loading from flash, if not useful initialize)
#if defined MBI5031
- on stdcore[0]: leddrive_mbi5031(c_led_data_out, c_led_cmds_out, cWdog[0],
- p_led_out_r0, p_led_out_g0, p_led_out_b0, p_led_out_g1, p_led_out_b1,
- p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
- b_led_clk, b_led_data, b_led_gsclk, b_ref);
+ leddrive_mbi5031(c_led_data_out, c_led_cmds_out, cWdog[0],
+ p_led_out_r0, p_led_out_g0, p_led_out_b0, p_led_out_g1, p_led_out_b1,
+ p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
+ b_led_clk, b_led_data, b_led_gsclk, b_ref);
#elif defined MBI5030
- on stdcore[0]: leddrive_mbi5030(
- c_led_data_out, c_led_cmds_out, cWdog[0],
- p_led_out_r0, p_led_out_g0, p_led_out_b0,
- p_led_out_r1, p_led_out_g1, p_led_out_b1,
- p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
- b_led_clk, b_led_data, b_led_gsclk, b_ref);
+ leddrive_mbi5030(
+ c_led_data_out, c_led_cmds_out, cWdog[0],
+ p_led_out_r0, p_led_out_g0, p_led_out_b0,
+ p_led_out_r1, p_led_out_g1, p_led_out_b1,
+ p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
+ b_led_clk, b_led_data, b_led_gsclk, b_ref);
#elif defined MBI5026
- on stdcore[0]: leddrive_mbi5026(
- c_led_data_out, c_led_cmds_out, cWdog[0],
- p_led_out_r0, p_led_out_g0, p_led_out_b0,
- p_led_out_r1, p_led_out_g1, p_led_out_b1,
- p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
- b_led_clk, b_led_data, b_led_gsclk, b_ref);
+ leddrive_mbi5026(
+ c_led_data_out, c_led_cmds_out, cWdog[0],
+ p_led_out_r0, p_led_out_g0, p_led_out_b0,
+ p_led_out_r1, p_led_out_g1, p_led_out_b1,
+ p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
+ b_led_clk, b_led_data, b_led_gsclk, b_ref);
#endif
+ }
//the interface to the flash memory for config data
on stdcore[0]: spiFlash(cSpiFlash, p_flash_miso, p_flash_ss, p_flash_clk, p_flash_mosi, b_flash_clk, b_flash_data);
Please sign in to comment.
Something went wrong with that request. Please try again.