mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
Nicer registers.h
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
void * RCC_AHB1ENR = (void *)0x40023830;
|
#define RCC_BASE 0x40023800
|
||||||
|
void * RCC_AHB1ENR = (void *)(RCC_BASE + 0x30);
|
||||||
|
|||||||
@@ -10,5 +10,21 @@ extern struct {
|
|||||||
unsigned int GPIOIEN:1;
|
unsigned int GPIOIEN:1;
|
||||||
unsigned int GPIOJEN:1;
|
unsigned int GPIOJEN:1;
|
||||||
unsigned int GPIOKEN: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;
|
} * RCC_AHB1ENR;
|
||||||
|
|||||||
16
src/blinky.c
16
src/blinky.c
@@ -3,12 +3,6 @@
|
|||||||
void sleep(long delay);
|
void sleep(long delay);
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
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
|
// We want to blink LEDs connected to GPIO pin G13 and G14
|
||||||
// (this is documented in our board's PDF)
|
// (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
|
// Step 1 : Enable clock in RCC_AHBxENR
|
||||||
// (RCC stands for "Reset and Clock Control)
|
RCC_AHB1ENR->GPIOGEN = 1;
|
||||||
// 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
|
|
||||||
|
|
||||||
// Step 2 : Configure the GPIO pin
|
// Step 2 : Configure the GPIO pin
|
||||||
// Set the mode to general purpose output
|
// Set the mode to general purpose output
|
||||||
|
|||||||
Reference in New Issue
Block a user