libnx/nx/include/switch/services/gpio.h
friedkeenan da4c060278 Add a bunch of GetServiceSession functions (#305)
* Add a bunch of GetServiceSession functions
2019-07-13 15:09:28 -04:00

42 lines
952 B
C

/**
* @file gpio.h
* @brief GPIO service IPC wrapper.
* @author SciresM
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "sm.h"
typedef enum {
GpioPadName_AudioCodec = 1,
GpioPadName_ButtonVolUp = 25,
GpioPadName_ButtonVolDown = 26,
} GpioPadName;
typedef struct {
Service s;
} GpioPadSession;
typedef enum {
GpioDirection_Input = 0,
GpioDirection_Output = 1,
} GpioDirection;
typedef enum {
GpioValue_Low = 0,
GpioValue_High = 1,
} GpioValue;
Result gpioInitialize(void);
void gpioExit(void);
Service* gpioGetServiceSession(void);
Result gpioOpenSession(GpioPadSession *out, GpioPadName name);
Result gpioPadSetDirection(GpioPadSession *p, GpioDirection dir);
Result gpioPadGetDirection(GpioPadSession *p, GpioDirection *out);
Result gpioPadSetValue(GpioPadSession *p, GpioValue val);
Result gpioPadGetValue(GpioPadSession *p, GpioValue *out);
void gpioPadClose(GpioPadSession *p);