SPIKE-RT C API Reference [Japanese]
An RTOS-based software platform for LEGO® Education SPIKE™.
読み取り中…
検索中…
一致する文字列を見つけられません
include
libcpp
spike
Battery.h
1
//
2
// Battery.h
3
//
4
// Copyright (c) 2025 Embedded Technology Software Design Robot Contest
5
//
6
7
#ifndef SPIKE_CPP_API_BATTERY_H_
8
#define SPIKE_CPP_API_BATTERY_H_
9
10
#include <cstdint>
11
12
extern
"C"
{
13
#include <
spike/hub/battery.h
>
14
}
15
16
namespace
spikeapi {
20
class
Battery
21
{
22
public
:
28
Battery
(
void
) =
default
;
29
36
uint16_t
getCurrent
(
void
)
const
{
37
return
hub_battery_get_current
();
38
}
39
46
uint16_t
getVoltage
(
void
)
const
{
47
return
hub_battery_get_voltage
();
48
}
49
54
bool
hasError
() {
return
false
; }
55
56
57
};
// class Battery
58
}
// namespace spikeapi
59
60
#endif
// !SPIKE_CPP_API_BATTERY_H_
battery.h
API for the hub battery.
spikeapi::Battery
Definition
Battery.h:21
spikeapi::Battery::Battery
Battery(void)=default
spikeapi::Battery::getVoltage
uint16_t getVoltage(void) const
Definition
Battery.h:46
spikeapi::Battery::hasError
bool hasError()
Definition
Battery.h:54
spikeapi::Battery::getCurrent
uint16_t getCurrent(void) const
Definition
Battery.h:36
hub_battery_get_voltage
uint16_t hub_battery_get_voltage(void)
バッテリーの電圧を取得する.
Definition
battery.c:15
hub_battery_get_current
uint16_t hub_battery_get_current(void)
バッテリーの電流を取得する.
Definition
battery.c:25
構築:
1.12.0