From 2e02cd8cf9d04aa969bf5af03bd404b48f99d316 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 22 Aug 2019 15:48:22 -0400 Subject: [PATCH] Expose WiFiNINA NTP Time --- adafruit_esp32spi/adafruit_esp32spi.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/adafruit_esp32spi/adafruit_esp32spi.py b/adafruit_esp32spi/adafruit_esp32spi.py index 3e16df0..ba01f68 100644 --- a/adafruit_esp32spi/adafruit_esp32spi.py +++ b/adafruit_esp32spi/adafruit_esp32spi.py @@ -82,6 +82,7 @@ _GET_HOST_BY_NAME_CMD = const(0x35) _START_SCAN_NETWORKS = const(0x36) _GET_FW_VERSION_CMD = const(0x37) +_GET_TIME = const(0x3B) _PING_CMD = const(0x3E) _SEND_DATA_TCP_CMD = const(0x44) @@ -760,3 +761,10 @@ def set_analog_write(self, pin, analog_value): ((pin,), (value,))) if resp[0][0] != 1: raise RuntimeError("Failed to write to pin") + + def get_time(self): + """The current unix timestamp""" + if self.status == 3: + resp = self._send_command_get_response(_GET_TIME) + return struct.unpack('