Example #1
0
    def __init__(self, limit):
        self._limit = limit
        self._done = False

        interrupt.set_callback(interrupt.RTC_ALARM, self._countdown_handler)
        interrupt.enable_callback(interrupt.RTC_ALARM)

        utime.alarm(utime.time() + 1)
Example #2
0
    def close(self):
        if self.active:
            self.active = False
            ret = sys_bhi160.disable_sensor(self.sensor_id)

            if ret < 0:
                raise ValueError("Disable sensor returned %i", ret)

            interrupt.disable_callback(self.interrupt_id)
            interrupt.set_callback(self.interrupt_id, None)
Example #3
0
    def close(self):
        """
        Close the currently open connection to the sensor.
        """

        if self.active:
            self.active = False
            ret = sys_max30001.disable_sensor()

            if ret < 0:
                raise ValueError("Disable sensor returned %i", ret)

            interrupt.disable_callback(self.interrupt_id)
            interrupt.set_callback(self.interrupt_id, None)
Example #4
0
    def enable_sensor(self):
        interrupt.disable_callback(self.interrupt_id)
        interrupt.set_callback(self.interrupt_id, self._interrupt)
        self.stream_id = sys_bhi160.enable_sensor(self.sensor_id,
                                                  self.sample_buffer_len,
                                                  self.sample_rate,
                                                  self.dynamic_range)

        if self.stream_id < 0:
            raise ValueError("Enable sensor returned %i", self.stream_id)

        self.active = True

        if self._callback:
            interrupt.enable_callback(self.interrupt_id)
Example #5
0
    def enable_sensor(self):
        """
        Enables the sensor. Automatically called by __init__.
        """
        interrupt.disable_callback(self.interrupt_id)
        interrupt.set_callback(self.interrupt_id, self._interrupt)
        self.stream_id = sys_max30001.enable_sensor(
            self.usb, self.bias, self.sample_rate, self.sample_buffer_len
        )

        if self.stream_id < 0:
            raise ValueError("Enable sensor returned %i", self.stream_id)

        self.active = True

        if self._callback:
            interrupt.enable_callback(self.interrupt_id)
Example #6
0
    disp.clear()
    disp.print("Last %us" % window, posy=0, fg=color.WHITE)
    disp.print("Tot: %d" % packet_count, posy=20, fg=color.WHITE)
    disp.print("WC:  %d" % write_count, posy=40, fg=color.WHITE)
    disp.print("Bat: %.2fV" % power.read_battery_voltage(),
               posy=60,
               fg=color.WHITE)
    disp.update()


last_rx_time = 0
disp = display.open()
v_old = 0
pause = 1

interrupt.set_callback(interrupt.BLE, ble_callback)
interrupt.enable_callback(interrupt.BLE)

try:
    vib_mode = int(config.get_string("exno_vib_mode"))
except:
    pass

try:
    led_mode = int(config.get_string("exno_led_mode"))
except:
    pass

disp.clear()
disp.print(" Exp Notif", posy=0, fg=color.WHITE)
disp.print("  Logger", posy=20, fg=color.WHITE)