void epd_display(uint8_t orientation){ if (orientation != LANDSCAPE_FLIPPED){ framebuffer_x_y_mirror(); EPD_display_from_pointer(EPD_270, previous_framebuffer, current_framebuffer); memcpy(previous_framebuffer, current_framebuffer, sizeof(previous_framebuffer)*1452); framebuffer_x_y_mirror(); }else{ EPD_display_from_pointer(EPD_270, previous_framebuffer, current_framebuffer); memcpy(previous_framebuffer, current_framebuffer, sizeof(previous_framebuffer)*1452); } }
/** * \brief The main function will toggle between two images on * corresponding EPD depends on specified EPD size * * \note * EPD size: EPD_144 = 1.44 inch, EPD_200 = 2 inch, EPD_270 = 2.7 inch */ int main(void){ /** Initialize system clock and Xplained pro board */ sysclk_init(); irq_initialize_vectors(); cpu_irq_enable(); //sleepmgr_init(); // Optional board_init(); /** Initialize EPD hardware */ EPD_display_init(); for(;;) { /** User selects which EPD size to run demonstration by changing the * USE_EPD_Type in Atmel Studio Project properties under Symbols * The Image data arrays for each EPD size are defined at image_data.c */ #if(USE_EPD_Type==USE_EPD144) EPD_display_from_pointer(EPD_144,(uint8_t *)&image_array_144_2,(uint8_t *)&image_array_144_1); #elif(USE_EPD_Type==USE_EPD200) EPD_display_from_pointer(EPD_200,(uint8_t *)&image_array_200_2,(uint8_t *)&image_array_200_1); #elif(USE_EPD_Type==USE_EPD270) EPD_display_from_pointer(EPD_270,(uint8_t *)&image_array_270_2,(uint8_t *)&image_array_270_1); #endif /* The interval of two images alternatively change is 10 seconds */ delay_ms(10000); #if(USE_EPD_Type==USE_EPD144) EPD_display_from_pointer(EPD_144,(uint8_t *)&image_array_144_1,(uint8_t *)&image_array_144_2); #elif(USE_EPD_Type==USE_EPD200) EPD_display_from_pointer(EPD_200,(uint8_t *)&image_array_200_1,(uint8_t *)&image_array_200_2); #elif(USE_EPD_Type==USE_EPD270) EPD_display_from_pointer(EPD_270,(uint8_t *)&image_array_270_1,(uint8_t *)&image_array_270_2); #endif /* The interval of two images alternatively change is 10 seconds */ delay_ms(10000); } }
/** The main function will start toogling between two images on corresponding EPD * depends on specified EPD size or working with EPD Kit Tool */ int main(void) { /* Initialize system clock and TI LaunchPad board */ system_init(); /*flip image bytes*/ flip_image_bytes((uint8_t *)&image_array_270_1,(uint8_t *)&image_array_270_1); // flip_image_bytes((uint8_t *)&image_array_270_2,(uint8_t *)&image_array_270_2); /* Initialize EPD hardware */ EPD_display_init(); __enable_interrupt();//enable interrupts //__bis_SR_register(GIE); #if (defined EPD_KIT_TOOL_FUNCTIONS) /** if working with EPD Kit Tool ***************/ LED_init(); EPD_Kit_Tool_process_init(); for(;;) { EPD_Kit_tool_process_task(); } #else /* if showing two images alternatively ***************************************/ for(;;) { //puts("he");//TODO : remove debug /* User selects which EPD size to run demonstration by changing the * USE_EPD_Type in conf_EPD.h * The Image data arrays for each EPD size are predefined at image_data.c */ #if(USE_EPD_Type==EPD_144) EPD_display_from_pointer(EPD_144,(uint8_t *)&image_array_144_2,(uint8_t *)&image_array_144_1); #elif(USE_EPD_Type==EPD_200) EPD_display_from_pointer(EPD_200,(uint8_t *)&image_array_200_2,(uint8_t *)&image_array_200_1); #elif(USE_EPD_Type==EPD_270) /* Due to if loading two image arrays for 2.7", the code size will exceed the MSP430G2553 flash. * So the demo will load 1st image continuously.*/ #ifdef G2_Aurora_Ma EPD_display_from_pointer(EPD_270,(uint8_t *)&image_array_270_1,(uint8_t *)&image_array_270_1); #else EPD_display_from_pointer(EPD_270,image_array_270_1,image_array_270_1); #endif #elif(USE_EPD_Type==EPD_190) EPD_display_from_pointer(EPD_190,(uint8_t *)&image_array_190_2,(uint8_t *)&image_array_190_1); #elif(USE_EPD_Type==EPD_260) EPD_display_from_pointer(EPD_260,(uint8_t *)&image_array_260_2,(uint8_t *)&image_array_260_1); #endif /* The interval of two images alternatively change is 5 seconds */ delay_ms(5000); P2OUT |= BIT0; #if(USE_EPD_Type==EPD_144) EPD_display_from_pointer(EPD_144,(uint8_t *)&image_array_144_1,(uint8_t *)&image_array_144_2); #elif(USE_EPD_Type==EPD_200) EPD_display_from_pointer(EPD_200,(uint8_t *)&image_array_200_1,(uint8_t *)&image_array_200_2); #elif(USE_EPD_Type==EPD_270) /* Due to if loading two image arrays for 2.7", the code size will exceed the MSP430G2553 flash. * So the demo will load 1st image continuously.*/ #ifdef G2_Aurora_Ma EPD_display_from_pointer(EPD_270,(uint8_t *)&image_array_270_1,(uint8_t *)&image_array_270_1); #else // EPD_display_from_pointer(EPD_270,flipped_image_array_270_2,flipped_image_array_270_1); #endif #elif(USE_EPD_Type==EPD_190) EPD_display_from_pointer(EPD_190,(uint8_t *)&image_array_190_1,(uint8_t *)&image_array_190_2); #elif(USE_EPD_Type==EPD_260) EPD_display_from_pointer(EPD_260,(uint8_t *)&image_array_260_1,(uint8_t *)&image_array_260_2); #endif /* The interval of two images alternatively change is 5 seconds */ delay_ms(5000); P2OUT &= ~BIT0; } #endif }