linux下从spi中读取一张logo图片并显示
来源:互联网 发布:什么是数据保全 编辑:程序博客网 时间:2024/05/16 09:49
思路:将图片分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;
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 inLCD_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);}
}
0 0
- linux下从spi中读取一张logo图片并显示
- OpenCV 中读取一张图片的像素点,并显示
- Android中从网上下载一张图片显示进度并显示下载好的图片
- 从数据库中读取Blob对象图片并显示
- C#从数据库中读取二进制数据,并显示图片
- 从数据库中读取Blob对象图片并显示
- 从浏览器剪切板中读取图片并显示--for chrome
- 从指定的路径中读取图片,并显示出来
- 从数据库中读取Blob对象图片并显示
- 从MySQL中读取图片并基于VTK显示
- Java从数据库中读取Blob对象图片并显示
- Halcon 与 c# 混合编程读取并显示一张图片
- android从网络中获得一张图片,并显示在屏幕上
- android从网络中获得一张图片,并显示在屏幕上
- Android如何从图库获取一张图片并显示
- PowerBuilder从数据库读取并显示图片。
- Jsp从数据库读取并显示图片
- 从工程外读取图片,并显示
- 循环结构<1>__笔记(5)
- strace
- 记录一下互联网日志实时收集和实时计算的简单方案
- linux上安装zookeeper
- Linux常用命令
- linux下从spi中读取一张logo图片并显示
- Linux Is Not Matrix——Nginx做成linux服务
- I'm back.
- 【机器学习】K-Means 聚类是特殊的矩阵分解问题
- 去哪儿APP设计总结
- Spring idref标签和ref的区别
- 【oracle】揭开oracle神秘面纱之Sequence
- 群集的未预留容量不足,无法满足 vSphere HA 接入控制的配置级别
- 【设计模式】—工厂之家