summaryrefslogtreecommitdiff
path: root/src/typec
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2025-09-17 22:37:45 +0200
committerHiFiPhile <[email protected]>2025-09-17 22:48:59 +0200
commit369a1ff5153a472327d2847c7bc7386309486b34 (patch)
tree7b8e6403bb1017e14fa224865eb73f4e10a3ba18 /src/typec
parentd9ad09a8dce9e54cbd23062f8dec6c4fd49dc906 (diff)
Update weak callbacks to new syntax
Signed-off-by: HiFiPhile <[email protected]>
Diffstat (limited to 'src/typec')
-rw-r--r--src/typec/usbc.c25
-rw-r--r--src/typec/usbc.h4
2 files changed, 21 insertions, 8 deletions
diff --git a/src/typec/usbc.c b/src/typec/usbc.c
index fdf2a0cd6..20abd1700 100644
--- a/src/typec/usbc.c
+++ b/src/typec/usbc.c
@@ -60,6 +60,23 @@ bool parse_msg_data(uint8_t rhport, pd_header_t const* header, uint8_t const* do
bool parse_msg_control(uint8_t rhport, pd_header_t const* header);
//--------------------------------------------------------------------+
+// Weak stubs: invoked if no strong implementation is available
+//--------------------------------------------------------------------+
+TU_ATTR_WEAK bool tuc_pd_data_received_cb(uint8_t rhport, pd_header_t const* header, uint8_t const* dobj, uint8_t const* p_end) {
+ (void) rhport;
+ (void) header;
+ (void) dobj;
+ (void) p_end;
+ return false;
+}
+
+TU_ATTR_WEAK bool tuc_pd_control_received_cb(uint8_t rhport, pd_header_t const* header) {
+ (void) rhport;
+ (void) header;
+ return false;
+}
+
+//--------------------------------------------------------------------+
//
//--------------------------------------------------------------------+
bool tuc_inited(uint8_t rhport) {
@@ -136,17 +153,13 @@ void tuc_task_ext(uint32_t timeout_ms, bool in_isr) {
}
bool parse_msg_data(uint8_t rhport, pd_header_t const* header, uint8_t const* dobj, uint8_t const* p_end) {
- if (tuc_pd_data_received_cb) {
- tuc_pd_data_received_cb(rhport, header, dobj, p_end);
- }
+ tuc_pd_data_received_cb(rhport, header, dobj, p_end);
return true;
}
bool parse_msg_control(uint8_t rhport, pd_header_t const* header) {
- if (tuc_pd_control_received_cb) {
- tuc_pd_control_received_cb(rhport, header);
- }
+ tuc_pd_control_received_cb(rhport, header);
return true;
}
diff --git a/src/typec/usbc.h b/src/typec/usbc.h
index 9fbff9bc6..448542aab 100644
--- a/src/typec/usbc.h
+++ b/src/typec/usbc.h
@@ -74,8 +74,8 @@ extern void tcd_int_handler(uint8_t rhport);
// Callbacks
//--------------------------------------------------------------------+
-TU_ATTR_WEAK bool tuc_pd_data_received_cb(uint8_t rhport, pd_header_t const* header, uint8_t const* dobj, uint8_t const* p_end);
-TU_ATTR_WEAK bool tuc_pd_control_received_cb(uint8_t rhport, pd_header_t const* header);
+bool tuc_pd_data_received_cb(uint8_t rhport, pd_header_t const* header, uint8_t const* dobj, uint8_t const* p_end);
+bool tuc_pd_control_received_cb(uint8_t rhport, pd_header_t const* header);
//--------------------------------------------------------------------+
//