Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ExioMcp23s17.h
00001 /* 00002 * ExioMcp23s17.h 00003 * Rapper Class for MCP23S17 00004 * 00005 * Use MCP23S17 Library: 00006 * https://developer.mbed.org/users/stjo2809/code/MCP23S17/ 00007 * 00008 * 割込み処理は未実装 00009 * 00010 * Created: 2016.10.30 00011 * 00012 */ 00013 00014 #ifndef _EXIOMCP23S17_H_ 00015 #define _EXIOMCP23S17_H_ 00016 00017 #include "mbed.h" 00018 #include "MCP23S17.h" 00019 00020 typedef enum { ExioPortA, ExioPortB } ExioPort; 00021 00022 class ExioMcp23s17 : public MCP23S17 { 00023 public: 00024 ExioMcp23s17(int hardwareaddress, SPI& spi, PinName nCs, PinName nReset) : 00025 MCP23S17(hardwareaddress, spi, nCs, nReset) {} 00026 00027 ExioMcp23s17(int hardwareaddress, SPI& spi, PinName nCs) : 00028 MCP23S17(hardwareaddress, spi, nCs) {} 00029 00030 uint8_t ioDirection(ExioPort port) { return read(IODIRA_ADDR | port); } 00031 void ioDirection(ExioPort port, uint8_t data) { write(IODIRA_ADDR | port, data); } 00032 00033 uint8_t ioPolarity(ExioPort port) { return read(IPOLA_ADDR | port); } 00034 void ioPolarity(ExioPort port, uint8_t data) { write(IPOLA_ADDR | port, data); } 00035 00036 uint8_t ioPullup(ExioPort port) { return read(GPPUA_ADDR | port); } 00037 void ioPullup(ExioPort port, uint8_t data) { write(GPPUA_ADDR | port, data); } 00038 00039 uint8_t readPort(ExioPort port) { return read(GPIOA_ADDR | port); } 00040 void writePort(ExioPort port, uint8_t data) { write(GPIOA_ADDR | port, data); } 00041 00042 protected: 00043 void write(uint8_t reg_address, uint8_t data) { MCP23S17::write(reg_address, data); } 00044 uint8_t read(uint8_t reg_address) { return MCP23S17::read(reg_address); } 00045 }; 00046 00047 #endif //_EXIOMCP23S17_H_
Generated on Thu Jul 14 2022 16:20:00 by
1.7.2