synth/mbv/apps/helloworld/helloworld.cc
2025-06-25 08:38:46 -07:00

31 lines
421 B
C++

#include <cstdint>
#include "gpio.h"
#include "pol0.h"
namespace {
Gpio* gpio0;
void sleep(int ms) {
for (int m = 0; m < ms; m++) {
for (int i = 0; i < 10000; i++) {
asm volatile("");
}
}
}
} // namespace
int main() {
gpio0 = Gpio::Instance(GPIO0_BASE);
int out = 0;
while (1) {
gpio0->data = out;
out = (out + 1) % 256;
sleep(10);
}
}