rework #4

Merged
Steins7 merged 88 commits from rework into dev 2024-04-20 18:20:23 +00:00
2 changed files with 16 additions and 3 deletions
Showing only changes of commit 8dc58b6747 - Show all commits

View File

@ -15,11 +15,11 @@
//--local definitions----------------------------------------------------------- //--local definitions-----------------------------------------------------------
//--local variables-------------------------------------------------------------
static volatile struct GPIO* regs = (struct GPIO*)GPIO_BASE_ADDRESS; static volatile struct GPIO* regs = (struct GPIO*)GPIO_BASE_ADDRESS;
//--local variables-------------------------------------------------------------
//--public functions------------------------------------------------------------ //--public functions------------------------------------------------------------
/** /**
@ -83,6 +83,13 @@ bool gpio_read(enum GpioPort port, enum GpioPin pin_mask)
return (regs->PORTS[port].IDR.word & pin_mask) == pin_mask; return (regs->PORTS[port].IDR.word & pin_mask) == pin_mask;
} }
void gpio_reset_peripheral(void)
{
rcc_disable(RCC_AHB_NONE, RCC_APB1_NONE, RCC_APB2_IOPA | RCC_APB2_IOPB
| RCC_APB2_IOPC | RCC_APB2_IOPD | RCC_APB2_IOPE | RCC_APB2_IOPF
| RCC_APB2_IOPG);
}
//--local functions------------------------------------------------------------- //--local functions-------------------------------------------------------------

View File

@ -114,6 +114,12 @@ void gpio_write(enum GpioPort port, enum GpioPin pin_mask, bool value);
*/ */
bool gpio_read(enum GpioPort port, enum GpioPin pin_mask); bool gpio_read(enum GpioPort port, enum GpioPin pin_mask);
/**
* Resets all gpios and disable all ports. The gpio peripherals are returned to
* their reset configuration and their respective clocks disabled
*/
void gpio_reset_peripheral(void);
#endif //_RCC_H_
#endif //_GPIO_H_