93void gpio_set_mode(uint32_t gpioport, uint8_t mode, uint8_t cnf, uint16_t gpios)
95 uint16_t i, offset = 0;
96 uint32_t crl = 0, crh = 0, tmp32 = 0;
106 for (i = 0; i < 16; i++) {
108 if (!((1 << i) & gpios)) {
113 offset = (i < 8) ? (i * 4) : ((i - 8) * 4);
116 tmp32 = (i < 8) ? crl : crh;
119 tmp32 &= ~(0xf << offset);
120 tmp32 |= (mode << offset) | (cnf << (offset + 2));
123 crl = (i < 8) ? tmp32 : crl;
124 crh = (i >= 8) ? tmp32 : crh;
174 uint32_t reg =
AFIO_MAPR & ~AFIO_MAPR_SWJ_MASK;
void gpio_secondary_remap(uint32_t maps)
Map Alternate Function Port Bits (Secondary Set)
void gpio_primary_remap(uint32_t swjdisable, uint32_t maps)
Map Alternate Function Port Bits (Main Set)
void gpio_set_eventout(uint8_t evoutport, uint8_t evoutpin)
Map the EVENTOUT signal.
void gpio_set_mode(uint32_t gpioport, uint8_t mode, uint8_t cnf, uint16_t gpios)
Set GPIO Pin Mode.