1. 程式人生 > >LCD橫豎屏顯示

LCD橫豎屏顯示


1)kernel 豎屏
選中:
make menuconfig ---> Device Drivers  ---> Graphics support  ---> Console display driver support  ---> Framebuffer Console Rotation


make menuconfig

                ---> Boot options  啟動引數修改為:console=ttySAC2,115200 init=/linuxrc fbcon=rotate:1


      說明: fbcon=rotate:<n>

        This option changes the orientation angle of the console display. The
        value 'n' accepts the following:

          0 - normal orientation (0 degree)
          1 - clockwise orientation (90 degrees)
          2 - upside down orientation (180 degrees)
          3 - counterclockwise orientation (270 degrees)


2)Android OS 豎屏

檔案:./native/services/surfaceflinger/SurfaceFlinger.cpp

status_t SurfaceFlinger::getDisplayInfo(const sp<IBinder>& display, DisplayInfo* info) {
    ...
 738
//    int displayOrientation = DisplayState::eOrientationDefault;
    int displayOrientation = isplayState::eOrientation90;          // 加上這行
 740     char property[PROPERTY_VALUE_MAX];
 741     if (type == DisplayDevice::DISPLAY_PRIMARY) {
 742         if (property_get("ro.sf.hwrotation", property, NULL) > 0) {
 743             switch (atoi(property)) {
 744                 case 90:
 745                     displayOrientation = DisplayState::eOrientation90;
 746                     break;
 747                 case 270:
 748                     displayOrientation = DisplayState::eOrientation270;
 749                     break;
 750             }
 751         }
 752     }
 753
 754     if (displayOrientation & DisplayState::eOrientationSwapMask) {
 755         swap(width, height);
 756     }
 757
 758     info->w = width;
 759     info->h = height;
 760     info->xdpi = xdpi;
 761     info->ydpi = ydpi;
 762     info->fps = float(1e9 / hwc.getRefreshPeriod(type));
 763
 764     // All non-virtual displays are currently considered secure.
 765     info->secure = true;
 766
 767     return NO_ERROR;
 768 }
a:     device 中init.rc修改 豎屏
[email protected]
:~/imx6-android-4.4.3/android/device/fsl/sabresd_6dq$ vim init.rc
    #Define the config for dual camera
    setprop camera.disable_zsl_mode 1
    #For landscape mode, orient is 0
    #For portrait mode, orient is 90
    #the android before honycomb are all in portrait mode
    setprop back_camera_name ov5640_mipi
    setprop back_camera_orient 0
    setprop front_camera_name uvc,ov5642_camera,ov5640_camera
    setprop front_camera_orient 0

    # Set OpenGLES version
    setprop ro.opengles.version 196608

    # Set rotation to 270 to cofigure as portrait mode
    setprop ro.sf.hwrotation 0            #指定預設輸出不旋轉(我們預設輸出時豎屏)
    #setprop ro.sf.hwrotation 270   指定旋轉270度輸出

    # Set the density to 160dpi, default 128dpi is not good
    setprop ro.sf.lcd_density 160


b: . 這個指定角度,Android預設只有0度和270度有效,180度無效,如果想使用180度,需要修改原始碼
修改檔案frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
if (type == DisplayDevice::DISPLAY_PRIMARY) {
    if (property_get("ro.sf.hwrotation", property, NULL) > 0) {
        switch (atoi(property)) {
            case 90:
                displayOrientation = DisplayState::eOrientation90;
                break;
            case 270:
                displayOrientation = DisplayState::eOrientation270;
                break;
         case 180:
                displayOrientation = DisplayState::eOrientation180;
                break;
        }
    }
}
這樣子就支援了180度了在方法

3. 還有更詳細的 - Android 4.1 預設窗體旋轉180度  
1).設定屬性值
在/out/target/product/sabresd_6dq/system/build.prop檔案中加入
ro.sf.hwrotation=180
2).設定窗體預設顯示方向
在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp檔案中找到方法
getDisplayInfo
switch (atoi(property)) 加入
 case 180:
                displayOrientation = DisplayState::eOrientation180;
                break;


3).設定窗體動畫旋轉方向
     a > 在frameworks/base/core/java/android/view/Surface.java 加入方法
public static int getDefaultRotation(){  
                return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);//180  
            }  
 
 
            /**
            * @hide
            */    
            public static int getDefaultRotationIndex(){  
                int rotation = getDefaultRotation();  
        switch(rotation){  
        case 0:  
            return ROTATION_0;  
        case 90:  
            return ROTATION_90;  
        case 180:  
            return ROTATION_180;  
        case 270:  
            return ROTATION_270;  
        }  
        return ROTATION_0;  
    }  
b > 在frameworks/base/services/java/com/android/server/vm/ScreenRotationAnimation.java 檔案中找到(android4.1) 方法setRotation
或(android4.2)方法setRotationInTransaction 修改 deltaRotation(rotation,Surface.ROTATION_0);
為deltaRotation(rotation,Surface. getDefaultRotationIndex());



相關推薦

LCD橫豎顯示

1)kernel 豎屏 選中: make menuconfig ---> Device Drivers  ---> Graphics support  ---> Console display driver support  ---> Frameb

TFT LCD液晶顯示原理

TFT LCD液晶屏的中文翻譯名稱就叫做薄膜電晶體液晶顯示器, 我們從一開始就提到 液晶顯示器需要電壓控制來產生灰階. 而利用薄膜電晶體來產生電壓,以控制液晶轉向的顯示器, 就叫做TFT LCD. 從圖8的切面結構圖來看, 在上下兩層玻璃間, 夾著液晶, 便會形成平行板電容器, 我們稱之為C

