diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2016-03-12 19:35:09 +0200 |
---|---|---|
committer | Fred Sundvik <fsundvik@gmail.com> | 2016-03-12 19:35:09 +0200 |
commit | 11bd4ba0dd39654318bd0a3ae495656c2b2187bb (patch) | |
tree | 2f14db1331b35a61877ee481e3a2779cb00ac542 /serial_link/protocol/transport.c | |
parent | 168c5b679f23c25263623f0f8f2b340543cf2140 (diff) |
Remote object callable from many places
Change init_transport to add_remote_objects, so that it can be
called many times from different places.
Diffstat (limited to 'serial_link/protocol/transport.c')
-rw-r--r-- | serial_link/protocol/transport.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/serial_link/protocol/transport.c b/serial_link/protocol/transport.c index 4542a7a050..fbcb040bf1 100644 --- a/serial_link/protocol/transport.c +++ b/serial_link/protocol/transport.c @@ -27,15 +27,15 @@ SOFTWARE. #include "serial_link/protocol/triple_buffered_object.h" #include <string.h> -static remote_object_t** remote_objects; -static uint32_t num_remote_objects; +#define MAX_REMOTE_OBJECTS 16 +static remote_object_t* remote_objects[MAX_REMOTE_OBJECTS]; +static uint32_t num_remote_objects = 0; -void init_transport(remote_object_t** _remote_objects, uint32_t _num_remote_objects) { - remote_objects = _remote_objects; - num_remote_objects = _num_remote_objects; +void add_remote_objects(remote_object_t** _remote_objects, uint32_t _num_remote_objects) { unsigned int i; - for(i=0;i<num_remote_objects;i++) { - remote_object_t* obj = remote_objects[i]; + for(i=0;i<_num_remote_objects;i++) { + remote_object_t* obj = _remote_objects[i]; + remote_objects[num_remote_objects++] = obj; if (obj->object_type == MASTER_TO_ALL_SLAVES) { triple_buffer_object_t* tb = (triple_buffer_object_t*)obj->buffer; triple_buffer_init(tb); |