Welcome to mirror list, hosted at ThFree Co, Russian Federation.

one_wire_master.h « onewire « lib - github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3bdc8eaf431453f6bf8b2e969ea4b54de1dd56a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include <furi.h>
#include <api-hal.h>
#include "one_wire_timings.h"

class OneWireMaster {
private:
    const GpioPin* gpio;

    // global search state
    unsigned char saved_rom[8];
    uint8_t last_discrepancy;
    uint8_t last_family_discrepancy;
    bool last_device_flag;

public:
    OneWireMaster(const GpioPin* one_wire_gpio);
    ~OneWireMaster();
    bool reset(void);
    bool read_bit(void);
    uint8_t read(void);
    void read_bytes(uint8_t* buf, uint16_t count);
    void write_bit(bool value);
    void write(uint8_t value);
    void skip(void);
    void start(void);
    void stop(void);

    void reset_search();
    void target_search(uint8_t family_code);
    uint8_t search(uint8_t* newAddr, bool search_mode = true);
};