diff options
author | mazahner <mazahner@student.ethz.ch> | 2014-11-10 17:39:04 +0100 |
---|---|---|
committer | mazahner <mazahner@student.ethz.ch> | 2014-11-10 17:39:04 +0100 |
commit | 6ec08335459457c82158d2df06050bd30fb8cc59 (patch) | |
tree | 3d5407b6bc88533eacedb3bebfc9e0c9b23609ea /src/modules/px4iofirmware/dsm.c | |
parent | d15203de91cc07530809060f949374bb8918daea (diff) | |
parent | 4e8e6e653beb21808f532b83c6c6e827103ea379 (diff) | |
download | px4-firmware-6ec08335459457c82158d2df06050bd30fb8cc59.tar.gz px4-firmware-6ec08335459457c82158d2df06050bd30fb8cc59.tar.bz2 px4-firmware-6ec08335459457c82158d2df06050bd30fb8cc59.zip |
Merge branch 'master' of https://github.com/mazahner/Firmware
Diffstat (limited to 'src/modules/px4iofirmware/dsm.c')
-rw-r--r-- | src/modules/px4iofirmware/dsm.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/modules/px4iofirmware/dsm.c b/src/modules/px4iofirmware/dsm.c index d3f365822..6e57c9ec7 100644 --- a/src/modules/px4iofirmware/dsm.c +++ b/src/modules/px4iofirmware/dsm.c @@ -452,10 +452,12 @@ dsm_decode(hrt_abstime frame_time, uint16_t *values, uint16_t *num_values) * * @param[out] values pointer to per channel array of decoded values * @param[out] num_values pointer to number of raw channel values returned, high order bit 0:10 bit data, 1:11 bit data + * @param[out] n_butes number of bytes read + * @param[out] bytes pointer to the buffer of read bytes * @return true=decoded raw channel values updated, false=no update */ bool -dsm_input(uint16_t *values, uint16_t *num_values) +dsm_input(uint16_t *values, uint16_t *num_values, uint8_t *n_bytes, uint8_t **bytes) { ssize_t ret; hrt_abstime now; @@ -478,8 +480,12 @@ dsm_input(uint16_t *values, uint16_t *num_values) ret = read(dsm_fd, &dsm_frame[dsm_partial_frame_count], DSM_FRAME_SIZE - dsm_partial_frame_count); /* if the read failed for any reason, just give up here */ - if (ret < 1) + if (ret < 1) { return false; + } else { + *n_bytes = ret; + *bytes = &dsm_frame[dsm_partial_frame_count]; + } dsm_last_rx_time = now; |