NanoPayload

Change of stage2/minipc_claa070vc01.h

112:ccf05eea0d54
stage2/minipc_claa070vc01.h stage2-non-pic
     1.1 --- a/stage2/minipc_claa070vc01.h	Mon Feb 22 17:07:55 2016 +0100
     1.2 +++ b/stage2/minipc_claa070vc01.h	Mon Feb 22 18:01:27 2016 +0100
     1.3 @@ -2,7 +2,7 @@
     1.4   * MiniPC panel-specific definitions
     1.5   *
     1.6   * Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>
     1.7 - * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
     1.8 + * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
     1.9   *
    1.10   * This program is free software; you can redistribute it and/or
    1.11   * modify it under the terms of the GNU General Public License as
    1.12 @@ -23,36 +23,39 @@
    1.13  #ifndef __MINIPC_CLAA070VC01_H__
    1.14  #define __MINIPC_CLAA070VC01_H__
    1.15  
    1.16 -#define __lcd_set_backlight_level(n) \
    1.17 -do { \
    1.18 -	__gpio_as_pwm(); \
    1.19 -	REG_PWM_DUT(0) = n; \
    1.20 -	REG_PWM_PER(0) = 7; \
    1.21 -	REG_PWM_CTR(0) = 0xc1; \
    1.22 -} while (0)
    1.23 +#include "board.h"
    1.24 +#include "minipc.h"
    1.25  
    1.26 -#define __lcd_close_backlight() \
    1.27 -do { \
    1.28 -__gpio_as_output(GPIO_PWM0);\
    1.29 -__gpio_clear_pin(GPIO_PWM0);\
    1.30 -} while (0)
    1.31 +static inline void __lcd_set_backlight_level(u16 n)
    1.32 +{
    1.33 +	__gpio_as_pwm();
    1.34 +	REG_PWM_DUT(0) = n;
    1.35 +	REG_PWM_PER(0) = 7;
    1.36 +	REG_PWM_CTR(0) = 0xc1;
    1.37 +}
    1.38 +
    1.39 +static inline void __lcd_close_backlight()
    1.40 +{
    1.41 +	__gpio_as_output(GPIO_PWM0);
    1.42 +	__gpio_clear_pin(GPIO_PWM0);
    1.43 +}
    1.44  
    1.45 -#define __lcd_display_pin_init() \
    1.46 -do { \
    1.47 -	__gpio_as_output(GPIO_DISP_OFF_N); \
    1.48 -	__lcd_set_backlight_level(8); \
    1.49 -} while (0)
    1.50 +static inline void __lcd_display_pin_init()
    1.51 +{
    1.52 +	__gpio_as_output(GPIO_DISP_OFF_N);
    1.53 +	__lcd_set_backlight_level(8);
    1.54 +}
    1.55  
    1.56 -#define __lcd_display_on() \
    1.57 -do { \
    1.58 -	__gpio_set_pin(GPIO_DISP_OFF_N); \
    1.59 -	__lcd_set_backlight_level(8); \
    1.60 -} while (0)
    1.61 +static inline void __lcd_display_on()
    1.62 +{
    1.63 +	__gpio_set_pin(GPIO_DISP_OFF_N);
    1.64 +	__lcd_set_backlight_level(8);
    1.65 +}
    1.66  
    1.67 -#define __lcd_display_off() \
    1.68 -do { \
    1.69 -	__lcd_close_backlight(); \
    1.70 -	__gpio_clear_pin(GPIO_DISP_OFF_N); \
    1.71 -} while (0)
    1.72 +static inline void __lcd_display_off()
    1.73 +{
    1.74 +	__lcd_close_backlight();
    1.75 +	__gpio_clear_pin(GPIO_DISP_OFF_N);
    1.76 +}
    1.77  
    1.78  #endif /* __MINIPC_CLAA070VC01_H__ */