Skyward boardcore
Loading...
Searching...
No Matches
ADS131M04Data.h
Go to the documentation of this file.
1
/* Copyright (c) 2021 Skyward Experimental Rocketry
2
* Author: Alberto Nidasio
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a copy
5
* of this software and associated documentation files (the "Software"), to deal
6
* in the Software without restriction, including without limitation the rights
7
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
* copies of the Software, and to permit persons to whom the Software is
9
* furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
13
*
14
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
* THE SOFTWARE.
21
*/
22
23
#pragma once
24
25
#include <
logger/Logger.h
>
26
#include <
sensors/SensorData.h
>
27
#include <stdint.h>
28
29
#include <ostream>
30
#include <reflect.hpp>
31
32
#include "
ADS131M04Defs.h
"
33
34
namespace
Boardcore
35
{
36
37
struct
ADS131M04Data
38
{
39
uint64_t
timestamp
;
40
float
voltage
[4];
41
42
ADS131M04Data
() :
ADS131M04Data
{0, 0, 0, 0, 0} {}
43
44
ADS131M04Data
(uint64_t
timestamp
,
float
voltageCh1,
float
voltageCh2,
45
float
voltageCh3,
float
voltageCh4)
46
:
timestamp
(
timestamp
)
47
{
48
voltage
[0] = voltageCh1;
49
voltage
[1] = voltageCh2;
50
voltage
[2] = voltageCh3;
51
voltage
[3] = voltageCh4;
52
}
53
54
const
ADCData
getVoltage
(
ADS131M04Defs::Channel
channel)
55
{
56
return
{
timestamp
,
static_cast<
uint8_t
>
(channel),
57
voltage
[
static_cast<
uint8_t
>
(channel)]};
58
}
59
60
static
constexpr
auto
reflect
()
61
{
62
return
STRUCT_DEF(
ADS131M04Data
,
63
FIELD_DEF(
timestamp
) FIELD_DEF(
voltage
));
64
}
65
};
66
67
}
// namespace Boardcore
ADS131M04Defs.h
Logger.h
SensorData.h
Boardcore::ADS131M04Defs::Channel
Channel
Definition
ADS131M04Defs.h:84
Boardcore
Driver for the VN100S IMU.
Definition
ActiveObject.h:31
Boardcore::ADCData
Structure to handle ADC data.
Definition
SensorData.h:337
Boardcore::ADS131M04Data
Definition
ADS131M04Data.h:38
Boardcore::ADS131M04Data::reflect
static constexpr auto reflect()
Definition
ADS131M04Data.h:60
Boardcore::ADS131M04Data::timestamp
uint64_t timestamp
Definition
ADS131M04Data.h:39
Boardcore::ADS131M04Data::voltage
float voltage[4]
Definition
ADS131M04Data.h:40
Boardcore::ADS131M04Data::ADS131M04Data
ADS131M04Data(uint64_t timestamp, float voltageCh1, float voltageCh2, float voltageCh3, float voltageCh4)
Definition
ADS131M04Data.h:44
Boardcore::ADS131M04Data::ADS131M04Data
ADS131M04Data()
Definition
ADS131M04Data.h:42
Boardcore::ADS131M04Data::getVoltage
const ADCData getVoltage(ADS131M04Defs::Channel channel)
Definition
ADS131M04Data.h:54
src
shared
sensors
ADS131M04
ADS131M04Data.h
Generated by
1.9.8