Skip to content

Commit be3e7ba

Browse files
authored
Merge pull request #1030 from pimoroni/patch-pcf85063a-rp2350
pcf85063a: RP2350 Fixes
2 parents 1495805 + b6f657f commit be3e7ba

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

drivers/pcf85063a/pcf85063a.cmake

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
set(DRIVER_NAME pcf85063a)
2-
add_library(${DRIVER_NAME} INTERFACE)
3-
4-
target_sources(${DRIVER_NAME} INTERFACE
5-
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp)
6-
7-
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
8-
9-
# Pull in pico libraries that we need
10-
target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib hardware_i2c hardware_rtc pimoroni_i2c)
1+
set(DRIVER_NAME pcf85063a)
2+
add_library(${DRIVER_NAME} INTERFACE)
3+
4+
target_sources(${DRIVER_NAME} INTERFACE
5+
${CMAKE_CURRENT_LIST_DIR}/${DRIVER_NAME}.cpp)
6+
7+
target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
8+
9+
# Include datetime_t for cross-compatibility with RP2350 (no RTC) boards
10+
# TODO: We should migrate away from using this non-standard type
11+
target_compile_definitions(${DRIVER_NAME} INTERFACE PICO_INCLUDE_RTC_DATETIME=1)
12+
13+
# Pull in pico libraries that we need
14+
target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib pico_util hardware_i2c pimoroni_i2c)

drivers/pcf85063a/pcf85063a.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ namespace pimoroni {
5353
return interrupt;
5454
}
5555

56+
#if PICO_INCLUDE_RTC_DATETIME
57+
5658
datetime_t PCF85063A::get_datetime() {
5759
uint8_t result[7] = {0};
5860

@@ -85,6 +87,8 @@ namespace pimoroni {
8587
i2c->write_bytes(address, Registers::SECONDS, data, 7);
8688
}
8789

90+
#endif
91+
8892
void PCF85063A::set_alarm(int second, int minute, int hour, int day) {
8993
uint8_t alarm[5] = {
9094
uint8_t(second != PARAM_UNUSED ? bcd_encode(second) : 0x80),

drivers/pcf85063a/pcf85063a.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ namespace pimoroni {
108108
int get_scl() const;
109109
int get_int() const;
110110

111+
#if PICO_INCLUDE_RTC_DATETIME
111112
// Set and get the date and time
112113
// Uses datetime_t from pico sdk (hardware/rtc) for compatibility
113114
datetime_t get_datetime();
114115
void set_datetime(datetime_t *t);
116+
#endif
115117

116118
// Alarm manipulation methods
117119
void set_alarm(int second = PARAM_UNUSED, int minute = PARAM_UNUSED,

0 commit comments

Comments
 (0)