Added 2 event callbacks to handle send and receive events outside the

library
(now it is possible to trigger a led from an application if m-bus data
is received)
This commit is contained in:
Stefan Wahren
2012-05-13 23:57:24 +02:00
parent d617accea5
commit 8f48d75fb0
4 changed files with 81 additions and 4 deletions

View File

@ -25,6 +25,30 @@ static char error_str[512];
//------------------------------------------------------------------------------
static mbus_slave_data slave_data[MBUS_MAX_PRIMARY_SLAVES];
//
// init event callback
//
void (*_mbus_recv_event)(u_char src_type) = NULL;
void (*_mbus_send_event)(u_char src_type) = NULL;
//------------------------------------------------------------------------------
/// Register a function for receive events.
//------------------------------------------------------------------------------
void
mbus_register_recv_event(void (*event)(u_char src_type))
{
_mbus_recv_event = event;
}
//------------------------------------------------------------------------------
/// Register a function for send events.
//------------------------------------------------------------------------------
void
mbus_register_send_event(void (*event)(u_char src_type))
{
_mbus_send_event = event;
}
//------------------------------------------------------------------------------
/// Return a string that contains an the latest error message.
//------------------------------------------------------------------------------