NanoPayload

stage2/minipc_claa070vc01.h

216:95be7694d999
2017-06-28 Paul Boddie Employ structure member names to make initialisation clearer.
     1 /*     2  * MiniPC panel-specific definitions     3  *     4  * Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>     5  * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>     6  *     7  * This program is free software; you can redistribute it and/or     8  * modify it under the terms of the GNU General Public License as     9  * published by the Free Software Foundation; either version 2 of    10  * the License, or (at your option) any later version.    11  *    12  * This program is distributed in the hope that it will be useful,    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the    15  * GNU General Public License for more details.    16  *    17  * You should have received a copy of the GNU General Public License    18  * along with this program; if not, write to the Free Software    19  * Foundation, Inc., 51 Franklin Street, Fifth Floor,    20  * Boston, MA  02110-1301, USA    21  */    22     23 #ifndef __MINIPC_CLAA070VC01_H__    24 #define __MINIPC_CLAA070VC01_H__    25     26 #include "board.h"    27 #include "minipc.h"    28     29 static inline void __lcd_set_backlight_level(u16 n)    30 {    31 	__gpio_as_pwm();    32 	REG_PWM_DUT(0) = n;    33 	REG_PWM_PER(0) = 7;    34 	REG_PWM_CTR(0) = 0xc1;    35 }    36     37 static inline void __lcd_close_backlight()    38 {    39 	__gpio_as_output(GPIO_PWM0);    40 	__gpio_clear_pin(GPIO_PWM0);    41 }    42     43 static inline void __lcd_display_pin_init()    44 {    45 	__gpio_as_output(GPIO_DISP_OFF_N);    46 	__lcd_set_backlight_level(8);    47 }    48     49 static inline void __lcd_display_on()    50 {    51 	__gpio_set_pin(GPIO_DISP_OFF_N);    52 	__lcd_set_backlight_level(8);    53 }    54     55 static inline void __lcd_display_off()    56 {    57 	__lcd_close_backlight();    58 	__gpio_clear_pin(GPIO_DISP_OFF_N);    59 }    60     61 #endif /* __MINIPC_CLAA070VC01_H__ */