49#define SFE_IRIDIUM_ARDUINO 1
55 typedef String sfe_string_t;
57 static inline unsigned long sfe_millis(
void) {
return millis(); }
58 static inline unsigned long sfe_micros(
void) {
return micros(); }
59 static inline void sfe_delay(
unsigned long ms) { delay(ms); }
60 static inline void sfe_yield(
void) { yield(); }
61 static inline void sfe_pin_output(
int pin) { pinMode(pin, OUTPUT); }
62 static inline void sfe_pin_input(
int pin) { pinMode(pin, INPUT); }
63 static inline void sfe_pin_write(
int pin,
bool high) { digitalWrite(pin, high ? HIGH : LOW); }
64 static inline void sfe_string_from_double(sfe_string_t &str,
double value,
int decimalPlaces)
66 str = String(value, decimalPlaces);
70#elif defined(ESP_PLATFORM)
76#define SFE_IRIDIUM_ESP_IDF 1
86#include "freertos/FreeRTOS.h"
87#include "freertos/task.h"
89#include "esp_rom_sys.h"
90#include "driver/gpio.h"
101 typedef std::string sfe_string_t;
103 static inline unsigned long sfe_millis(
void) {
return (
unsigned long)(esp_timer_get_time() / 1000ULL); }
104 static inline unsigned long sfe_micros(
void) {
return (
unsigned long)esp_timer_get_time(); }
111 static inline void sfe_delay(
unsigned long ms)
118 TickType_t ticks = pdMS_TO_TICKS(ms);
121 esp_rom_delay_us((uint32_t)(ms * 1000UL));
134 static inline void sfe_yield(
void)
142 static inline void sfe_pin_output(
int pin)
144 gpio_config_t conf = {};
145 conf.pin_bit_mask = 1ULL << pin;
146 conf.mode = GPIO_MODE_OUTPUT;
147 conf.pull_up_en = GPIO_PULLUP_DISABLE;
148 conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
149 conf.intr_type = GPIO_INTR_DISABLE;
153 static inline void sfe_pin_input(
int pin)
155 gpio_config_t conf = {};
156 conf.pin_bit_mask = 1ULL << pin;
157 conf.mode = GPIO_MODE_INPUT;
158 conf.pull_up_en = GPIO_PULLUP_DISABLE;
159 conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
160 conf.intr_type = GPIO_INTR_DISABLE;
163 static inline void sfe_pin_write(
int pin,
bool high) { gpio_set_level((gpio_num_t)pin, high ? 1 : 0); }
165 static inline void sfe_string_from_double(sfe_string_t &str,
double value,
int decimalPlaces)
168 snprintf(buf,
sizeof(buf),
"%.*f", decimalPlaces, value);
175#error "SparkFun Iridium 9604: unsupported platform. Arduino (ARDUINO) or ESP-IDF (ESP_PLATFORM) is required."
Definition: nmeaMessage.h:30