Jump to content

Recommended Posts

Posted (edited)

my frist try to code this RGB LEDs... i use http://wiki.midibox.org/doku.php?id=elo

as hardware

i searched for examples or tutorials, but did not found it... i know there is a midibox ng code, but that is to complex for my mind, better start from the ground...

so i opened the docu: http://www.midibox.org/mios32/manual/group___w_s2812.html

but i think i miss something:

#include <mios32.h>
#include "app.h"
#include <app_lcd.h>
#include <glcd_font.h>
#include <FreeRTOS.h>
#include <portmacro.h>
#include <task.h>
#include <queue.h>
#include <semphr.h>
#include "tasks.h"
#include "file.h"
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <wchar.h>


#define PRIORITY_APP_Tick	( tskIDLE_PRIORITY + 2 ) //2 lower then midi

// WS2181
#define WS2812_BUFFER_SIZE   ((18)*24)
#define WS2812_SUPPORTED   1


void APP_Init(void){
	WS2812_Init (); 	
}


void APP_Background(void){ 
// led 	should be in the range 0..WS2812_NUM_LEDS-1
// colour 	0=R, 1=G, 2=B
// value 	0..255 

WS2812_LED_SetRGB 	(	0,	0,	255); //1
WS2812_LED_SetRGB 	(	1,	0,	255); //2
WS2812_LED_SetRGB 	(	2,	0,	255); //3
WS2812_LED_SetRGB 	(	3,	0,	255); //4
WS2812_LED_SetRGB 	(	4,	0,	255); //5
WS2812_LED_SetRGB 	(	5,	0,	255); //6
WS2812_LED_SetRGB 	(	6,	0,	255); //7
WS2812_LED_SetRGB 	(	7,	0,	255); //8

WS2812_LED_SetRGB 	(	8,	2,	255); //9
WS2812_LED_SetRGB 	(	9,	2,	255); //10
WS2812_LED_SetRGB 	(	10,	2,	255); //11
WS2812_LED_SetRGB 	(	11,	2,	255); //12
WS2812_LED_SetRGB 	(	12,	2,	255); //13
WS2812_LED_SetRGB 	(	13,	2,	255); //14
WS2812_LED_SetRGB 	(	14,	2,	255); //15
WS2812_LED_SetRGB 	(	15,	2,	255); //16
}

void APP_Tick(void){ }

void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package){}

void APP_SRIO_ServicePrepare(void){ }

void APP_SRIO_ServiceFinish(void){ }
 
void APP_DIN_NotifyToggle(u32 pin, u32 pin_value){ }

void APP_ENC_NotifyChange(u32 encoder, s32 incrementer){ }

void APP_AIN_NotifyChange(u32 pin, u32 pin_value){ }

 

 

A compile (stm32F4 discovery) gives me:

make
rm -f project.hex
project_build/app.o: In function `APP_Init':
/home/inet-stick/c/elo-skeleton/app.c:49: undefined reference to `WS2812_Init'
project_build/app.o: In function `APP_Background':
/home/inet-stick/c/elo-skeleton/app.c:58: undefined reference to `WS2812_LED_SetRGB'
/home/inet-stick/c/elo-skeleton/app.c:59: undefined reference to `WS2812_LED_SetRGB'
/home/inet-stick/c/elo-skeleton/app.c:60: undefined reference to `WS2812_LED_SetRGB'
/home/inet-stick/c/elo-skeleton/app.c:61: undefined reference to `WS2812_LED_SetRGB'
/home/inet-stick/c/elo-skeleton/app.c:62: undefined reference to `WS2812_LED_SetRGB'
project_build/app.o:/home/inet-stick/c/elo-skeleton/app.c:63: more undefined references to `WS2812_LED_SetRGB' follow
collect2: error: ld returned 1 exit status
/home/inet-stick/midibox/mios32/include/makefile/common.mk:144: recipe for target 'project_build/project.elf' failed
make: *** [project_build/project.elf] Error 1
inet-stick@inetstick:~/c/elo-skeleton$ 

 

maybe there is a missing "include"?

Edited by Phatline

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...