-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathmbed.h
37 lines (27 loc) · 778 Bytes
/
mbed.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Minimal mbed mock for testing JLed hardware accessing functions
// Copyright 2020 Jan Delgado [email protected]
//
#ifndef TEST_MBED_H_
#define TEST_MBED_H_
#include <stdint.h>
#include <chrono> // NOLINT
using PinName = uint8_t;
constexpr auto kUninitializedPin = 255;
constexpr auto kUninitialized = -1.;
uint32_t us_ticker_read();
class PwmOut {
PinName pin_ = kUninitializedPin;
public:
explicit PwmOut(PinName pin) : pin_(pin) {}
void write(float val);
};
void mbedMockInit();
void mbedMockSetUsTicks(uint32_t ticks);
float mbedMockGetPinState(uint8_t pin);
namespace Kernel {
struct Clock {
using time_point = std::chrono::time_point<std::chrono::system_clock>;
static time_point now();
};
}; // namespace Kernel
#endif // TEST_MBED_H_