diff options
author | Sven Gothel <[email protected]> | 2020-10-17 05:43:40 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-17 05:43:40 +0200 |
commit | e3facaa790cbd3b5b36c1cc35962058431d1a454 (patch) | |
tree | 3c2cd565fb1b90049220aa71fcff670901bdce8c /examples | |
parent | ffb44f29e24b4b1e9505a29c16e848bc7f3e46a5 (diff) |
examples/tinyb/esstinyb.cpp: Fix '-Wcast-align=strict'
Diffstat (limited to 'examples')
-rw-r--r-- | examples/tinyb/esstinyb.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/tinyb/esstinyb.cpp b/examples/tinyb/esstinyb.cpp index 1e9fc96c..9aa302cc 100644 --- a/examples/tinyb/esstinyb.cpp +++ b/examples/tinyb/esstinyb.cpp @@ -32,6 +32,7 @@ #include <tinyb.hpp> #include <tinyb/BluetoothException.hpp> +#include <jau/basic_types.hpp> #include <vector> #include <algorithm> #include <iostream> @@ -87,9 +88,10 @@ void data_callback(BluetoothGattCharacteristic &c, std::vector<unsigned char> &d // unsigned char *data_c; unsigned int size = data.size(); if (size == 2) { - int16_t* raw_data = reinterpret_cast<int16_t*>(data.data()); - std::cout << "Raw data = " << std::hex << std::setfill('0') << std::setw(4) << *raw_data << ". "; - uint16_t temp = (*raw_data + 50) / 100; + jau::packed_t<int16_t>* raw_data = reinterpret_cast<jau::packed_t<int16_t>*>( data.data() ); + // int16_t* raw_data = reinterpret_cast<int16_t*>(data.data()); + std::cout << "Raw data = " << std::hex << std::setfill('0') << std::setw(4) << raw_data->store << ". "; + uint16_t temp = (raw_data->store + 50) / 100; std::cout << "Temperature = " << std::dec << temp << "C " << std::endl; } } |