mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
42 lines
952 B
C
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);
|