A31L12x F/W Packages  1.4.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31L12x_hal_lcd.c
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 /* Includes ----------------------------------------------------------------- */
36 //******************************************************************************
37 // Include
38 //******************************************************************************
39 
40 #include "A31L12x_hal_lcd.h"
41 #include "A31L12x_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->Bias
70  | LCD_Config->Duty
71  | LCD_Config->Clk
72  ;
73 
74  LCD->BCCR = 0
75  | LCD_Config->AutoBiasEn
76  | LCD_Config->BiasTime
77  | LCD_Config->Contrast
78  | LCD_Config->ContrastStep
79  ;
80 
81  // return
82  return HAL_OK;
83 }
84 
85 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
95 HAL_Status_Type HAL_LCD_SetRegister( uint32_t u32LCD_CR, uint32_t u32LCD_BCCR )
96 {
97  LCD->CR = u32LCD_CR; // Set LCD Driver Control Register
98  LCD->BCCR = u32LCD_BCCR; // Set LCD Driver Automatic Bias and Contrast Control Register
99 
100  return HAL_OK;
101 }
102 
103 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
109 {
110  uint8_t u32Index;
111  volatile uint8_t* lcd_dsp_ram;
112 
113  lcd_dsp_ram = &LCD->DR0;
114  for( u32Index = 0; u32Index < LCDBufSize; u32Index ++ )
115  {
116  lcd_dsp_ram[u32Index] = 0;
117  }
118 
119  return HAL_OK;
120 }
121 
122 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
133 HAL_Status_Type HAL_LCD_WriteDspRam( uint8_t* write_buf, uint32_t u32Index, uint32_t size )
134 {
135  volatile uint8_t* lcd_dsp_ram;
136  uint32_t i;
137 
138  if( ( u32Index + size ) > LCDBufSize ) // Check Buffer size
139  {
140  size = size - ( ( u32Index + size ) - LCDBufSize );
141  }
142 
143  lcd_dsp_ram = &LCD->DR0;
144  for( i = 0; i < size; i ++ )
145  {
146  lcd_dsp_ram[u32Index + i] = write_buf[i];
147  }
148 
149  return HAL_OK;
150 }
151 
uint32_t ContrastStep
HAL_Status_Type HAL_LCD_Init(LCD_CFG_Type *LCD_Config)
Initialize the LCD peripheral with the specified parameters.
uint32_t Contrast
void HAL_SCU_Peripheral_EnableClock2(uint32_t u32PeriClk2, uint32_t u32Ind)
Set Each Peripheral Clock.
HAL_Status_Type
uint32_t AutoBiasEn
uint32_t BiasTime
HAL_Status_Type HAL_LCD_WriteDspRam(uint8_t *write_buf, uint32_t u32Index, uint32_t size)
Write LCD Buffer.
Contains all macro definitions and function prototypes support for lcd firmware library on A31L12x.
HAL_Status_Type HAL_LCD_SetRegister(uint32_t u32LCD_CR, uint32_t u32LCD_BCCR)
Set LCD LCD_CR/LCD_BCCR Registers.
Contains all macro definitions and function prototypes support for scu firmware library on A31L12x.
HAL_Status_Type HAL_LCD_ClearDspRam(void)
Clear LCD Buffer.