Skip to content

Instantly share code, notes, and snippets.

@nscooling
Created January 18, 2019 15:18
Show Gist options
  • Save nscooling/c53aaa6d353d908de5283ee1d5edad5b to your computer and use it in GitHub Desktop.
Save nscooling/c53aaa6d353d908de5283ee1d5edad5b to your computer and use it in GitHub Desktop.
int main(void)
{
*rcc_ahb1enr |= (1 << 3); // enable PortD's clock
// assume powerup conditions, moder is all 0's
// set bit-8 as output
uint32_t moder = portd->MODER;
moder |= (1 << 16);
moder &= ~(1 << 17);
portd->MODER = moder;
while (1) {
portd->ODR |= (1 << 8); // led-on
sleep(500);
portd->ODR &= ~(1 << 8); // led-off
sleep(500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment