A31L12x F/W Packages  1.4.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
Functions
A31L12x_hal_rtcc.c File Reference

Contains all functions support for rtcc firmware library on A31L12x. More...

Go to the source code of this file.

Functions

HAL_Status_Type HAL_RTCC_Init (void *RTCC_Config)
 Initialize the RTCC peripheral with the specified parameters. More...
 
void HAL_RTCC_DeInit (void)
 Close RTCC. More...
 
void HAL_RTCC_SetRegister (uint32_t u32rtccSet)
 Set RTC_CR Registers. More...
 
void HAL_RTCC_Cmd (FunctionalState NewState)
 Enable/Disable RTCC Operation. More...
 
void HAL_RTCC_RewriteYEAR (uint32_t u32rtccReWt)
 Rewrite to RTCC YEAR Register. More...
 
void HAL_RTCC_RewriteMONTH (uint32_t u32rtccReWt)
 Rewrite to RTCC MONTH Register. More...
 
void HAL_RTCC_RewriteWEEK (uint32_t u32rtccReWt)
 Rewrite to RTCC WEEK Register. More...
 
void HAL_RTCC_RewriteDAY (uint32_t u32rtccReWt)
 Rewrite to RTCC DAY Register. More...
 
void HAL_RTCC_RewriteHOUR (uint32_t u32rtccReWt)
 Rewrite to RTCC HOUR Register. More...
 
void HAL_RTCC_RewriteMIN (uint32_t u32rtccReWt)
 Rewrite to RTCC MIN Register. More...
 
void HAL_RTCC_RewriteSEC (uint32_t u32rtccReWt)
 Rewrite to RTCC SEC Register. More...
 

Detailed Description

Contains all functions support for rtcc firmware library on A31L12x.

Version
1.00
Date
2020-05-29
Author
ABOV Application Team

Copyright(C) 2019, ABOV Semiconductor All rights reserved.

ABOV Disclaimer

IMPORTANT NOTICE ? PLEASE READ CAREFULLY ABOV Semiconductor ("ABOV") reserves the right to make changes, corrections, enhancements, modifications, and improvements to ABOV products and/or to this document at any time without notice. ABOV does not give warranties as to the accuracy or completeness of the information included herein. Purchasers should obtain the latest relevant information of ABOV products before placing orders. Purchasers are entirely responsible for the choice, selection, and use of ABOV products and ABOV assumes no liability for application assistance or the design of purchasers' products. No license, express or implied, to any intellectual property rights is granted by ABOV herein. ABOV disclaims all express and implied warranties and shall not be responsible or liable for any injuries or damages related to use of ABOV products in such unauthorized applications. ABOV and the ABOV logo are trademarks of ABOV. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces the information previously supplied in any former versions of this document. 2020 ABOV Semiconductor All rights reserved

Definition in file A31L12x_hal_rtcc.c.

Function Documentation

◆ HAL_RTCC_Cmd()

void HAL_RTCC_Cmd ( FunctionalState  NewState)

Enable/Disable RTCC Operation.

Parameters
[in]NewStateNext State of Functional Operation
  • ENABLE, DISABLE
Returns
None

Definition at line 112 of file A31L12x_hal_rtcc.c.

113 {
114  if( NewState == ENABLE )
115  {
116  RTCC->CR |= RTCC_RTEN;
117  }
118  else
119  {
120  RTCC->CR &= ~RTCC_RTEN;
121  }
122 }

References ENABLE.

◆ HAL_RTCC_DeInit()

void HAL_RTCC_DeInit ( void  )

Close RTCC.

Returns
None

Definition at line 85 of file A31L12x_hal_rtcc.c.

86 {
87  HAL_SCU_Peripheral_SetReset2( 1 << SCUCG_PPRST2_RTCRST_Pos );
88  HAL_SCU_Peripheral_EnableClock2( PPCLKEN2_RTCCLKE, PPxCLKE_Disable );
89 }
void HAL_SCU_Peripheral_EnableClock2(uint32_t u32PeriClk2, uint32_t u32Ind)
Set Each Peripheral Clock.
void HAL_SCU_Peripheral_SetReset2(uint32_t u32EachPeri2)
Set/Reset Each Peripheral Block Reset of PPRST2 Register.

