Created
September 10, 2018 04:57
-
-
Save ntavish/3a8f717bef4f3d125bdc388a28ffdbff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#define GPIO_BASE 0x50000000 | |
#define GPIO_OUTSET (*((uint32_t*) (GPIO_BASE + 0x508))) | |
#define GPIO_OUTCLR (*((uint32_t*) (GPIO_BASE + 0x50C))) | |
#define GPIO_PIN_CNF(pin) (*((uint32_t*) (GPIO_BASE + 0x700 + pin * 4))) | |
unsigned int LED = 17; | |
int main() | |
{ | |
GPIO_PIN_CNF(LED) = 1; | |
while(1) | |
{ | |
GPIO_OUTSET = (1 << LED); | |
for(int c = 0; c < 1000000; c++); | |
GPIO_OUTCLR = (1 << LED); | |
for(int c = 0; c < 1000000; c++); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment