Sie sind auf Seite 1von 3

#include #include #include #include #define #define #define #define #define const const const const const const

const const const const const const const const

"stm32f4_discovery.h" "stdio.h" "libjpgfor32f4/jpeglib.h" <setjmp.h> RST CS RDX WRX DC GPIO_Pin_2 GPIO_Pin_7 GPIO_Pin_4 GPIO_Pin_5 GPIO_Pin_11 //pc2 //pd7 //pd4 //pd5 //PD 11

uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t

commandbuffer[]={0x01,0x11,0x29,0x2C}; ramwr[]={0x2C}; norn[]= {0x13}; idloff[]={0x39}; madctl[]={0x36}; horiz[]={0x60}; verti[]={0xC0}; red[]={0xFF,0x00,0x00}; green[]={0x00,0xFF,0x00}; blue[]={0x00,0x00,0xFF}; black[]={0x00,0x00,0x00}; white[]={0xFF,0xFF,0xFF}; caset[]={0x2A}; paset[]={0x2B};

void initDisplay() { GPIO_ResetBits(GPIOC,RST); //CS/RST/DC SHOULD GO LOW FOR ATLEAST 120 MS.. Delay(1680); GPIO_SetBits(GPIOC,RST); //Rst held high for atleast 10ms Delay(16800000); SRAM_writecommand(commandbuffer,4); FILLLCD(green); FILLLCD(blue); } void my_error_exit (j_common_ptr cinfo) { /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */ my_error_ptr myerr = (my_error_ptr) cinfo->err; /* Always display the message. */ /* We could postpone this until after returning, if we chose. */ (*cinfo->err->output_message) (cinfo); /* Return control to the setjmp point */ longjmp(myerr->setjmp_buffer, 1); } ////////////////*********************************************//////////////// **************/// JSAMPARRAY buffer; /* Output row buffer */ struct jpeg_decompress_struct cinfo;

main() { void fullarea() { SRAM_writecommand(caset,1); SRAM_WriteBuffer(cassetaddr,4); SRAM_writecommand(paset,1); SRAM_WriteBuffer(passetaddr,4); } //this area affects

SRAM_Init();

initDisplay();
SRAM_writecommand(madctl,1); SRAM_WriteBuffer(horiz,1); FILLLCD(red); FILLLCD(green); FILLLCD(blue); Delay(0xffffff); struct my_error_mgr jerr;

int row_stride;

/* physical row width in output buffer */

cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = my_error_exit; /* Establish the setjmp return context for my_error_exit to use. */ if (setjmp(jerr.setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error. * We need to clean up the JPEG object, close the input file, and return. */ jpeg_destroy_decompress(&cinfo); return 0; jpeg_create_decompress(&cinfo); jpeg_mem_src(&cinfo,leaves,sizeof(leaves));

jpeg_read_header(&cinfo, TRUE); jpeg_start_decompress(&cinfo); int buffer_height =1; buffer=(JSAMPARRAY)malloc(sizeof(JSAMPROW) * buffer_height); buffer[0] = (JSAMPROW)malloc(sizeof(JSAMPLE) * row_stride); fullarea(); SRAM_writecommand(ramwr,1); while (cinfo.output_scanline <cinfo.output_height) { jpeg_read_scanlines(&cinfo,buffer,1); sendfont(buffer[0],960); } jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); } While(1){} } void Delay(__IO uint32_t nCount) { while(nCount--) { } }

Das könnte Ihnen auch gefallen