TheThingsNetwork / arduino-device-lib

Arduino Library for TTN Devices
MIT License
207 stars 96 forks source link

Use enum for `TTN_FP_` instead of typedef #97

Closed FokkeZB closed 7 years ago

FokkeZB commented 7 years ago
#define TTN_FP_EU868 1
#define TTN_FP_US915 2
// ..
typedef unsigned long   fp_ttn_t;
// ..
fp_ttn_t fp;

should become

enum TTN_FP: byte
{
  TTN_FP_EU868
  TTN_FP_US915
}
// ..
TTN_FP fp;

so that the constructor can check for valid args:

TheThingsNetwork(Stream& modemStream, Stream& debugStream, TTN_FP fp, int sf = TTN_DEFAULT_SF, int fsb = TTN_DEFAULT_FSB); 
johanstokking commented 7 years ago

The constructor can take fp_ttn_t already. Also, just name it enum ttn_fp_t to follow naming conventions. Uppercase is reserved for constants.

FokkeZB commented 7 years ago

Closed by #101