1.1 --- a/test.c Sun May 19 22:06:40 2013 +0000
1.2 +++ b/test.c Tue May 21 15:08:07 2013 +0000
1.3 @@ -15,9 +15,12 @@
1.4 #include <string.h>
1.5 #include <signal.h>
1.6 #include "logo.h"
1.7 -#include "Display_Controller.h"
1.8 +#include "EPD.h"
1.9 #include "bsp.h"
1.10
1.11 +static uint8_t old_image[264 * 176 / 8],
1.12 + new_image[264 * 176 / 8];
1.13 +
1.14 /**
1.15 * Handle termination of the process.
1.16 */
1.17 @@ -32,8 +35,6 @@
1.18
1.19 int main(int argc, char *argv[])
1.20 {
1.21 - uint8_t *current_image, blank_image[176][33];
1.22 -
1.23 signal(SIGINT, &shutdown);
1.24
1.25 if (ubb_open(0) < 0) {
1.26 @@ -41,28 +42,32 @@
1.27 return 1;
1.28 }
1.29
1.30 - ubb_power(1);
1.31 - printf("Power on.\n");
1.32 -
1.33 /* Need to initialise the board. */
1.34
1.35 - bsp_init();
1.36 + EPD_init(EPD_2_7);
1.37 printf("Initialised.\n");
1.38
1.39 /* Initialise an array containing the current image. */
1.40
1.41 - memset((uint8_t*) &blank_image[0][0], 0xff, 176*33);
1.42 - current_image = (uint8_t*) &blank_image[0][0];
1.43 - printf("Set blank image.\n");
1.44 + memset(old_image, 0, sizeof(old_image));
1.45 + /* memset(new_image, 0, sizeof(new_image)); */
1.46 + memcpy(new_image, (uint8_t *) image_data[0], sizeof(new_image));
1.47
1.48 - /* Call epd_DisplayImg with the new image and current image. */
1.49 + printf("Clear image.\n");
1.50
1.51 - epd_DisplayImg(DISPLAY_IN_USE, (uint8_t *) &image_data[0][0][0], current_image);
1.52 - printf("Updated image.\n");
1.53 + EPD_begin();
1.54 + EPD_setFactor(bsp_getTemp());
1.55 + EPD_clear();
1.56 + EPD_end();
1.57 +
1.58 + printf("Set image.\n");
1.59
1.60 - /* Set the current image to the new image. */
1.61 + EPD_begin();
1.62 + EPD_setFactor(bsp_getTemp());
1.63 + EPD_image_change(old_image, new_image);
1.64 + EPD_end();
1.65
1.66 - current_image = &image_data[0][0][0];
1.67 + /* memcpy(old_image, new_image, sizeof(old_image)); */
1.68
1.69 printf("Closing...\n");
1.70 ubb_close(0);