A31R71x F/W Packages  1.5.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31R71x_hal_lcd.c
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 /* Includes ----------------------------------------------------------------- */
36 //******************************************************************************
37 // Include
38 //******************************************************************************
39 
40 #include "A31R71x_hal_lcd.h"
41 #include "A31R71x_hal_scu.h"
42 
43 /* Public Functions --------------------------------------------------------- */
44 //******************************************************************************
45 // Function
46 //******************************************************************************
47 
48 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
58 {
59  /* Check LCD_Config */
60  if( LCD_Config == NULL )
61  {
62  return HAL_ERROR;
63  }
64 
65  // enable peripheral clock
66  HAL_SCU_Peripheral_EnableClock2( PPCLKEN2_LCDCLKE, PPxCLKE_Enable );
67 
68  LCD->CR = 0
69  | LCD_Config->BiasType
70  | LCD_Config->Bias
71  | LCD_Config->Duty
72  | LCD_Config->Clk
73  ;
74 
75  LCD->CCR = 0
76  | LCD_Config->ContrastStep
77  ;
78 
79  // return
80  return HAL_OK;
81 }
82 
83 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
93 HAL_Status_Type HAL_LCD_SetRegister( uint32_t LCD_CR, uint32_t LCD_CCR )
94 {
95  LCD->CR = LCD_CR; // Set LCD Driver Control Register
96  LCD->CCR = LCD_CCR; // Set LCD Driver Contrast Control Register
97 
98  return HAL_OK;
99 }
100 
101 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
107 {
108  uint8_t u32Index;
109  volatile uint8_t* lcd_dsp_ram;
110 
111  lcd_dsp_ram = &LCD->DR0;
112  for( u32Index = 0; u32Index < LCDBufSize; u32Index ++ )
113  {
114  lcd_dsp_ram[u32Index] = 0;
115  }
116 
117  return HAL_OK;
118 }
119 
120 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
131 HAL_Status_Type HAL_LCD_WriteDspRam( uint8_t* write_buf, uint32_t u32Index, uint32_t size )
132 {
133  volatile uint8_t* lcd_dsp_ram;
134  uint32_t i;
135 
136  if( ( u32Index + size ) > LCDBufSize ) // Check Buffer size
137  {
138  size = size - ( ( u32Index + size ) - LCDBufSize );
139  }
140 
141  lcd_dsp_ram = &LCD->DR0;
142  for( i = 0; i < size; i ++ )
143  {
144  lcd_dsp_ram[u32Index + i] = write_buf[i];
145  }
146 
147  return HAL_OK;
148 }
149 
HAL_Status_Type
uint32_t ContrastStep
HAL_Status_Type HAL_LCD_SetRegister(uint32_t LCD_CR, uint32_t LCD_CCR)
Set LCD LCD_CR/LCD_CCR Registers.
Contains all macro definitions and function prototypes support for scu firmware library on A31R71x.
Contains all macro definitions and function prototypes support for lcd firmware library on A31R71x.
HAL_Status_Type HAL_LCD_WriteDspRam(uint8_t *write_buf, uint32_t u32Index, uint32_t size)
Write LCD Buffer.
uint32_t BiasType
HAL_Status_Type HAL_LCD_ClearDspRam(void)
Clear LCD Buffer.
HAL_Status_Type HAL_LCD_Init(LCD_CFG_Type *LCD_Config)
Initialize the LCD peripheral with the specified parameters.
void HAL_SCU_Peripheral_EnableClock2(uint32_t u32PeriClk2, uint32_t u32Ind)
Set Each Peripheral Clock.