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;
|
2024-08-19 22:43:24 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void set(float v_f) {
|
2024-08-25 16:53:23 +10:00
|
|
|
PORTD = clamp((int)(v_f * -128) + 127, 0, 255);
|
2024-08-19 22:43:24 +10:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|