dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_dio.h File Reference

Go to the source code of this file.

Macros

#define DIO_NULL   ((uintptr_t) 0)
 
#define DIO_BASE   ( (uintptr_t) GPIOA )
 
#define DIO_PORT_OFFSET(port)   (((uintptr_t) (port)) - DIO_BASE)
 
#define DIO_MAKE_TAG(port, pin)   ((uintptr_t) ((DIO_PORT_OFFSET(port) << 16) | ((uint16_t) (pin))))
 
#define GPIOA_DIO(pin_num)   DIO_MAKE_TAG(GPIOA, 1<<(pin_num))
 
#define GPIOB_DIO(pin_num)   DIO_MAKE_TAG(GPIOB, 1<<(pin_num))
 
#define GPIOC_DIO(pin_num)   DIO_MAKE_TAG(GPIOC, 1<<(pin_num))
 
#define GPIOD_DIO(pin_num)   DIO_MAKE_TAG(GPIOD, 1<<(pin_num))
 
#define GPIOE_DIO(pin_num)   DIO_MAKE_TAG(GPIOE, 1<<(pin_num))
 
#define GPIOF_DIO(pin_num)   DIO_MAKE_TAG(GPIOF, 1<<(pin_num))
 
#define GET_DIO_PORT(dio)   ( (GPIO_TypeDef *) (((dio) >> 16) + DIO_BASE) )
 
#define GET_DIO_PIN(dio)   ((dio) & 0xffff)
 
#define _DIO_PRELUDE_RET(s)
 
#define _DIO_PRELUDE
 
#define DIO_SETREGS_FOURWIDE(reglow, reghigh, idx, val)
 
#define DIO_SETREG_TWOWIDE(reg, idx, val)
 
#define DIO_SETREG_ONEWIDE(reg, idx, val)
 

Typedefs

typedef uintptr_t dio_tag_t
 

Enumerations

enum  dio_pin_function { DIO_PIN_INPUT = 0, DIO_PIN_OUTPUT = 1, DIO_PIN_ALTFUNC = 2, DIO_PIN_ANALOG = 3 }
 
enum  dio_pull { DIO_PULL_NONE = 0, DIO_PULL_UP, DIO_PULL_DOWN }
 

Functions

static void dio_set_altfunc_output (dio_tag_t t, int alt_func, bool open_collector, enum dio_drive_strength strength)
 Configures a GPIO as alternate function output. More...
 
static void dio_set_altfunc_input (dio_tag_t t, int alt_func, enum dio_pull pull)
 Configures a GPIO as alternate function input. More...
 
static void dio_set_analog (dio_tag_t t)
 Configures a GPIO as analog. Disables pullups/pulldowns, etc. More...
 
static void dio_set_output (dio_tag_t t, bool open_collector, enum dio_drive_strength strength, bool first_value)
 Configures a GPIO as an output. More...
 
static void dio_toggle (dio_tag_t t)
 Toggles an output GPIO to the opposite level. More...
 
static void dio_high (dio_tag_t t)
 Sets an output GPIO high. More...
 
static void dio_low (dio_tag_t t)
 Sets an output GPIO low. More...
 
static void dio_write (dio_tag_t t, bool high)
 Sets an output GPIO to a chosen logical level. More...
 
static void dio_set_input (dio_tag_t t, enum dio_pull pull)
 Configures a GPIO as an input. More...
 
static bool dio_read (dio_tag_t t)
 Reads a GPIO logical value. More...