Kaynağa Gözat

ESP8266 fast GPIO functions

main
Bill Greiman 8 yıl önce
ebeveyn
işleme
0dcc57ec55
2 değiştirilmiş dosya ile 39 ekleme ve 0 silme
  1. +9
    -0
      SdFat/src/FatLib/FatFileSystem.h
  2. +30
    -0
      SdFat/src/SdSpiCard/DigitalPin.h

+ 9
- 0
SdFat/src/FatLib/FatFileSystem.h Dosyayı Görüntüle

@@ -84,6 +84,15 @@ class FatFileSystem : public FatVolume {
tmpFile.open(vwd(), path, mode);
return tmpFile;
}
/** open a file
*
* \param[in] path location of file to be opened.
* \param[in] mode open mode flags.
* \return a File object.
*/
File open(const String &path, uint8_t mode = FILE_READ) {
return open(path.c_str(), mode );
}
#endif // ENABLE_ARDUINO_FEATURES
/** Change a volume's working directory to root
*

+ 30
- 0
SdFat/src/SdSpiCard/DigitalPin.h Dosyayı Görüntüle

@@ -225,6 +225,36 @@ void fastDigitalWrite(uint8_t pin, bool value) {
g_APinDescription[pin].pPort->PIO_CODR = g_APinDescription[pin].ulPin;
}
}
#elif defined(ESP8266)
//------------------------------------------------------------------------------
/** Set pin value
* @param[in] pin Arduino pin number
* @param[in] level value to write
*/
static inline __attribute__((always_inline))
void fastDigitalWrite(uint8_t pin, uint8_t val) {
if(pin < 16){
if(val) GPOS = (1 << pin);
else GPOC = (1 << pin);
} else if(pin == 16){
if(val) GP16O |= 1;
else GP16O &= ~1;
}
}
//------------------------------------------------------------------------------
/** read pin value
* @param[in] pin Arduino pin number
* @return value read
*/
static inline __attribute__((always_inline))
bool fastDigitalRead(uint8_t pin) {
if(pin < 16){
return GPIP(pin);
} else if(pin == 16){
return GP16I & 0x01;
}
return 0;
}
#else // CORE_TEENSY
//------------------------------------------------------------------------------
inline void fastDigitalWrite(uint8_t pin, bool value) {

Yükleniyor…
İptal
Kaydet