aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gravekamp <me@thomas-gravekamp.nl>2018-05-12 21:08:07 +0200
committerThomas Gravekamp <me@thomas-gravekamp.nl>2018-05-12 21:08:57 +0200
commit3c0087f02833510658bfcc6a0e5ca748adeb7f9f (patch)
tree83d1c628275ef58b0274319e5cfc512cbc96a24f
parenta820800817945d1e548daf268a71125d65dafd11 (diff)
Make all templates consistent with each other.
-rw-r--r--src/STM32F0xx_init.c3
-rw-r--r--src/main.c16
2 files changed, 11 insertions, 8 deletions
diff --git a/src/STM32F0xx_init.c b/src/STM32F0xx_init.c
index 904d9c0..9e3c382 100644
--- a/src/STM32F0xx_init.c
+++ b/src/STM32F0xx_init.c
@@ -5,6 +5,9 @@
* Initialize the HSI clock source and reset the PLL configuration. This
* function is called by the startup_common.s file, just before calling the
* main() function.
+ *
+ * You can adapt this function to fit your needs, however, do not change its
+ * name! It is called in the startup code.
*/
void SystemInit (void) {
// Set HSION bit
diff --git a/src/main.c b/src/main.c
index f0708bd..8a39312 100644
--- a/src/main.c
+++ b/src/main.c
@@ -7,20 +7,20 @@ static void delay (unsigned int time) {
}
int main (void) {
- // Turn on the GPIOA peripheral
- RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
+ // Turn on the GPIOC peripheral
+ RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
- // Put pin in general purpose output mode (B01)
- GPIOA->MODER |= GPIO_MODER_MODER4_0;
+ // Put pin 13 in general purpose output mode
+ GPIOC->MODER |= GPIO_MODER_MODER13_0;
while (1) {
- // Reset the bit for port A4
- GPIOA->BSRR = GPIO_BSRR_BR_4;
+ // Reset the state of pin 13 to output low
+ GPIOC->BSRR = GPIO_BSRR_BR_13;
delay(500);
- // Set the bit for port A4
- GPIOA->BSRR = GPIO_BSRR_BS_4;
+ // Set the state of pin 13 to output high
+ GPIOC->BSRR = GPIO_BSRR_BS_13;
delay(500);
}