2245
|
1 #ifndef OSCILLOSCOPE_H_
|
|
2 #define OSCILLOSCOPE_H_
|
|
3 #include <stdint.h>
|
|
4
|
|
5 typedef struct {
|
|
6 const char *name;
|
|
7 int16_t *samples;
|
|
8 uint32_t next_sample;
|
|
9 uint32_t period;
|
|
10 uint32_t last_trigger;
|
|
11 uint32_t cur_trigger;
|
|
12 } scope_channel;
|
|
13
|
|
14 typedef struct {
|
|
15 scope_channel *channels;
|
|
16 uint8_t num_channels;
|
|
17 uint8_t channel_storage;
|
|
18 uint8_t window;
|
|
19 } oscilloscope;
|
|
20
|
|
21 oscilloscope *create_oscilloscope();
|
|
22 uint8_t scope_add_channel(oscilloscope *scope, const char *name, uint32_t sample_rate);
|
|
23 void scope_add_sample(oscilloscope *scope, uint8_t channel, int16_t value, uint8_t trigger);
|
|
24 void scope_render(oscilloscope *scope);
|
|
25 void scope_close(oscilloscope *scope);
|
|
26
|
|
27 #endif //OSCILLOSCOPE_H_ |