linux下从spi中读取一张logo图片并显示
2015-12-26 15:58
591 查看
思路:将图片分size/256bytes次读出来,读写函数是底层spi驱动提供的接口
UINT8* spi_read_shutdownlogo(void)
{
int spi_fd;
char spi_addr[4];
int freq = 12000000;
UINT32 addr;
UINT32 i;
UINT8* rdbuffer1=NULL;
UINT32 loop_num;
for(i=0;i
/* for (int y = 0; y
}
UINT8* spi_read_shutdownlogo(void)
{
int spi_fd;
char spi_addr[4];
int freq = 12000000;
UINT32 addr;
UINT32 i;
UINT8* rdbuffer1=NULL;
UINT32 loop_num;
spi_fd = open("/dev/spi",O_RDWR); if(spi_fd<0){ printf("Can't open [/dev/spi0]\n"); return 0; } ioctl(spi_fd, SPI_IOCTL_SET_CHANNEL, 0); //Set SPI CS0 ioctl(spi_fd, SPI_IOCTL_SET_FREQ, freq); ioctl(spi_fd, SPI_IOCTL_SET_DMA, 0); printf("============ENABLE==SPI============\n"); rdbuffer1=gpChunkMemAlloc(1020*1024); if (!rdbuffer1) { printf("Cannot malloc memory buffer.\n"); close(spi_fd); goto exit; } addr=spi_header_check(); loop_num=1020*4;
for(i=0;i
if 0
strcat(file_path, "POWER_OFF_LOGO.JPG"); printf("open file %s\n",file_path); fb1.pData = fb; fb1.validRect.x = 0; fb1.validRect.y = 0; fb1.validRect.width = resolution.width; fb1.validRect.height=resolution.height; Gdjpegdecode(file_path, &fb1, resolution.width,resolution.height,&resolution, 0); dispFlip(hDisp); if(dv_set.display_mode == SP_DISP_OUTPUT_LCD) { LCD_Backlight_Set(1); }
else
rdbuffer=gpChunkMemAlloc(1020*1024); if(rdbuffer<0) { printf("malloc error!!!!\n"); return 0; } rdbuffer=spi_read_shutdownlogo();
/* for (int y = 0; y
endif
Play_Key_sound(SOUND_POWER_OFF); ap_state_config_store();
if ENABLE_AUTO_REBOOT
Gsensor_Set_Int_Level(1); //
endif
sleep(1); LCD_Backlight_Set(0); sleep(1); while(1) { if(dv_set.power_off == 1) { printf("wait sound end or pic show \n"); // if(setting_config_get(SET_GSENSOR1)!=0) { Gsensor_parking_mode(setting_config_get(SET_GSENSOR1)); Gsensor_parking_mode_int_read(); } break; } usleep(10000); } //if(dv_set.usb_detect != 1) kill(getppid(), SIGUSR1); Power_Off_Set(); LED_Set(NORMAL_LED,0); Enable_Sensor_Power(0); //USB plug in LCD_Backlight_Set(0); LED_Set(IR_LED,0); LED_Set(MUTE_ON,0); dispDestroy(hDisp); PLL_ctl_en(pllhd, 1, 0); dv_set.power_off = 2; while(1) { Power_Off_Set(); printf("have power off, release power key!\n"); if(power_off == 3||power_off == 0) { printf("sleep 2s!\n"); sleep(2); printf("~~~~~~~start watchdog\n"); printf("power on!\n"); fd = open("/dev/watchdog",0); if(fd<0) { printf("car recoder open watchdog fail!\n"); } ioctl(fd,WDIOC_SETTIMEROUT,0); //set timeout 0s ioctl(fd,WDIOC_CTRL,1); //enable watchdog close(fd); kill(getppid(), SIGUSR1); } usleep(100); }
}
相关文章推荐
- Linux socket 初步
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- 基于 Linux 集群环境上 GPFS 的问题诊断
- 谁是桌面王者?Win PK Linux三大镇山之宝
- vivi下重新调整分区