痞子衡嵌入式:降低重新整理率是定位LCD顯示問題的第一大法(i.MXRT1170, 1280x480 LVDS)

----   大家好,我是痞子衡,是正經搞技術的痞子。今天痞子衡給大家分享的是**i.MXRT1170上LCD花屏顯示問題的分析解決經驗**。   痞子衡最近這段時間在參與一個基於i.MXRT1170的大專案(先保個密),需要做一個開機動畫功能,板子連線的LCD屏解析度是1280x480,因為開機動畫要求達

LCD液晶中文顯示介紹

1.導言 和微控制器搭配的顯示器,有LCD12864、TFT、OLED等。在有些系統中,我們需要顯示漢字,可以購買漢字晶片,或者購買帶漢字顯示的顯示器,當然,也可以自己做字型檔。這裡我們介紹一種自己做字型檔的方法。 2.漢字顯示原理 看原理需要知道什麼是畫素:畫素是

STM32如何在LCD液晶顯示變數的數值

若變數是i,為浮點型變數; 在main函式前定義 char a[5]; 在main函式裡寫入: sprintf(aa,"%6.2f",temp); LCD_ShowString(100,150,200,16,16,(u8 *)aa); 即可在LCD上顯示i的值; 若i不是浮

Unity2d 移動裝置的橫豎適配及UGUI畫布調整使Editor與真實裝置的UI顯示保持一致

Unity2d預設的相機適配方法是將相機的寬高比按照手機螢幕寬高比例進行調整,保持相機高度不變並通過相機高度與螢幕實際高度比例對遊戲內容進行縮放。所以不同解析度螢幕的手機所顯示的遊戲內容在兩邊要麼有裁

Android之螢幕方向|顯示方式|Activity重建問題|橫豎切換不同的佈局

兩種方式實現鎖定Activity執行時螢幕的方向: (1)通過修改AndroidMainfest.xml配置檔案 修改Android/app/mainfests/AndroidMainfest.xml下的配置檔案如下: <activity>

Android中關於全顯示和返回原始狀態(視訊等方面在橫豎切換用到)

注意點:1.在改變全屏與否狀態列的顯示或隱藏時,關於螢幕引數的設定,豎屏切換到橫屏時需要提前設定狀態列隱藏;而橫屏切換到豎屏時需要現用現設,以上設定規則為必要條件。2.橫豎屏切換時,我們最好不要讓Act

痞子衡嵌入式:記錄i.MXRT1060驅動LCD顯示橫向漸變色有亮點問題解決全過程(解答篇)

----   大家好,我是痞子衡,是正經搞技術的痞子。今天痞子衡給大家分享的是**i.MXRT1060上LCD橫向漸變色顯示出亮點問題的分析解決經驗**。   接上篇[《一個關於LCD屏顯示出異常亮點的故事(上)》](https://www.cnblogs.com/henjay724/p/1260297

51單片機實現SMC1602液晶顯示實例

del 遍歷 思路 unsigned 初始化 移動 display -1 當前 ———————————————————————————————————————————— LCD1602 - - - - - - - - - - - - - - - - - - - - -

橫豎rem布局的判斷

bre hup title onload onchange cti || text idt <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <me

一分鐘了解Android橫豎 mdpi hdpi xhdpi xxhdpi xxxhdpi

lin msu mage 豎屏 啟動 oar href super ide DPI:每英寸像素數 簡單的屏幕分辨率計算方法: DisplayMetrics metrics = this.getResources().getDisplayMetri

Android橫豎切換View設置不同尺寸或等比例縮放的XML解決方案

fill 文件結構 nts mas hang 同名 log lan spa 在一些應用中,涉及到橫豎屏切換,View要切換成不同大小比例尺寸。為解決這種開發場景,有多種解決方案,比如可以重寫View,實現橫豎切換在onMesure或者此類View的回調方法裏面重新測量重新繪

設備旋轉---橫豎切換

不能 旋轉 clas return 設備旋轉 ota wid 豎屏 n) 前提: 必須勾選上這兩個 Left \ Right 選項; 如果不勾選, 代碼怎麽控制都不管用 不同頁面實現& shouldAutorotate/supportedInterfaceOrie

android視頻雙向實時通訊的橫豎切換

config 使用 hidden boa 實時 extend 就會 lan 屬性設置 大概的樣子是醬嬸兒的    點擊全屏按鈕時執行setRequestedOrientation方法,此時希望得到的結果是surfaceview界面全屏且橫屏顯示,並且在橫屏時Activity

移動端--判斷橫豎

on() list change cas spa orien type tno nta (function(){ var supportOrientation = (typeof window.orientation === ‘number‘ && typ

橫豎

cti pre window function 事件對象 () 橫豎 == idt 橫豎屏監聽事件onorientationchange捕獲到的是屏幕旋轉瞬間之前的狀態,所以通過事件對象獲取的屏幕寬度並不是旋轉後的寬度。 var sw = screen.width,

android 橫豎切換不重走生命周期

orien man ati nta 系統 生命周期 oar hang andro android在系統配置發生改變時,Activity會被重新創建,但是某些情況下我們希望系統配置改變時不會重新創建Activity,這個時候我們可以給Activity指定相對應的configC

PB做大顯示滾動窗口 [轉載]

間接 htm transacti geb int conn 大屏 obj size 前段時間接到一個同事的求助 一個客戶需求做門診已完成報告通知取單的大屏顯示界面 百度了一下,其實很簡單 實現方法如下 1.用要顯示數據的sql語句做成數據窗口(datawindow);

window.open全顯示

location res cati ati idt scroll style span url 將window.open(url,‘‘,‘height=600,width=910,top=0,left=0,toolbar=no,menubar=no,scrollbars=y