Nicer registers.h

This commit is contained in:
Romain Goyet
2015-05-03 01:15:57 +02:00
parent f4ac66bf0b
commit 4088ff554f
3 changed files with 20 additions and 17 deletions

View File

@@ -1 +1,2 @@
void * RCC_AHB1ENR = (void *)0x40023830;
#define RCC_BASE 0x40023800
void * RCC_AHB1ENR = (void *)(RCC_BASE + 0x30);

View File

@@ -10,5 +10,21 @@ extern struct {
unsigned int GPIOIEN:1;
unsigned int GPIOJEN:1;
unsigned int GPIOKEN:1;
unsigned int fill:21;
unsigned int :1;
unsigned int CRCEN:1;
unsigned int :5;
unsigned int BKPSRAMEN:1;
unsigned int :1;
unsigned int CCMDATARAMEN:1;
unsigned int DMA1EN:1;
unsigned int DMA2EN:1;
unsigned int DMA2DEN:1;
unsigned int :1;
unsigned int ETHMACEN:1;
unsigned int ETHMACTXEN:1;
unsigned int ETHMACRXEN:1;
unsigned int ETHMACPTPEN:1;
unsigned int OTGHSEN:1;
unsigned int OTGHSULPIEN:1;
unsigned int :1;
} * RCC_AHB1ENR;

View File

@@ -3,12 +3,6 @@
void sleep(long delay);
int main(int argc, char * argv[]) {
RCC_AHB1ENR->GPIOGEN = 1;
//RCC_AHB1ENR_t * RCC_AHB1ENR = (RCC_AHB1ENR_t *)0x40023830;
//RCC_AHB1ENR->GPIOGEN = 1;
// We want to blink LEDs connected to GPIO pin G13 and G14
// (this is documented in our board's PDF)
@@ -21,15 +15,7 @@ int main(int argc, char * argv[]) {
//
// Step 1 : Enable clock in RCC_AHBxENR
// (RCC stands for "Reset and Clock Control)
// Per doc (STM32F4 reference manual, page 266), we want to enable
// the 6th bit of RCC_AHB1ENR, which is at offset 0x30
// The RCC register boundary address is 0x4002 3800 - 0x4002 3BFF
// (per STM32F429xx datasheet)
// In other words, we want to enable bit 6 of (0x40023830)
//long * RCCAHB1ENR = (long *)0x40023830;
//*RCCAHB1ENR |= (1 << 6); // Set 6th bit of RCCAHB1ENR
RCC_AHB1ENR->GPIOGEN = 1;
// Step 2 : Configure the GPIO pin
// Set the mode to general purpose output