I was talking not about MSP432 but MSP430. That code is correct, and similar logic should have been used for MSP432: void GPIO_setAsOutputPin(uint8_t selectedPort, uint16_t selectedPins) { uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; // Shift by 8 if port is even (upper 8-bits) if((selectedPort & 1) ^ 1) { selectedPins <<= 8; } HWREG16(baseAddress + OFS_PASEL) &= ~selectedPins; HWREG16(baseAddress + OFS_PADIR) |= selectedPins; }
↧