@@ -103,7 +103,7 @@ struct pcf8563_data {
103
103
* the datasheet because they may contain unexpected values. Applying a mask will help us
104
104
* to sanitize the read values
105
105
*/
106
- int pcf8563_set_time (const struct device * dev , const struct rtc_time * timeptr )
106
+ static int pcf8563_set_time (const struct device * dev , const struct rtc_time * timeptr )
107
107
{
108
108
const struct pcf8563_config * config = dev -> config ;
109
109
int ret ;
@@ -146,7 +146,7 @@ int pcf8563_set_time(const struct device *dev, const struct rtc_time *timeptr)
146
146
return 0 ;
147
147
}
148
148
149
- int pcf8563_get_time (const struct device * dev , struct rtc_time * timeptr )
149
+ static int pcf8563_get_time (const struct device * dev , struct rtc_time * timeptr )
150
150
{
151
151
const struct pcf8563_config * config = dev -> config ;
152
152
int ret ;
@@ -198,7 +198,34 @@ int pcf8563_get_time(const struct device *dev, struct rtc_time *timeptr)
198
198
return 0 ;
199
199
}
200
200
201
+ #ifdef PCF8563_INT1_GPIOS_IN_USE
202
+
203
+ /* The logic related to the pin interrupt logic */
204
+ static void callback_work_handler (struct k_work * work )
205
+ {
206
+ /* This function is run as a work so the user can spend here all the necessary time */
207
+ struct pcf8563_data * data = CONTAINER_OF (work , struct pcf8563_data , callback_work );
208
+
209
+ if (data -> alarm_callback == NULL ) {
210
+ LOG_WRN ("No PCF8563 alarm callback function provided" );
211
+ } else {
212
+ data -> alarm_callback (data -> dev , 0 , data -> alarm_user_data );
213
+ }
214
+ }
215
+
216
+ /* The function called when the clock alarm activates the interrupt*/
217
+ static void gpio_callback_function (const struct device * dev , struct gpio_callback * cb ,
218
+ uint32_t pins )
219
+ {
220
+ struct pcf8563_data * data = CONTAINER_OF (cb , struct pcf8563_data , int1_callback );
221
+
222
+ LOG_DBG ("PCF8563 interrupt detected" );
223
+ /* By using a work we are able to run "heavier" code */
224
+ k_work_submit (& (data -> callback_work ));
225
+
226
+ }
201
227
228
+ #endif /* PCF8563_INT1_GPIOS_IN_USE */
202
229
203
230
#ifdef CONFIG_RTC_ALARM
204
231
@@ -366,37 +393,6 @@ static int pcf8563_alarm_is_pending(const struct device *dev, uint16_t id)
366
393
/* No alarms */
367
394
return 0 ;
368
395
}
369
- #endif
370
-
371
- #ifdef PCF8563_INT1_GPIOS_IN_USE
372
- /* The logic related to the pin interrupt logic */
373
-
374
- void callback_work_handler (struct k_work * work )
375
- {
376
- /* This function is run as a work so the user can spend here all the necessary time */
377
- struct pcf8563_data * data = CONTAINER_OF (work , struct pcf8563_data , callback_work );
378
-
379
- if (data -> alarm_callback == NULL ) {
380
- LOG_WRN ("No PCF8563 alarm callback function provided" );
381
- } else {
382
- data -> alarm_callback (data -> dev , 0 , data -> alarm_user_data );
383
- }
384
- }
385
-
386
-
387
- /* The function called when the clock alarm activates the interrupt*/
388
- void gpio_callback_function (const struct device * dev , struct gpio_callback * cb ,
389
- uint32_t pins )
390
- {
391
- struct pcf8563_data * data = CONTAINER_OF (cb , struct pcf8563_data , int1_callback );
392
-
393
- LOG_DBG ("PCF8563 interrupt detected" );
394
- /* By using a work we are able to run "heavier" code */
395
- k_work_submit (& (data -> callback_work ));
396
-
397
- }
398
-
399
- #endif
400
396
401
397
static int pcf8563_alarm_set_callback (const struct device * dev , uint16_t id ,
402
398
rtc_alarm_callback callback , void * user_data )
@@ -408,7 +404,7 @@ static int pcf8563_alarm_set_callback(const struct device *dev, uint16_t id,
408
404
ARG_UNUSED (user_data );
409
405
410
406
return - ENOTSUP ;
411
- #else
407
+ #else /* PCF8563_INT1_GPIOS_IN_USE */
412
408
const struct pcf8563_config * config = dev -> config ;
413
409
struct pcf8563_data * data = dev -> data ;
414
410
int ret ;
@@ -446,9 +442,11 @@ static int pcf8563_alarm_set_callback(const struct device *dev, uint16_t id,
446
442
gpio_add_callback (config -> int1 .port , & data -> int1_callback );
447
443
LOG_DBG ("Alarm set" );
448
444
return 0 ;
449
- #endif
445
+ #endif /* PCF8563_INT1_GPIOS_IN_USE */
450
446
}
451
447
448
+ #endif /* CONFIG_RTC_ALARM */
449
+
452
450
static DEVICE_API (rtc , pcf8563_driver_api ) = {
453
451
.set_time = pcf8563_set_time ,
454
452
.get_time = pcf8563_get_time ,
@@ -462,7 +460,7 @@ static DEVICE_API(rtc, pcf8563_driver_api) = {
462
460
};
463
461
464
462
465
- int pcf8563_init (const struct device * dev )
463
+ static int pcf8563_init (const struct device * dev )
466
464
{
467
465
const struct pcf8563_config * config = dev -> config ;
468
466
int ret ;
0 commit comments