src/drivers/ssd_gpio.c
/* ========================================================================== */
/**
 * @details This function implements the following objectives:
 *		-# Initialise the RPi pin connected (in some way) to the RESET pin on
 *				the SSD1803A such that:
 *			- Mode of the pin is an output, and
 *			- Level of the pin is the inactive level of the pin.
 *
 * @param [in]		pin GPIO pin number on the RPi to which the RESET pin on
 * the SSD1803A is connected (in some way).
 * @param [in]		activeLevel GPIO level at which the SSD1803A will be active.
 *
 * @retval STATUS_OK If the GPIO hardware was successfully initialised.
 * @retval STATUS_NOT_INITIALISED If the pigpio library has not been previously
 * initialised with a call to pigpio_init().
 * @retval STATUS_INVALID_GPIO If the specified GPIO to which the RESET pin on
 * the SSD1803A is connected (in some way) is not a valid RPi GPIO pin number.
 * @retval STATUS_INVALID_MODE and STATUS_INVALID_LEVEL are theoretically
 * possible return values from the function gpioSetMode/gpioWrite, however
 * they should never occur due to the restrictions on the data type
 * active_level_t.
 * ========================================================================== */
@details This function implements the following objectives:
-# Initialise the RPi pin connected (in some way) to the RESET pin on
the SSD1803A such that:
- Mode of the pin is an output, and
- Level of the pin is the inactive level of the pin.

@param [in]          pin GPIO pin number on the RPi to which the RESET pin on
the SSD1803A is connected (in some way).
@param [in]          activeLevel GPIO level at which the SSD1803A will be active.

@retval STATUS_OK If the GPIO hardware was successfully initialised.
@retval STATUS_NOT_INITIALISED If the pigpio library has not been previously
initialised with a call to pigpio_init().
@retval STATUS_INVALID_GPIO If the specified GPIO to which the RESET pin on
the SSD1803A is connected (in some way) is not a valid RPi GPIO pin number.
@retval STATUS_INVALID_MODE and STATUS_INVALID_LEVEL are theoretically
possible return values from the function gpioSetMode/gpioWrite, however
they should never occur due to the restrictions on the data type
active_level_t.
@details This function implements the following objectives : - # Initialise the RPi pin connected ( in some way ) to the RESET pin on the SSD1803A such that : - Mode of the pin is an output and - Level of the pin is the inactive level of the pin . @param [ in ] pin GPIO pin number on the RPi to which the RESET pin on the SSD1803A is connected ( in some way ) . @param [ in ] activeLevel GPIO level at which the SSD1803A will be active . @retval STATUS_OK If the GPIO hardware was successfully initialised . @retval STATUS_NOT_INITIALISED If the pigpio library has not been previously initialised with a call to pigpio_init () . @retval STATUS_INVALID_GPIO If the specified GPIO to which the RESET pin on the SSD1803A is connected ( in some way ) is not a valid RPi GPIO pin number . @retval STATUS_INVALID_MODE and STATUS_INVALID_LEVEL are theoretically possible return values from the function gpioSetMode / gpioWrite however they should never occur due to the restrictions on the data type active_level_t .
status_t gpio_init(
	uint8_t pin,
	active_level_t activeLevel) {
	m_HardwareResetEnabled = (pin != NO_HARDWARE_RESET_PIN);
	if (pin == NO_HARDWARE_RESET_PIN) {
		return STATUS_OK;
	}
	if (!pigpio_is_initialised()) {
		LOG_TO_STDERR();
		return STATUS_NOT_INITIALISED;
	}
	status_t ret = gpioSetMode(pin, PI_OUTPUT);
	if (ret != STATUS_OK) {
		LOG_TO_STDERR();
		return ret;
	}
	m_Pin = pin;
	m_ActiveLevel = activeLevel;
	ret = gpioWrite((uint32_t)m_Pin, !m_ActiveLevel);
	if (ret != STATUS_OK) {
		LOG_TO_STDERR();
	}
	return ret;
}
status_t gpio_init ( uint8_t pin , active_level_t activeLevel ) { m_HardwareResetEnabled = ( pin != NO_HARDWARE_RESET_PIN ) ; if ( pin == NO_HARDWARE_RESET_PIN ) { return STATUS_OK ; } if ( ! pigpio_is_initialised ( ) ) { LOG_TO_STDERR ( ) ; return STATUS_NOT_INITIALISED ; } status_t ret = gpioSetMode ( pin , PI_OUTPUT ) ; if ( ret != STATUS_OK ) { LOG_TO_STDERR ( ) ; return ret ; } m_Pin = pin ; m_ActiveLevel = activeLevel ; ret = gpioWrite ( ( uint32_t ) m_Pin , ! m_ActiveLevel ) ; if ( ret != STATUS_OK ) { LOG_TO_STDERR ( ) ; } return ret ; }
@details This function implements the following objectives:
              -# Initialise the RPi pin connected (in some way) to the RESET pin on
                              the SSD1803A such that:
                      - Mode of the pin is an output, and
                      - Level of the pin is the inactive level of the pin.
@details This function implements the following objectives : - # Initialise the RPi pin connected ( in some way ) to the RESET pin on the SSD1803A such that : - Mode of the pin is an output and - Level of the pin is the inactive level of the pin .
/* Check whether hardware reset is utilised */ /* pigpio library is not initialised */ /* Initialise the SSD1803A enable pin on the RPi */ /* Hold the SSD1803A enable pin in the reset position */