akkera 102
/
apuplay
SPC music playback tools for real snes apu
Diff: gpio.h
- Revision:
- 2:62e6e22f8be2
- Parent:
- 0:5bd52e196edb
--- a/gpio.h Mon Jan 09 13:58:58 2017 +0000 +++ b/gpio.h Wed Jan 11 16:00:29 2017 +0000 @@ -1,50 +1,20 @@ -/** - * @file gpio.h - * @brief GPIO クラスの宣言およびインターフェイスの定義をします - */ - -#pragma once +#ifndef __gpio_h__ +#define __gpio_h__ -/** - * @brief GPIO クラス - */ -class CGpio -{ -public: - static CGpio* GetInstance(); - - static void Initialize(); - static void PinDir(int pin, bool write); - static void SetPin(int pin, bool high); - static bool GetPin(int pin); - - void WriteByte(unsigned char c); - unsigned char ReadByte(); -private: - /** - * モード - */ - enum ByteDir - { - kUninitialize = -1, /*!< 未初期化 */ - kRead = 0, /*!< リード */ - kWrite = 1 /*!< ライト */ - }; - - static CGpio sm_instance; /*!< 唯一のインスタンスです */ - ByteDir m_dir; /*!< バイト方向 */ +#define GPIO_A7 0 +#define GPIO_A6 1 +#define GPIO_A0 2 +#define GPIO_A1 3 +#define GPIO_WR 4 +#define GPIO_RD 5 +#define GPIO_ICL 14 - CGpio(); - void ByteMode(ByteDir dir); - static unsigned char SwapBits(unsigned char c); -}; +void gpio_init(void); +void gpio_reset(void); +void gpio_write(int address, unsigned char data); +unsigned char gpio_read(int address); -/** - * インスタンスの取得 - * @return インスタンス - */ -inline CGpio* CGpio::GetInstance() -{ - return &sm_instance; -} + +#endif +