diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-16 12:49:03 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-19 11:36:43 +0200 |
commit | 0224ecc39e8cd17dcaea49a580233997ac2020db (patch) | |
tree | 1e157d92a188fa64cde80d24f32d52e95fe3b421 /CAN-binder/low-can-binding/can | |
parent | 5d96c27e2679e37bd7354d3c618a4fc3111f137c (diff) |
Use common timer method to get BCM timeval values.
Change-Id: I3c4364d6038bd60546726fba940f043f5abcb6d2
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/can')
-rw-r--r-- | CAN-binder/low-can-binding/can/can-signals.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/CAN-binder/low-can-binding/can/can-signals.cpp b/CAN-binder/low-can-binding/can/can-signals.cpp index 6a68214..0b58967 100644 --- a/CAN-binder/low-can-binding/can/can-signals.cpp +++ b/CAN-binder/low-can-binding/can/can-signals.cpp @@ -233,15 +233,13 @@ int can_signal_t::create_rx_filter() memset(&cfd, 0, sizeof(cfd)); memset(&bcm_msg.msg_head, 0, sizeof(bcm_msg.msg_head)); float val = (float)(1 << bit_size_)-1; - float freq = frequency_.frequency_to_period(); - if(freq <= 0) - freq = 0.000001f; + struct timeval freq = frequency_.get_timeval_from_period(); bcm_msg.msg_head.opcode = RX_SETUP; bcm_msg.msg_head.can_id = can_id; bcm_msg.msg_head.flags = SETTIMER|RX_NO_AUTOTIMER; - bcm_msg.msg_head.ival2.tv_sec = long(freq); - bcm_msg.msg_head.ival2.tv_usec = (freq - (long)freq) * 1000000; + bcm_msg.msg_head.ival2.tv_sec = freq.tv_sec ; + bcm_msg.msg_head.ival2.tv_usec = freq.tv_usec; bcm_msg.msg_head.nframes = 1; bitfield_encode_float(val, bit_position_, |