[Armadeus-commitlog] armadeus branch, master, updated. armadeus-5.3-529-g4150a6f
Brought to you by:
sszy
|
From: Julien B a. A. <ar...@us...> - 2014-12-23 09:57:05
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 4150a6f5c09aac18a6b86361fb3e5795a086d800 (commit)
from accbfac067cd907eda248e2e991e84c5f1b3e7b0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4150a6f5c09aac18a6b86361fb3e5795a086d800
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 23 10:50:42 2014 +0100
[DEMOS] Makes oscillo runs on every LCD resolution
-----------------------------------------------------------------------
Summary of changes:
target/demos/oscillo/lcd.c | 15 ++++++++++++++-
target/demos/oscillo/lcd.h | 4 +++-
target/demos/oscillo/main.c | 19 +++++++++++--------
3 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/target/demos/oscillo/lcd.c b/target/demos/oscillo/lcd.c
index cb5ea5d..f6ee35a 100644
--- a/target/demos/oscillo/lcd.c
+++ b/target/demos/oscillo/lcd.c
@@ -39,6 +39,8 @@ char *fbp = 0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long int screensize = 0;
+unsigned long xres = 0;
+unsigned long yres = 0;
int init_lcd()
{
@@ -68,6 +70,8 @@ int init_lcd()
/* Figure out the size of the screen in bytes */
screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
+ xres = vinfo.xres;
+ yres = vinfo.yres;
/* Map the device to memory */
fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED,
@@ -87,6 +91,15 @@ void close_lcd(int fbfd)
close(fbfd);
}
+unsigned long lcd_get_xres(void)
+{
+ return xres;
+}
+
+unsigned long lcd_get_yres(void)
+{
+ return yres;
+}
void draw_pixel(unsigned int x, unsigned int y, struct color rgb)
{
@@ -97,7 +110,7 @@ void draw_pixel(unsigned int x, unsigned int y, struct color rgb)
if (x >= vinfo.xres)
x = vinfo.xres-1;
if (y >= vinfo.yres)
- x = vinfo.yres-1;
+ y = vinfo.yres-1;
}
location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +
(y+vinfo.yoffset) * finfo.line_length;
diff --git a/target/demos/oscillo/lcd.h b/target/demos/oscillo/lcd.h
index d2d2fbc..10d99ec 100644
--- a/target/demos/oscillo/lcd.h
+++ b/target/demos/oscillo/lcd.h
@@ -7,7 +7,9 @@ struct color {
int b;
};
-int init_lcd ();
+int init_lcd(void);
+unsigned long lcd_get_xres(void);
+unsigned long lcd_get_yres(void);
void close_lcd(int fbfd);
void draw_pixel(unsigned int x, unsigned int y, struct color rgb);
void clear_vline(unsigned int x);
diff --git a/target/demos/oscillo/main.c b/target/demos/oscillo/main.c
index 452452d..3ea1f2d 100644
--- a/target/demos/oscillo/main.c
+++ b/target/demos/oscillo/main.c
@@ -47,7 +47,7 @@ int main(void /*int argc, char **argv*/)
/*int x[MAX_CHANNELS] = {0, 10, 20, 30, 40, 50, 60, 70};*/
int y[MAX_CHANNELS];
int time = 0, i;
- int nb_channels;
+ int nb_channels, xres, yres;
double rad;
struct color colours[MAX_CHANNELS] = {{120,120,120},{0,150,150},{160,0,160},{170,170,0}};
@@ -58,19 +58,22 @@ int main(void /*int argc, char **argv*/)
return EXIT_FAILURE;
nb_channels = 3;
+ xres = lcd_get_xres();
+ yres = lcd_get_yres();
+
while(1) {
- time += 1;
- if (time >= 479) {
- time = 0;
- }
for (i=0; i<nb_channels; i++) {
rad += 0.01745f;
- y[i] = (unsigned int)(sin(rad)*100 + 136 + 5*i);
+ y[i] = (unsigned int)(sin(rad)*100 + (yres/2) + 5*i);
//printf("%d: %d %d\n", i, time, y[i]);
draw_pixel(time, y[i], colours[i]);
}
- clear_vline(time+1);
- usleep(50000);
+ time += 1;
+ if (time >= xres) {
+ time = 0;
+ }
+ clear_vline(time);
+ usleep(20000);
}
return EXIT_SUCCESS;
hooks/post-receive
--
armadeus
|