27 lines
384 B
C++
27 lines
384 B
C++
#include <cstdint>
|
|
|
|
struct Gpio {
|
|
volatile uint32_t data;
|
|
};
|
|
|
|
#define gpio0 ((Gpio*)0x40000000)
|
|
|
|
void sleep(int ms) {
|
|
for (int m = 0; m < ms; m++) {
|
|
for (int i = 0; i < 10000; i++) {
|
|
asm volatile ( "" );
|
|
}
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
int out = 0;
|
|
|
|
while (1) {
|
|
gpio0->data = out;
|
|
out = (out + 1) % 256;
|
|
|
|
sleep(10);
|
|
}
|
|
}
|