Logic Analyzer RPi
Logic Analyzer for the Raspberry Pi
 All Classes Files Functions Variables Pages
microwire.h
1 //#include <stdio.h>
2 //#include <string.h>
3 //#include <stdlib.h>
4 //#include <mgl/mgl_fltk.h>
5 #include <mgl/mgl_zb.h>
6 //#include <unistd.h>
7 
8 
9 #ifndef LOGIC_INPUT
10 #define LOGIC_INPUT
11 #include "logic_input.h"
12 #endif
13 
14 #ifndef TRANSITION
15 #define TRANSITION
16 #include "transition.h"
17 #endif
18 
19 #ifndef BINARY
20 #define BINARY
21 #include "binary.h"
22 #endif
23 
24 #ifndef MESSAGE
25 #define MESSAGE
26 #include "message.h"
27 #endif
28 
29 #ifndef ACTIVITY
30 #define ACTIVITY
31 #include "activity.h"
32 #endif
33 
34 #ifndef PROTOCOL
35 #define PROTOCOL
36 #include "protocol.h"
37 #endif
38 
39 #ifndef DEBUG_H
40 #define DEBUG_H
41 #include "debug.h"
42 #endif
43 
45 //* As bellow, all protocols must herit from class protocol.
46 class microwire: public protocol
47 {
48 public:
50 
51  microwire(uint8_t pins[]=NULL,uint8_t npin=4);
52 
54  ~microwire();
55 
56  // Initialize acquisition (not defined, as protocol::init_acquisition() do the job).
57  /* Setup capture on the GPIO pins given.
58  \param pins array of GPIO pin used in init_acquisition() such as:
59  - pins[0] acquires CS (Chip Select)
60  - pins[1] acquires CLK (the clock)
61  - pins[2] acquires MOSI (Master Out Slave In)
62  - pins[3] acquires MISO (Master In Slave Out)
63  - any pin>3 will not be decoded but will be acquired and displayed.
64  \param npin number of pin to acquire (must be smaller or equal to the size of pins)*/
65  //void init_acquisition(uint8_t pins[],uint8_t npin);
66 
67  // Start acquisition (not defined, as protocol::acquire() do the job).
68  /* \param npoint number of points to acquire.
69  \param period wait time in ms between 2 measurements.*/
70  //void acquire(uint32_t npoint=2000, float period=1.0);
72 
79  void decode ();
81 
82  void decode_mosi();
83 
85 
86  void decode_miso();
87 
89 
90  int Draw(mglGraph *gr);
91 
92 //private:
94 
97 
100 
103 
110  uint32_t nmessage;
111 };