- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm using the CY8C6136 and I have a question about PDL and HAL.
Q1. Can PDL and HAL drivers be used together for one peripheral?
PDL is convenient to initially set up, but for some functions the HAL API is useful.
Q2. I want to use PDL and HAL together for RTC like below.
To use the HAL API, I first used cyhal_rtc_t rtc_obj;.
Is there any problem with using this way?
cyhal_rtc_t rtc_obj;
static int in_rtc_init(void)
{
cy_en_rtc_status_t status;
cy_rslt_t result;
// init
status = Cy_RTC_Init(&RTC_config);
if(status != CY_RTC_SUCCESS)
{
CY_ASSERT(0);
return -1;
}
// time set from flash
if(RTC_TimeStampConfig() == -1)
if(status != CY_RTC_SUCCESS)
{
CY_ASSERT(0);
return -1;
}
// callback function registration
cyhal_rtc_register_callback(&rtc_obj, rtc_event_callback, NULL); // void *callback_arg);
// wake-up every 1sec.
result = cyhal_rtc_set_alarm_by_seconds(&rtc_obj, 1);
rtcAlarmVal = 1; // per 1sec
if (CY_RSLT_SUCCESS != result)
{
CY_ASSERT(0);
return -1;
}
return 0;
}
Q3. Can other components (e.g. PWM, ADC, etc.) use PDL and HAL together in this way?
Best Regards,
YS
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes PDL and HAL can be used together. But in order to avoid inconsistency, I would recommend you to use either PDL or HAL for a particular driver or component.
As you can see in the image below:
HAL (Hardware Abstraction Layer) lies on top of PDL (Peripheral driver library). HAL APIs in turn call APIs from PDL. Application code uses the HAL, which interacts with the PDL through structures created by
the HAL.
Best Regards
Ekta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
YS,
Q1. Can PDL and HAL drivers be used together for one peripheral?
PDL is convenient to initially set up, but for some functions the HAL API is useful.
In theory: Yes.
The base SW for HW control of devices is at the HAL level. The PDL level is one level higher. With few exceptions, the PDL level makes lower level HAL calls.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes PDL and HAL can be used together. But in order to avoid inconsistency, I would recommend you to use either PDL or HAL for a particular driver or component.
As you can see in the image below:
HAL (Hardware Abstraction Layer) lies on top of PDL (Peripheral driver library). HAL APIs in turn call APIs from PDL. Application code uses the HAL, which interacts with the PDL through structures created by
the HAL.
Best Regards
Ekta