Skip to content

Commit

Permalink
chrono namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotak committed Jun 24, 2020
1 parent 839f115 commit 8de7fcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions UbxGpsI2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ bool UbxGpsI2C::poll(bool await) {

if (_bytes_available == 0 || _bytes_available == USHRT_MAX) {
tr_debug("Data not yet ready, will wait");
ThisThread::sleep_for(chrono::milliseconds{MBED_CONF_UBXGPSI2C_REPEAT_DELAY});
ThisThread::sleep_for(milliseconds{MBED_CONF_UBXGPSI2C_REPEAT_DELAY});

} else {
return get_data();
Expand Down Expand Up @@ -540,9 +540,9 @@ bool UbxGpsI2C::auto_send(UbxClassId class_id, char id, uint8_t rate) {
return false;
}

bool UbxGpsI2C::set_output_rate(chrono::milliseconds ms, uint16_t cycles) {
bool UbxGpsI2C::set_output_rate(milliseconds ms, uint16_t cycles) {
cfg_rate_t cfg_rate;
tr_info("Setting output rate: %llims", chrono::duration_cast<chrono::milliseconds>(ms).count() * cycles);
tr_info("Setting output rate: %llims", duration_cast<milliseconds>(ms).count() * cycles);

bool ok = send(UBX_CFG, UBX_CFG_RATE);

Expand All @@ -559,7 +559,7 @@ bool UbxGpsI2C::set_output_rate(chrono::milliseconds ms, uint16_t cycles) {

memcpy(&cfg_rate, data, sizeof(cfg_rate_t));

cfg_rate.measRate = chrono::duration_cast<chrono::milliseconds>(ms).count();
cfg_rate.measRate = duration_cast<milliseconds>(ms).count();
cfg_rate.navRate = cycles;
cfg_rate.timeRef = 0; // UTC

Expand Down
4 changes: 3 additions & 1 deletion UbxGpsI2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ SOFTWARE.
#error "This library only supports I2C in async mode";
#endif

#include <chrono>
#include "mbed.h"
using namespace std::chrono;

#include "mbed-trace/mbed_trace.h"
#ifndef TRACE_GROUP
Expand Down Expand Up @@ -135,7 +137,7 @@ class UbxGpsI2C {

bool init(I2C * i2c_obj = nullptr);
bool auto_send(UbxClassId class_id, char id, uint8_t rate = 1);
bool set_output_rate(chrono::milliseconds ms, uint16_t cycles = 1);
bool set_output_rate(milliseconds ms, uint16_t cycles = 1);
bool set_odometer(bool enable, UbxOdoProfile profile, uint8_t velocity_filter = 0);
bool reset_odometer();

Expand Down

0 comments on commit 8de7fcb

Please sign in to comment.