References HAL_SCU_Peripheral_EnableClock2(), and HAL_SCU_Peripheral_SetReset2().

Here is the call graph for this function:

◆ HAL_RTCC_Init()

HAL_Status_Type HAL_RTCC_Init ( void *  RTCC_Config)

Initialize the RTCC peripheral with the specified parameters.

Parameters
[in]RTCC_ConfigPointer to the configuration information for the specified peripheral.
Returns
HAL_Status_Type

Definition at line 54 of file A31L12x_hal_rtcc.c.

55 {
56  RTCC_CFG_Type* pRtccCfg;
57  uint32_t reg_val32;
58 
59  /* Check RTCC_Config */
60  if( RTCC_Config == NULL )
61  {
62  return HAL_ERROR;
63  }
64 
65  // enable peripheral clock: RTCC.
66  HAL_SCU_Peripheral_EnableClock2( PPCLKEN2_RTCCLKE, PPxCLKE_Enable );
67 
68  pRtccCfg = ( RTCC_CFG_Type* )RTCC_Config;
69 
70  reg_val32 = 0
71  | RTCC_CR_RTIN_SET( pRtccCfg->rtccIntIn )
72  | RTCC_CR_HS24_SET( pRtccCfg->rtccHS24 )
73  | RTCC_CR_OUTSEL_SET( pRtccCfg->rtccOutsel )
74  ;
75 
76  RTCC->CR = reg_val32;
77 
78  return HAL_OK;
79 }
void HAL_SCU_Peripheral_EnableClock2(uint32_t u32PeriClk2, uint32_t u32Ind)
Set Each Peripheral Clock.

References HAL_ERROR, HAL_OK, HAL_SCU_Peripheral_EnableClock2(), RTCC_CFG_Type::rtccHS24, RTCC_CFG_Type::rtccIntIn, and RTCC_CFG_Type::rtccOutsel.

Here is the call graph for this function:

◆ HAL_RTCC_RewriteDAY()

void HAL_RTCC_RewriteDAY ( uint32_t  u32rtccReWt)

Rewrite to RTCC DAY Register.

Parameters
[in]u32rtccReWtRTCC DAY Counter Register data
Returns
None

Definition at line 175 of file A31L12x_hal_rtcc.c.

176 {
177  RTCC->CR |= ( 1 << RTCC_CR_RTWAIT_Pos ); // Stop RTSEC to RTYEAR counters for read/write counter value.
178  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 0 ) {} // wait until RTWST = 1
179  RTCC->DAY = u32rtccReWt; // Write to RTCC->DAY register
180  RTCC->CR &= ~RTCC_CR_RTWAIT_Msk; // Set counter Operation
181  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 1 ) {} // wait until RTWST = 0
182 }

◆ HAL_RTCC_RewriteHOUR()

void HAL_RTCC_RewriteHOUR ( uint32_t  u32rtccReWt)

Rewrite to RTCC HOUR Register.

Parameters
[in]u32rtccReWtRTCC HOUR Counter Register data
Returns
None

Definition at line 190 of file A31L12x_hal_rtcc.c.

191 {
192  RTCC->CR |= ( 1 << RTCC_CR_RTWAIT_Pos ); // Stop RTSEC to RTYEAR counters for read/write counter value.
193  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 0 ) {} // wait until RTWST = 1
194  RTCC->HOUR = u32rtccReWt; // Write to RTCC->HOUR register
195  RTCC->CR &= ~RTCC_CR_RTWAIT_Msk; // Set counter Operation
196  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 1 ) {} // wait until RTWST = 0
197 }

◆ HAL_RTCC_RewriteMIN()

void HAL_RTCC_RewriteMIN ( uint32_t  u32rtccReWt)

Rewrite to RTCC MIN Register.

Parameters
[in]u32rtccReWtRTCC MIN Counter Register data
Returns
None

Definition at line 205 of file A31L12x_hal_rtcc.c.

206 {
207  RTCC->CR |= ( 1 << RTCC_CR_RTWAIT_Pos ); // Stop RTSEC to RTYEAR counters for read/write counter value.
208  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 0 ) {} // wait until RTWST = 1
209  RTCC->MIN = u32rtccReWt; // Write to RTCC->MIN register
210  RTCC->CR &= ~RTCC_CR_RTWAIT_Msk; // Set counter Operation
211  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 1 ) {} // wait until RTWST = 0
212 }

