APM:Libraries
Classes | Macros | Typedefs | Enumerations | Functions
GPIO.h File Reference
#include <AP_HAL/AP_HAL.h>
#include "AP_HAL_F4Light_Namespace.h"
#include "handler.h"
#include <boards.h>
#include <exti.h>
Include dependency graph for GPIO.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  F4Light::DigitalSource
 
class  F4Light::GPIO
 

Macros

#define HIGH   0x1
 
#define LOW   0x0
 
#define HAL_GPIO_LED_ON   LOW
 
#define HAL_GPIO_LED_OFF   HIGH
 

Typedefs

typedef enum HALPinMode HAL_PinMode
 
typedef enum ExtIntTriggerMode ExtIntTriggerMode
 

Enumerations

enum  HALPinMode {
  INPUT = GPIO_INPUT_FLOATING, OUTPUT = GPIO_OUTPUT_PP, OUTPUT_ALT = GPIO_AF_OUTPUT_PP, INPUT_ANALOG = GPIO_INPUT_ANALOG,
  INPUT_PULLDOWN = GPIO_INPUT_PD, INPUT_PULLUP = GPIO_INPUT_PU, OUTPUT_OPEN_DRAIN = GPIO_OUTPUT_OD, OUTPUT_OPEN_DRAIN_PU = GPIO_OUTPUT_OD_PU,
  PWM = GPIO_PIN_MODE_LAST, PWM_OPEN_DRAIN
}
 
enum  ExtIntTriggerMode { RISING = (uint8_t)EXTI_RISING, FALLING = (uint8_t)EXTI_FALLING, CHANGE = (uint8_t)EXTI_RISING_FALLING }
 

Functions

static exti_trigger_mode exti_out_mode (ExtIntTriggerMode mode)
 
void digitalWrite (uint8_t pin, uint8_t value)
 
uint8_t digitalRead (uint8_t pin)
 
void digitalToggle (uint8_t pin)
 

Macro Definition Documentation

◆ HAL_GPIO_LED_OFF

#define HAL_GPIO_LED_OFF   HIGH

Definition at line 21 of file GPIO.h.

◆ HAL_GPIO_LED_ON

#define HAL_GPIO_LED_ON   LOW

Definition at line 20 of file GPIO.h.

◆ HIGH

#define HIGH   0x1

Definition at line 11 of file GPIO.h.

Referenced by F4Light::DigitalSource::_read(), and F4Light::GPIO::_read().

◆ LOW

#define LOW   0x0

Definition at line 15 of file GPIO.h.

Referenced by F4Light::DigitalSource::_read(), and F4Light::GPIO::_read().

Typedef Documentation

◆ ExtIntTriggerMode

◆ HAL_PinMode

typedef enum HALPinMode HAL_PinMode

Enumeration Type Documentation

◆ ExtIntTriggerMode

Enumerator
RISING 

To trigger an interrupt when the pin transitions LOW to HIGH

FALLING 

To trigger an interrupt when the pin transitions HIGH to LOW

CHANGE 

To trigger an interrupt when the pin transitions from LOW to HIGH or HIGH to LOW (i.e., when the pin changes).

Definition at line 99 of file GPIO.h.

◆ HALPinMode

enum HALPinMode
Enumerator
INPUT 

Basic digital input. The pin voltage is sampled; when it is closer to 3.3v (Vcc) the pin status is high, and when it is closer to 0v (ground) it is low. If no external circuit is pulling the pin voltage to high or low, it will tend to randomly oscillate and be very sensitive to noise (e.g., a breath of air across the pin might cause the state to flip).

OUTPUT 
OUTPUT_ALT 
INPUT_ANALOG 

This is a special mode for when the pin will be used for analog (not digital) reads. Enables ADC conversion to be performed on the voltage at the pin.

INPUT_PULLDOWN 

The state of the pin in this mode is reported the same way as with INPUT, but the pin voltage is gently "pulled down" towards 0v. This means the state will be low unless an external device is specifically pulling the pin up to 3.3v, in which case the "gentle" pull down will not affect the state of the input.

INPUT_PULLUP 

The state of the pin in this mode is reported the same way as with INPUT, but the pin voltage is gently "pulled up" towards +3.3v. This means the state will be high unless an external device is specifically pulling the pin down to ground, in which case the "gentle" pull up will not affect the state of the input.

OUTPUT_OPEN_DRAIN 

In open drain mode, the pin indicates "low" by accepting current flow to ground and "high" by providing increased impedance. An example use would be to connect a pin to a bus line (which is pulled up to a positive voltage by a separate supply through a large resistor). When the pin is high, not much current flows through to ground and the line stays at positive voltage; when the pin is low, the bus "drains" to ground with a small amount of current constantly flowing through the large resistor from the external supply. In this mode, no current is ever actually sourced from the pin.

OUTPUT_OPEN_DRAIN_PU 

open drain mode with pull-up

PWM 

This is a special mode for when the pin will be used for PWM output (a special case of digital output).

PWM_OPEN_DRAIN 

Like PWM, except that instead of alternating cycles of LOW and HIGH, the voltage on the pin consists of alternating cycles of LOW and floating (disconnected).

Definition at line 26 of file GPIO.h.

Function Documentation

◆ digitalRead()

uint8_t digitalRead ( uint8_t  pin)

Definition at line 181 of file GPIO.cpp.

Referenced by exti_out_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ digitalToggle()

void digitalToggle ( uint8_t  pin)

Definition at line 183 of file GPIO.cpp.

Referenced by exti_out_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ digitalWrite()

void digitalWrite ( uint8_t  pin,
uint8_t  value 
)

Definition at line 180 of file GPIO.cpp.

Referenced by exti_out_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exti_out_mode()

static exti_trigger_mode exti_out_mode ( ExtIntTriggerMode  mode)
inlinestatic

Definition at line 174 of file GPIO.h.

Referenced by F4Light::GPIO::_attach_interrupt().

Here is the call graph for this function:
Here is the caller graph for this function: