void unusedPinsConfiguration(void)
{
	GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P1, allPins);
	GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P2, allPins);
	GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P3, allPins);
	GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P4, allPins);
	GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_PJ, allPins);
	PMM_unlockLPM5();
}
Example #2
0
void initPorts(void)
{
#ifdef __MSP430_HAS_PORT1_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P1, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORT2_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P2, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORT3_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P3, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORT4_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P4, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORT5_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P5, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORT6_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P6, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORT7_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P7, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORT8_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P8, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORT9_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P9, GPIO_ALL);
#endif

#ifdef __MSP430_HAS_PORTJ_R__
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_PJ, GPIO_ALL);
#endif

#ifdef __MSP430FR4133
    // Unlock pins (required for FRAM devices)
    PMM_unlockLPM5();
#endif

#ifdef __MSP430FR5969
    // Unlock pins (required for FRAM devices)
    PMM_unlockLPM5();
#endif
}
/*
 *  ======== MSP_EXP430F5529LP_initWiFi ========
 */
void MSP_EXP430F5529LP_initWiFi(void)
{
    /* Configure EN & CS pins to disable CC3100 */
    GPIO_setAsOutputPin(GPIO_PORT_P2, GPIO_PIN2);
    GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN6);
    GPIO_setOutputHighOnPin(GPIO_PORT_P2, GPIO_PIN2);
    GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN6);

    /* Configure SPI */
    /* SPI CLK */
    GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P3, GPIO_PIN2);
    /* MOSI/SIMO */
    GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P3, GPIO_PIN0);
    /* MISO/SOMI */
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3, GPIO_PIN1);

    /* Configure IRQ pin */
    GPIO_setAsInputPinWithPullDownResistor(GPIO_PORT_P2, GPIO_PIN0);
    GPIO_selectInterruptEdge(GPIO_PORT_P2, GPIO_PIN0,
                             GPIO_LOW_TO_HIGH_TRANSITION);

    /* Initialize SPI and WiFi drivers */
    SPI_init();
    WiFi_init();
}
Example #4
0
/*
 * Read GPIO value
 */
unsigned short int readGpio() {
	unsigned short int value = 0;
	GPIO_setAsInputPinWithPullDownResistor(RULE_PORT, RULE_READ_PIN);
	value = GPIO_getInputPinValue(RULE_PORT, RULE_READ_PIN);

	/*
	 P1DIR |= 0x00;
	 P1REN |= 0x80;
	 P1OUT &= 0x00; -- pull down
	 value = P1HN & 0x80;
	 */
	return value;
}
__LINK_C error_t hw_gpio_configure_pin(pin_id_t pin_id, cc430_gpio_mode_t mode)
{
    // TODO check if already configured (return EALREADY)

    if(mode == GPIO_MODE_OUTPUT || mode == GPIO_MODE_OUTPUT_FULL_DRIVE_STRENGTH)
    {
        GPIO_setAsOutputPin(pin_id.port, pin_id.pin);
        if(mode == GPIO_MODE_OUTPUT_FULL_DRIVE_STRENGTH)
            GPIO_setDriveStrength(pin_id.port, pin_id.pin, GPIO_FULL_OUTPUT_DRIVE_STRENGTH);
    }
    else if(mode ==GPIO_MODE_INPUT)
        GPIO_setAsInputPin(pin_id.port, pin_id.pin);
    else if(mode == GPIO_MODE_INPUT_PULL_UP)
        GPIO_setAsInputPinWithPullUpResistor(pin_id.port, pin_id.pin);
    else if(mode == GPIO_MODE_INPUT_PULL_DOWN)
        GPIO_setAsInputPinWithPullDownResistor(pin_id.port, pin_id.pin);

    return SUCCESS;
}