Könnte jemand erklären, was die Zeile static volatile GPIO_Registers* const gpio[]
in dem Code unten ist?c Verständnis struct Zeiger
und was macht die Syntax (volatile GPIO_Registers*)
in diesem Block?
// GPIO hardware registers
//
typedef struct
{
uint32_t MODE;
uint32_t TYPE;
uint32_t SPEED;
uint32_t PUSH_PULL;
uint32_t IDR;
uint32_t ODR;
uint32_t BSRR;
uint32_t LOCK;
uint32_t ALT_FN1;
uint32_t ALT_FN2;
} GPIO_Registers;
// Ports can be selected using an enumeration
// (Port) to index into this array.
// Port addresses can be calculated using the enum since
// all ports are at the same offset from each other.
//
static volatile GPIO_Registers* const gpio[] =
{
(volatile GPIO_Registers*)(GPIO_BASE_ADDR + (PORT_A << 10)),
(volatile GPIO_Registers*)(GPIO_BASE_ADDR + (PORT_B << 10)),
(volatile GPIO_Registers*)(GPIO_BASE_ADDR + (PORT_C << 10)),
(volatile GPIO_Registers*)(GPIO_BASE_ADDR + (PORT_D << 10)),
(volatile GPIO_Registers*)(GPIO_BASE_ADDR + (PORT_E << 10)),
(volatile GPIO_Registers*)(GPIO_BASE_ADDR + (PORT_F << 10))
};
Was haben Sie selbst herausgefunden? Was ** speziell ** verstehst du nicht in deinem C-Buch? – Olaf