tone-generator/dac.hpp

22 lines
213 B
C++
Raw Permalink Normal View History

2024-08-19 22:43:24 +10:00
#pragma once
#include "util.hpp"
namespace dac {
inline void init() {
2024-08-25 16:53:23 +10:00
DDRD = 0xff;
PORTD = 127;
}
inline void reset() {
PORTD = 127;
2024-08-19 22:43:24 +10:00
}
inline void set(int v) {
PORTD = clamp(v, 0, 255);
2024-08-19 22:43:24 +10:00
}
};