mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2026-09-21 20:39:35 +00:00
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
struct GPIO_TypeDef
|
|
{
|
|
uint32_t BSRR = 0U;
|
|
uint32_t IDR = 0U;
|
|
};
|
|
|
|
using IRQn_Type = int;
|
|
enum TimerFormat_t : uint8_t { TICK_FORMAT = 0, MICROSEC_FORMAT, HERTZ_FORMAT };
|
|
|
|
constexpr uint8_t LOW = 0U;
|
|
constexpr uint8_t HIGH = 1U;
|
|
constexpr uint8_t INPUT = 0U;
|
|
constexpr uint8_t OUTPUT = 1U;
|
|
|
|
class HardwareTimer
|
|
{
|
|
public:
|
|
void pause() {}
|
|
void resume() {}
|
|
void setOverflow(uint32_t value, TimerFormat_t = TICK_FORMAT) { overflow_ = value; }
|
|
uint32_t getOverflow(TimerFormat_t = TICK_FORMAT) { return overflow_; }
|
|
uint32_t getPrescaleFactor() { return 1U; }
|
|
uint32_t getTimerClkFreq() { return 12000000U; }
|
|
void attachInterrupt(uint8_t, void (*)()) {}
|
|
|
|
private:
|
|
uint32_t overflow_ = 1U;
|
|
};
|
|
|
|
inline GPIO_TypeDef *digitalPinToPort(uint8_t) { return nullptr; }
|
|
inline uint16_t digitalPinToBitMask(uint8_t) { return 0U; }
|
|
inline void pinMode(uint8_t, uint8_t) {}
|
|
inline void digitalWrite(uint8_t, uint8_t) {}
|
|
inline void NVIC_SetPriority(IRQn_Type, uint8_t) {}
|
|
inline void noInterrupts() {}
|
|
inline void interrupts() {}
|
|
|
|
struct ArduinoSerialStub
|
|
{
|
|
template <typename T> void print(const T &) {}
|
|
template <typename T> void println(const T &) {}
|
|
void println() {}
|
|
};
|
|
|
|
inline ArduinoSerialStub Serial;
|