/*********************************************************************** MapWPointToScreen() - maps the given world point to screen coordinates ***********************************************************************/ pointType MapWPointToScreen(wpointType *p, matrixType *map) { pointType sp; vectorType pvec; matrixType pmat, pmat_res; pvec = WPoint2Vector( p ); pmat = Vector2Matrix( &pvec, 3); /* since map is a 3x3 matrix */ pmat_res = MatrixMultiply( map, &pmat); pvec = Matrix2Vector( &pmat_res ); sp.x = pvec.x; sp.y = pvec.y; return(sp); } /* end of MapWPointToScreen() */
void LEDtest3(void) { LEDSTR *p2Matrix=NULL; unsigned char temp; // unsigned char show_led=0; // LEDscreen_setShiftEnded_voidCallback(timetoshift); LEDscreen_setActualMSJ("**C5N**"); for (;;) { adcval=atd_getsample(); _printf("ADC;%d \n",adcval); ///// putcspi0(show_led++); p2Matrix=LEDscreen_getScreenAddress(); PORTA |= 0x01; LEDscreen_ShiftMSJ(); // shift msg one colum left if( Get_End_Of_Shift_Status() == TRUE) //Ckeck if the whole msg was sent { //_printf("Hallo Welt \n "); end_of_transmision = FALSE; Reset_FSM(); QueueInit(); Sci1_Putchar(XON); // HC05 Bluetooth //////// rti_start(); // Non Blocking W/hardware Timer Set_Timer_ms(3000); // 3 seconds window /* TIMER TEST _printf("Timer in \n"); while(1){ if( Get_Timer_ms_Status()) { _printf("Timer\n"); Set_Timer_ms(1000); } } TIMER TEST END*/ //// _printf("-(%c)[%.2X]-",ch,ch); do { if(messages_count()) _printf("Remaining mess %d\n",messages_count()); if(new_messages()) op_status=command_parser(commands); // Process the cmd } while ((endsts=(end_of_transmision == FALSE)) && (timsts=(Get_Timer_ms_Status()!=TIME_OUT))); if(!endsts) _printf("end_of_trans EOT\n"); if(!timsts) _printf("timeout EOT\n"); ////////////// rti_stop(); while(QueueStatus()) /// cleanup op_status=PullQueue(&temp); } Matrix2Vector(p2Matrix); // Convert Matrix to Vector Set_Color(color); Set_Intensity(Led_intensity); WS2812B_Init(); WS2812B_Set_Data_pointer((unsigned char *)DestLedScreen); WS2812B_Set_Data_Length(32*8*sizeof(LEDSTR)); WS2812B_Send_data(); PORTA &= 0xFE; //21.3 ms /// Set_Timer_ms(24); // 24 ms esto es normal velocidad posta Set_Timer_ms(speed); while (Get_Timer_ms_Status()!=TIME_OUT) ; // test_delay(100); //24.8 ms (OLD) _asm nop; _asm nop; _asm nop; _asm nop; } }
void LEDtest2(void) { //// ojo no va mas (only for tests) LEDSTR *p2Matrix=NULL; // LEDscreen_setShiftEnded_voidCallback(timetoshift); LEDscreen_setActualMSJ("HELLO"); // LEDscreen_setMSJ("LIESL"); for (;;) { p2Matrix=LEDscreen_getScreenAddress(); PORTA |= 0x01; LEDscreen_ShiftMSJ(); // shift msg one colum left if( Get_End_Of_Shift_Status() == TRUE) //Ckeck if the whole msg was sent _printf("Hallo Welt \n "); Matrix2Vector(p2Matrix); // Convert Matrix to Vector Set_Color(color); WS2812B_Init(); WS2812B_Set_Data_pointer((unsigned char *)DestLedScreen); WS2812B_Set_Data_Length(32*8*sizeof(LEDSTR)); WS2812B_Send_data(); PORTA &= 0xFE; //21.3 ms //test_delay(100); //24.8 ms // Blocking W/software Timer rti_start(); // Non Blocking W/hardware Timer Set_Timer_ms(25); while( Get_Timer_ms_Status()) ; // delayms(25); // Blocking W/hardware Timer rti_stop(); _asm nop; _asm nop; _asm nop; _asm nop; } }