Switches

API for reading toggle switches.

Functions

struct metal_switch *metal_switch_get(char *label)

Get a handle for a switch.

Return

A handle to the switch, or NULL if none is found for the requested label

Parameters
  • label: The DeviceTree label for the desired switch

__inline__ struct metal_interrupt *metal_switch_interrupt_controller(struct metal_switch *sw)

Get the interrupt controller for a switch.

Return

The interrupt controller handle

Parameters
  • sw: The handle for the switch

__inline__ int metal_switch_get_interrupt_id(struct metal_switch *sw)

Get the interrupt id for a switch.

Return

The interrupt ID for the switch

Parameters
  • sw: The handle for the switch

struct metal_switch
#include <switch.h>

A handle for a switch.