G32R430 Device Driver Layer v1.0.4
G32R4xx Device Driver Layer API Reference
g32r4xx_ddl_ts.h
Go to the documentation of this file.
1
42
43/* Define to prevent recursive inclusion -------------------------------------*/
44#ifndef G32R4xx_DDL_TS_H
45#define G32R4xx_DDL_TS_H
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/* Includes ------------------------------------------------------------------*/
52#include "g32r4xx.h"
53
57
58#if defined (TS)
59
63
64/* Private types -------------------------------------------------------------*/
65/* Private variables ---------------------------------------------------------*/
66/* Private constants ---------------------------------------------------------*/
67/* Private macros ------------------------------------------------------------*/
68/* Exported types ------------------------------------------------------------*/
69/* Exported constants --------------------------------------------------------*/
73#define DDL_TS_SAMPLING_RATE_128 (0x00000000UL)
74#define DDL_TS_SAMPLING_RATE_256 (TS_CR_OSR_SEL_0)
75#define DDL_TS_SAMPLING_RATE_512 (TS_CR_OSR_SEL_1)
76#define DDL_TS_SAMPLING_RATE_1024 (TS_CR_OSR_SEL_0 | TS_CR_OSR_SEL_1)
77
78#define DDL_TS_OVERFLOW_KEEP_OLD (0x00000000UL)
79#define DDL_TS_OVERFLOW_USE_NEW (TS_CR_OVRMOD)
80
81#define DDL_TS_FLAG_DATA_IS_RDY (TS_SR_RDY)
82#define DDL_TS_FLAG_DATA_IS_NOTRDY (0x00000000UL)
83
84#define DDL_TS_FLAG_DATA_IS_OVR (TS_SR_OVR)
85#define DDL_TS_FLAG_DATA_IS_NOTOVR (0x00000000UL)
86
90
91/* Exported macro ------------------------------------------------------------*/
92/* Exported functions --------------------------------------------------------*/
96
102__STATIC_INLINE void DDL_TS_Enable(TS_TypeDef *TSx)
103{
104 SET_BIT(TSx->CR, TS_CR_TS_EN);
105}
106
112__STATIC_INLINE void DDL_TS_Disable(TS_TypeDef *TSx)
113{
114 CLEAR_BIT(TSx->CR, TS_CR_TS_EN);
115}
116
122__STATIC_INLINE uint32_t DDL_TS_IsEnabled(TS_TypeDef *TSx)
123{
124 return ((READ_BIT(TSx->CR, TS_CR_TS_EN) == (TS_CR_TS_EN)) ? 1UL : 0UL);
125}
126
137__STATIC_INLINE void DDL_TS_SetSamplingRate(TS_TypeDef *TSx, uint32_t SamplingRate)
138{
139 MODIFY_REG(TSx->CR, TS_CR_OSR_SEL, SamplingRate);
140}
141
151__STATIC_INLINE uint32_t DDL_TS_GetSamplingRate(TS_TypeDef *TSx)
152{
153 return (uint32_t)READ_BIT(TSx->CR, TS_CR_OSR_SEL);
154}
155
164__STATIC_INLINE void DDL_TS_SetDataOverFlowControlMode(TS_TypeDef *TSx, uint32_t mode)
165{
166 MODIFY_REG(TSx->CR, TS_CR_OVRMOD, mode);
167}
168
176__STATIC_INLINE uint32_t DDL_TS_GetDataOverFlowControlMode(TS_TypeDef *TSx)
177{
178 return (uint32_t)READ_BIT(TSx->CR, TS_CR_OVRMOD);
179}
180
186__STATIC_INLINE void DDL_TS_EnableIT(TS_TypeDef *TSx)
187{
188 SET_BIT(TSx->CR, TS_CR_TS_IE);
189}
190
196__STATIC_INLINE void DDL_TS_DisableIT(TS_TypeDef *TSx)
197{
198 CLEAR_BIT(TSx->CR, TS_CR_TS_IE);
199}
200
206__STATIC_INLINE uint32_t DDL_TS_IsEnabledIT(TS_TypeDef *TSx)
207{
208 return ((READ_BIT(TSx->CR, TS_CR_TS_IE) == (TS_CR_TS_IE)) ? 1UL : 0UL);
209}
210
216__STATIC_INLINE void DDL_TS_EnableIT_OVR(TS_TypeDef *TSx)
217{
218 SET_BIT(TSx->CR, TS_CR_OVRIE);
219}
220
226__STATIC_INLINE void DDL_TS_DisableIT_OVR(TS_TypeDef *TSx)
227{
228 CLEAR_BIT(TSx->CR, TS_CR_OVRIE);
229}
230
236__STATIC_INLINE uint32_t DDL_TS_IsEnabledIT_OVR(TS_TypeDef *TSx)
237{
238 return ((READ_BIT(TSx->CR, TS_CR_OVRIE) == (TS_CR_OVRIE)) ? 1UL : 0UL);
239}
240
246__STATIC_INLINE uint32_t DDL_TS_ReadData(TS_TypeDef *TSx)
247{
248 return (uint32_t)READ_BIT(TSx->DR, TS_DR_DATA);
249}
250
258__STATIC_INLINE uint32_t DDL_TS_IsActiveFlag_RDY(TS_TypeDef *TSx)
259{
260 return (uint32_t)READ_BIT(TSx->SR, TS_SR_RDY);
261}
262
268__STATIC_INLINE void DDL_TS_ClearFlag_RDY(TS_TypeDef *TSx)
269{
270 WRITE_REG(TSx->SR, TS_SR_RDY);
271}
272
280__STATIC_INLINE uint32_t DDL_TS_IsActiveFlag_OVR(TS_TypeDef *TSx)
281{
282 return (uint32_t)READ_BIT(TSx->SR, TS_SR_OVR);
283}
284
290__STATIC_INLINE void DDL_TS_ClearFlag_OVR(TS_TypeDef *TSx)
291{
292 WRITE_REG(TSx->SR, TS_SR_OVR);
293}
294
298
302
303#endif /* TS */
304
308
309#ifdef __cplusplus
310}
311#endif
312
313#endif /* G32R4xx_DDL_TS_H */
314
__STATIC_INLINE void DDL_TS_DisableIT_OVR(TS_TypeDef *TSx)
Disable Temperature Sensor DataOverflow Interrupt.
__STATIC_INLINE uint32_t DDL_TS_IsEnabledIT_OVR(TS_TypeDef *TSx)
Checks if Temperature Sensor DataOverflow Interrupt is enabled.
__STATIC_INLINE void DDL_TS_Enable(TS_TypeDef *TSx)
Enable Temperature Sensor.
__STATIC_INLINE void DDL_TS_SetDataOverFlowControlMode(TS_TypeDef *TSx, uint32_t mode)
Set Data Overflow Control Bit.
__STATIC_INLINE uint32_t DDL_TS_GetSamplingRate(TS_TypeDef *TSx)
Get Temperature Sensor Sampling Rate.
__STATIC_INLINE uint32_t DDL_TS_ReadData(TS_TypeDef *TSx)
Read TS Data.
__STATIC_INLINE void DDL_TS_EnableIT_OVR(TS_TypeDef *TSx)
Enable Temperature Sensor DataOverflow Interrupt.
__STATIC_INLINE uint32_t DDL_TS_IsActiveFlag_RDY(TS_TypeDef *TSx)
Read the effective flag of the sampling data.
__STATIC_INLINE uint32_t DDL_TS_IsEnabled(TS_TypeDef *TSx)
Checks if Temperature Sensor is enabled.
__STATIC_INLINE void DDL_TS_EnableIT(TS_TypeDef *TSx)
Enable Temperature Sensor Interrupt.
__STATIC_INLINE void DDL_TS_ClearFlag_RDY(TS_TypeDef *TSx)
Clear the effective flag of the sampling data.
__STATIC_INLINE void DDL_TS_ClearFlag_OVR(TS_TypeDef *TSx)
Clear the effective flag of the sampling data.
__STATIC_INLINE uint32_t DDL_TS_IsEnabledIT(TS_TypeDef *TSx)
Checks if Temperature Sensor Interrupt is enabled.
__STATIC_INLINE uint32_t DDL_TS_GetDataOverFlowControlMode(TS_TypeDef *TSx)
Get Data Overflow Control Bit.
__STATIC_INLINE void DDL_TS_DisableIT(TS_TypeDef *TSx)
Disable Temperature Sensor Interrupt.
__STATIC_INLINE void DDL_TS_Disable(TS_TypeDef *TSx)
Disable Temperature Sensor.
__STATIC_INLINE void DDL_TS_SetSamplingRate(TS_TypeDef *TSx, uint32_t SamplingRate)
Set Temperature Sensor Sampling Rate.
__STATIC_INLINE uint32_t DDL_TS_IsActiveFlag_OVR(TS_TypeDef *TSx)
Read the effective flag of the sampling data.