Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SPI_STMPE610 UniGraphic mbed vt100
trig.h
00001 /** mbed oscilloscope my implementation of a oscillo scope 00002 * Copyright (c) 2014, 2015 Motoo Tanaka @ Design Methodology Lab 00003 * 00004 * trig.h 00005 * 00006 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00007 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00008 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00009 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00010 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00011 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00012 * THE SOFTWARE. 00013 */ 00014 /* 00015 * About the ring buffer and trigger 00016 * 00017 * use data memory of memLength as a ring buffer 00018 * trig_pos: the trigger position on the display 00019 * trig_index: the data index where the trigger hit 00020 * bor: begin of ring_buffer 00021 * eor: end of ring_buffer (do we really need this?) 00022 * data_index: the data index of current data sampling 00023 * 00024 * Display = absolute memory placement 00025 * +-+----------------+--------+-----------+-----------+ 00026 * |0| |trig_pos| |memLength-1| 00027 * +-+----------------+--------+-----------+-----------+ 00028 * if trig_pos == trig_index 00029 * 0 00030 * +---+--------------+----------+-----------------+---+ 00031 * |bor| |trig_index| |eor| 00032 * +---+--------------+----------+-----------------+---+ 00033 * if trig_pos > trig_index 00034 * 0 00035 * +---+--------------+----------+-----------------+---+ 00036 * |bor| |trig_index| |eor| 00037 * +---+--------------+----------+-----------------+---+ 00038 * if trig_pos < trig_index 00039 * 0 0 00040 * +---+--------------+----------+-----------------+---+ 00041 * |bor| |trig_index| |eor| 00042 * +---+--------------+----------+-----------------+---+ 00043 * the buffer length = memLength ; 00044 * status(s) 00045 * 0: pre_trigger: for the beginning of sampling, before trig_pos 00046 * 1: trigger_wait: if check_trigger() move to trigger_hit 00047 * 2: tigger_hit: trigger has been hit, sampling data till data_full 00048 * 3: buffer_full: stop sampling and wait for the data to be consumed 00049 */ 00050 #ifndef _TRIG_H_ 00051 #define _TRIG_H_ defined 00052 #include "mbed.h" 00053 00054 // Trigger modes 00055 #define TRIG_MODE_NONE 0 00056 #define TRIG_MODE_RISE 1 00057 #define TRIG_MODE_FALL 2 00058 #define TRIG_MODE_LEVEL 3 00059 #define NUM_TRIG_MODE 4 00060 00061 // ST: Sampling Status 00062 #define ST_PRE_TRIG 0 00063 #define ST_TRIG_WAIT 1 00064 #define ST_TRIG_HIT 2 00065 #define ST_BUF_FULL 3 00066 00067 // trigger related values 00068 extern int sampling_status ; 00069 extern int trig_mode ; 00070 extern int trig_ch ; 00071 extern int trig_pos ; 00072 extern float trig_level ; 00073 extern uint16_t utrig_level ; 00074 extern int trig_index ; 00075 extern int post_trig_index ; 00076 extern int post_trig_len ; // length between trig_pos to end of display 00077 extern int trig_level_margin ; 00078 extern int memLength ; 00079 00080 extern char *trig_name[] ; 00081 00082 #endif /* _TRIG_H_ */
Generated on Wed Jul 13 2022 01:48:09 by