◆ HAL_RTCC_RewriteMONTH()

void HAL_RTCC_RewriteMONTH ( uint32_t  u32rtccReWt)

Rewrite to RTCC MONTH Register.

Parameters
[in]u32rtccReWtRTCC MONTH Counter Register data
Returns
None

Definition at line 145 of file A31L12x_hal_rtcc.c.

146 {
147  RTCC->CR |= ( 1 << RTCC_CR_RTWAIT_Pos ); // Stop RTSEC to RTYEAR counters for read/write counter value.
148  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 0 ) {} // wait until RTWST = 1
149  RTCC->MONTH = u32rtccReWt; // Write to RTCC->MONTH register
150  RTCC->CR &= ~RTCC_CR_RTWAIT_Msk; // Set counter Operation
151  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 1 ) {} // wait until RTWST = 0
152 }

◆ HAL_RTCC_RewriteSEC()

void HAL_RTCC_RewriteSEC ( uint32_t  u32rtccReWt)

Rewrite to RTCC SEC Register.

Parameters
[in]u32rtccReWtRTCC SEC Counter Register data
Returns
None

Definition at line 220 of file A31L12x_hal_rtcc.c.

221 {
222  RTCC->CR |= ( 1 << RTCC_CR_RTWAIT_Pos ); // Stop RTSEC to RTYEAR counters for read/write counter value.
223  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 0 ) {} // wait until RTWST = 1
224  RTCC->SEC = u32rtccReWt; // Write to RTCC->SEC register
225  RTCC->CR &= ~RTCC_CR_RTWAIT_Msk; // Set counter Operation
226  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 1 ) {} // wait until RTWST = 0
227 }

◆ HAL_RTCC_RewriteWEEK()

void HAL_RTCC_RewriteWEEK ( uint32_t  u32rtccReWt)

Rewrite to RTCC WEEK Register.

Parameters
[in]u32rtccReWtRTCC WEEK Counter Register data
Returns
None

Definition at line 160 of file A31L12x_hal_rtcc.c.

161 {
162  RTCC->CR |= ( 1 << RTCC_CR_RTWAIT_Pos ); // Stop RTSEC to RTYEAR counters for read/write counter value.
163  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 0 ) {} // wait until RTWST = 1
164  RTCC->WEEK = u32rtccReWt; // Write to RTCC->WEEK register
165  RTCC->CR &= ~RTCC_CR_RTWAIT_Msk; // Set counter Operation
166  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 1 ) {} // wait until RTWST = 0
167 }

◆ HAL_RTCC_RewriteYEAR()

void HAL_RTCC_RewriteYEAR ( uint32_t  u32rtccReWt)

Rewrite to RTCC YEAR Register.

Parameters
[in]u32rtccReWtRTCC YEAR Counter Register data
Returns
None

Definition at line 130 of file A31L12x_hal_rtcc.c.

131 {
132  RTCC->CR |= ( 1 << RTCC_CR_RTWAIT_Pos ); // Stop RTSEC to RTYEAR counters for read/write counter value.
133  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 0 ) {} // wait until RTWST = 1
134  RTCC->YEAR = u32rtccReWt; // Write to RTCC->YEAR register
135  RTCC->CR &= ~RTCC_CR_RTWAIT_Msk; // Set counter Operation
136  while( ( RTCC->CR & ( 1 << RTCC_CR_RTWST_Pos ) ) == 1 ) {} // wait until RTWST = 0
137 }

◆ HAL_RTCC_SetRegister()

void HAL_RTCC_SetRegister ( uint32_t  u32rtccSet)

Set RTC_CR Registers.

Parameters
[in]u32rtccSetRTCC Control Register Setting Data
Returns
None

This function sets the mode, Interrupt Interval, 12/24-hour System Selection, Alarm Match Operation and RTCOUT Selection.

Definition at line 100 of file A31L12x_hal_rtcc.c.

101 {
102  RTCC->CR = u32rtccSet; // Setting RTCC Control Register
103 }