nRF51822的Drive configuration的解释
SDK中相关配置
- #define GPIO_PIN_CNF_DRIVE_S0S1 (0x00UL) /!< Standard ‘0’, Standard ‘1’. /
- #define GPIO_PIN_CNF_DRIVE_H0S1 (0x01UL) /!< High ‘0’, Standard ‘1’. /
- #define GPIO_PIN_CNF_DRIVE_S0H1 (0x02UL) /!< Standard ‘0’, High ‘1’. /
- #define GPIO_PIN_CNF_DRIVE_H0H1 (0x03UL) /!< High ‘0’, High ‘1’. /
- #define GPIO_PIN_CNF_DRIVE_D0S1 (0x04UL) /!< Disconnected ‘0’, Standard ‘1’. /
- #define GPIO_PIN_CNF_DRIVE_D0H1 (0x05UL) /!< Disconnected ‘0’, High ‘1’. /
- #define GPIO_PIN_CNF_DRIVE_S0D1 (0x06UL) /!< Standard ‘0’, Disconnected ‘1’. /
- #define GPIO_PIN_CNF_DRIVE_H0D1 (0x07UL) /!< High ‘0’, Disconnected ‘1’. /
配置解释
The different options specify how a configured GPIO pin sinks current when you set it low (write 0 to the pin) and how a configured pin sources current when you set it high (write 1 to the pin).
- Standard means the pin will be sourced or sinked with up to 0.5 mA for the assigned signal (high or low)
- High source means the pin will be sourced with up to 5.0 mA for high signal
- High sink means the pin will be sinked with up to 15.0 mA for low signal
- Disconnected means there is no drive, the pin is high impedance. Consequently, there is no current flowing to or from the pin, no matter the drive of any external circuit connected to the pin
举例
- Option GPIO_PIN_CNF_DRIVE_S0S1: When writing 0 to the configured pin, the pin is driven to low signal with up to 0.5mA. When writing 1 to the configured pin, the pin is driven to high signal with up to 0.5mA.
- Option GPIO_PIN_CNF_DRIVE_H0D1: When writing 0 to the configured pin, the pin is driven to low signal with up to 15.0mA drive strength. When writing 1 to the configured pin, the pin is disconnected (no drive) and will be floating if it is not driven by an external pullup/pulldown resistor or IC.
Note: nRF51 can source+sink GPIO pins with maximum 15mA totally. This means that you should not let combined sink and source current of all GPIOs exceed 15mA at any time.