Browse Source

simulation supports scrolltext now. Own pgmspace.h added which works around pgmspace functions not being available on PC.

feature/2015
tixiv 16 years ago
parent
commit
9917c5b72b
  1. 9
      animations/programm.c
  2. 5
      display_loop.c
  3. 11
      pgmspace.h
  4. 9
      scrolltext/font.h
  5. 4
      scrolltext/scrolltext3.c
  6. 1
      simulator/main.c

9
animations/programm.c

@ -87,6 +87,15 @@ void off()
#endif #endif
#ifdef ANIMATION_SPIRALE #ifdef ANIMATION_SPIRALE
void walk(cursor* cur, unsigned char steps, unsigned int delay){
unsigned char x;
for(x=0;x<steps;x++){
set_cursor(cur, next_pixel(cur->pos, cur->dir));
wait(delay);
}
}
void spirale(unsigned int delay){ void spirale(unsigned int delay){
clear_screen(0); clear_screen(0);

5
display_loop.c

@ -1,5 +1,6 @@
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h>
#include "config.h" #include "config.h"
#include "scrolltext/scrolltext.h" #include "scrolltext/scrolltext.h"
@ -33,10 +34,6 @@ void display_loop(){
#ifdef ANIMATION_SCROLLTEXT #ifdef ANIMATION_SCROLLTEXT
case 1: case 1:
scrolltext(scrolltext_text); scrolltext(scrolltext_text);
{ char a[14];
sprintf(a,"</# counter == %lu ", percnt_get());
scrolltext(a);
}
break; break;
#endif #endif

11
pgmspace.h

@ -0,0 +1,11 @@
//pc compatibility of AVR-pgmspace stuff for compiling simulator
#ifdef AVR
#include <avr/pgmspace.h>
#else
#define PROGMEM
#define strcpy_P strcpy
#define memcpy_P memcpy
#define pgm_read_byte(a) ((*(uint8_t*)(a)))
#define pgm_read_word(a) ((*(uint16_t*)(a)))
#endif

9
scrolltext/font.h

@ -1,12 +1,7 @@
#ifndef FONT_H #ifndef FONT_H
#define FONT_H #define FONT_H
#ifdef AVR
# include <avr/pgmspace.h> #include "../pgmspace.h"
#else
# define PROGMEM
# define pgm_read_byte(B) *(B)
# define pgm_read_word(B) *(B)
#endif
typedef struct{ typedef struct{
unsigned char fontHeight; unsigned char fontHeight;

4
scrolltext/scrolltext3.c

@ -6,12 +6,10 @@
#include "../config.h" #include "../config.h"
#include "scrolltext.h" #include "scrolltext.h"
#ifdef AVR
# include "../borg_hw/borg_hw.h"
#endif
#include "../pixel.h" #include "../pixel.h"
#include "../util.h" #include "../util.h"
#include "../pgmspace.h"
#include "font_arial8.h" #include "font_arial8.h"
#include "font_small6.h" #include "font_small6.h"
#include "font_uni53.h" #include "font_uni53.h"

1
simulator/main.c

@ -197,6 +197,7 @@ void timf(int value) {
void *display_loop_run(void * unused) { void *display_loop_run(void * unused) {
display_loop(); display_loop();
return 0;
} }
int main(int argc, char **argv){ int main(int argc, char **argv){

Loading…
Cancel
Save