STM32 gpio?

So with arduino we can do things with ports such as

void latchAddress(unsigned long address)
{
  DDRC = 0xFF;
  DDRL = 0xFF;
  DDRA = 0xFF;
  PORTC = address &     0xFF;
  PORTL = (address &   0xFF00) >> 8;
  PORTA = (address & 0xFF0000) >> 16;
  digitalWrite(CS, HIGH);  
  delayMicroseconds(10);  
  digitalWrite(CS, LOW);   
    PORTC = 0x0;
 PORTL = 0x0;
 PORTA = 0x0;
  DDRC = 0x0;
 DDRL = 0x0;
 DDRA = 0x0;
}

however I am using a maple mini thus I do not have these ports forcing me to use for loops and digitalread/write/pinmode slowing my code down significantly

void LatchAddress(uint32_t address)
{
	//set address/data ports to output
	for (auto pin : GbaPins)
		pinMode(pin, OUTPUT);

	//divide address by 2 to get word addressing
	address >>= 1;
	
	//output address to address pins
	for (uint8_t i = 0; i < 24; ++i, address >>= 1)
		digitalWrite(GbaPins[i], address & 1);
	
	digitalWrite(CS_PIN, HIGH);
	delayMicroseconds(10);
	digitalWrite(CS_PIN, LOW);
	
	//set address/data ports to input
	for (auto pin : GbaPins)
		pinMode(pin, INPUT);
}

is there some way I can use the macro like

#define digitalPinToPort(P)        ( PIN_MAP[P].gpio_device )
#define digitalPinToBitMask(P)     ( BIT(PIN_MAP[P].gpio_bit) )
#define portOutputRegister(port)   ( &(port->regs->ODR) )
#define portInputRegister(port)    ( &(port->regs->IDR) )

these to somehow register my maple mini pins to a port so i can get rid of these forloops?

Refer to the ST documentation here (PDF).

GPIOx_IDR
GPIOx_ODR
GPIOx_BSRR
GPIOx_BRR

I mean I'm trying to figure out what everything is mapped to on the maple mini and can't seem to find any examples and I'm having a hard time understanding the documentation it's not as new user friendly as the arduino doc that simply state like "portx" = these 8 pins and you can set them to high with the folling example lol, if anyone could explain it to me or provide an example/link to a tutorial on this would be appreciated.


I don't really understand this

There are really no examples here?
https://www.google.com/search?client=firefox-b-d&q=stm32+port+manipulation

here is your variant:
https://github.com/stm32duino/Arduino_Core_STM32/tree/master/variants/MAPLEMINI_F103CB

By the way, although it may seem overly complex, the official core is built mostly on the STM32 HAL which is the reason why it was possible to add support for so many STM32 processors, in such a short time. The processors themselves, have much more complicated GPIO than the AVR 328 and so as far as simplifying direct access for beginners, is not really possible because the core actually calls HAL to do that stuff. Thus if you want to learn how it's done you need to dig into how the HAL or LL GPIO drivers work.

For your application example, the easiest way would probably be to use the same HAL and LL (low layer) library functions that the core does, to access whole registers. Regardless, you should read this file:

The HAL and LL full documentation can be downloaded from ST.

omg thank you so much it makes sense now

// Pin number
const PinName digitalPin[] = {
  // Right side
  PB_11, //D0
  PB_10, //D1
  PB_2,  //D2
  PB_0,  //D3
  PA_7,  //D4
  PA_6,  //D5
  PA_5,  //D6

so it is like DO on maple mini = PortB bit 11 things like GPIOB->regs->ODR = 0xFFFF; work now ty!