From 16e2a55bf42f532404cddd8ddbc7cbee38c39572 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 2 Sep 2017 16:35:10 +0000 Subject: Made PAL callback and wait APIs independent from each other. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10543 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/hal_pal.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'os/hal/src/hal_pal.c') diff --git a/os/hal/src/hal_pal.c b/os/hal/src/hal_pal.c index 12b06abd0..9cffc6d69 100644 --- a/os/hal/src/hal_pal.c +++ b/os/hal/src/hal_pal.c @@ -117,6 +117,42 @@ void palSetBusMode(IOBus *bus, iomode_t mode) { palSetGroupMode(bus->portid, bus->mask, bus->offset, mode); } +#if PAL_USE_CALLBACKS || defined(__DOXYGEN__) +/** + * @brief Associates a callback to a port/pad. + * + * @param[in] port port identifier + * @param[in] pad pad number within the port + * @param[in] callback event callback function + * @param[in] arg callback argument + * + * @api + */ +void palSetPadCallbackI(ioportid_t port, iopadid_t pad, + palcallback_t cb, void *arg) { + + palevent_t *pep = pal_lld_get_pad_event(port, pad); + pep->cb = cb; + pep->arg = arg; +} + +/** + * @brief Associates a callback to a line. + * + * @param[in] line line identifier + * @param[in] callback event callback function + * @param[in] arg callback argument + * + * @api + */ +void palSetLineCallbackI(ioline_t line, palcallback_t cb, void *arg) { + + palevent_t *pep = pal_lld_get_line_event(line); + pep->cb = cb; + pep->arg = arg; +} +#endif /* PAL_USE_CALLBACKS */ + #if PAL_USE_WAIT || defined(__DOXYGEN__) /** * @brief Waits for an edge on the specified port/pad. -- cgit v1.2.3