adafruit / Adafruit_IO_Arduino

Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.
Other
209 stars 108 forks source link

WIFININA and AirLift standar pins #90

Closed sabas1080 closed 5 years ago

sabas1080 commented 5 years ago

Why not maintain the NINA pin name standard?

I've been handling the examples with MKR1010 and Arduino WIFi Rev and I had to make changes

SPIWIFI_ACK -> NINA_ACK ESP32_RESETN -> NINA_RESETN ESP32_GPIO0 -> NINA_GPIO0

Work for me

// uncomment the following line if you are using airlift
 #define USE_AIRLIFT

// uncomment the following line if you are using winc1500
// #define USE_WINC1500

// comment out the following lines if you are using fona or ethernet
#include "AdafruitIO_WiFi.h"

#if defined(USE_AIRLIFT) || defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)|| defined(ARDUINO_SAMD_MKR1010)
  // Configure the pins used for the ESP32 connection
  #if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
    // Don't change the names of these #define's! they match the variant ones
    #define SPIWIFI SPI
    #define SPIWIFI_SS 10  // Chip select pin
    #define NINA_ACK 9  // a.k.a BUSY or READY pin
    #define NINA_RESETN 6 // Reset pin
    #define NINA_GPIO0 -1 // Not connected
  #endif
  AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS, SPIWIFI_SS, NINA_ACK, NINA_RESETN, NINA_GPIO0, &SPIWIFI);
#else
  AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
#endif

Thanks!

brentru commented 5 years ago

@sabas1080 This library was tested with Adafruit's airlift hardware using our fork of nina-fw (https://github.com/adafruit/nina-fw).

We could add a #define for the NINA pin standard. Which nina-fw are you running on the ESP32? The _airlift.h file implements setPins() which is part of the adafruit nina-fw fork and may need to be excluded for MKR/WiFi rev.

ladyada commented 5 years ago

im cool with using NINA naming. the reason we didnt is because NINA is the trademark name of the module from uBlox and we're using a generic ESP32! i dont want people to get confused

brentru commented 5 years ago

@sabas1080 @ladyada I'll add this to AIOA tomorrow. I'll need to add a #define for NINA_ACK into the variant for the AirLift Metro M4 along with a few other boards first. (https://github.com/adafruit/ArduinoCore-samd/blob/master/variants/metro_m4_airlift/variant.h#L131).

brentru commented 5 years ago

Merged into master and released.

sabas1080 commented 5 years ago

Thanks