Subversion Repositories svn.mios32

Rev

Rev 236 | Rev 248 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
134 tk 1
// $Id: seq_ui.h 240 2009-01-04 00:26:14Z tk $
2
/*
3
 * Header file for user interface routines
4
 *
5
 * ==========================================================================
6
 *
7
 *  Copyright (C) 2008 Thorsten Klose (tk@midibox.org)
8
 *  Licensed for personal non-commercial use only.
9
 *  All other rights reserved.
10
 *
11
 * ==========================================================================
12
 */
13
 
14
#ifndef _SEQ_UI_H
15
#define _SEQ_UI_H
16
 
167 tk 17
/////////////////////////////////////////////////////////////////////////////
18
// Menu Page definitions
19
/////////////////////////////////////////////////////////////////////////////
134 tk 20
 
167 tk 21
// must be kept in sync with ui_init_callback list in seq_ui.c!
240 tk 22
#define SEQ_UI_PAGES 18
167 tk 23
 
24
typedef enum {
25
  SEQ_UI_PAGE_NONE,
235 tk 26
  SEQ_UI_PAGE_SHORTCUT,
167 tk 27
  SEQ_UI_PAGE_EDIT,
184 tk 28
  SEQ_UI_PAGE_MUTE,
29
  SEQ_UI_PAGE_PATTERN,
174 tk 30
  SEQ_UI_PAGE_TRKEVNT,
180 tk 31
  SEQ_UI_PAGE_TRKMODE,
173 tk 32
  SEQ_UI_PAGE_TRKDIR,
33
  SEQ_UI_PAGE_TRKDIV,
180 tk 34
  SEQ_UI_PAGE_TRKLEN,
35
  SEQ_UI_PAGE_TRKTRAN,
240 tk 36
  SEQ_UI_PAGE_TRKRND,
206 tk 37
  SEQ_UI_PAGE_TRGASG,
235 tk 38
  SEQ_UI_PAGE_FX,
236 tk 39
  SEQ_UI_PAGE_FX_ECHO,
240 tk 40
  SEQ_UI_PAGE_UTIL,
236 tk 41
  SEQ_UI_PAGE_BPM,
240 tk 42
  SEQ_UI_PAGE_OPT
167 tk 43
} seq_ui_page_t;
44
 
45
 
46
// Prototypes for all UI pages are burried here
47
extern s32 SEQ_UI_TODO_Init(u32 mode);
235 tk 48
extern s32 SEQ_UI_SHORTCUT_Init(u32 mode);
167 tk 49
extern s32 SEQ_UI_EDIT_Init(u32 mode);
184 tk 50
extern s32 SEQ_UI_MUTE_Init(u32 mode);
51
extern s32 SEQ_UI_PATTERN_Init(u32 mode);
174 tk 52
extern s32 SEQ_UI_TRKEVNT_Init(u32 mode);
180 tk 53
extern s32 SEQ_UI_TRKMODE_Init(u32 mode);
167 tk 54
extern s32 SEQ_UI_TRKDIR_Init(u32 mode);
173 tk 55
extern s32 SEQ_UI_TRKDIV_Init(u32 mode);
56
extern s32 SEQ_UI_TRKLEN_Init(u32 mode);
180 tk 57
extern s32 SEQ_UI_TRKTRAN_Init(u32 mode);
240 tk 58
extern s32 SEQ_UI_TRKRND_Init(u32 mode);
180 tk 59
extern s32 SEQ_UI_TRGASG_Init(u32 mode);
235 tk 60
extern s32 SEQ_UI_FX_Init(u32 mode);
61
extern s32 SEQ_UI_FX_ECHO_Init(u32 mode);
240 tk 62
extern s32 SEQ_UI_UTIL_Init(u32 mode);
236 tk 63
extern s32 SEQ_UI_BPM_Init(u32 mode);
240 tk 64
extern s32 SEQ_UI_OPT_Init(u32 mode);
167 tk 65
 
66
 
134 tk 67
/////////////////////////////////////////////////////////////////////////////
68
// Global definitions
69
/////////////////////////////////////////////////////////////////////////////
70
 
168 tk 71
// cursor flash with following waveform:
72
// 0..399 mS: cursor on
73
// 400..499 mS: cursor off
74
#define SEQ_UI_CURSOR_FLASH_CTR_MAX     500  // mS
75
#define SEQ_UI_CURSOR_FLASH_CTR_LED_OFF 400  // mS
134 tk 76
 
168 tk 77
 
134 tk 78
/////////////////////////////////////////////////////////////////////////////
79
// Global Types
80
/////////////////////////////////////////////////////////////////////////////
81
 
167 tk 82
typedef union {
83
  struct {
240 tk 84
    unsigned ALL:16;
167 tk 85
  };
86
  struct {
87
    unsigned MENU_PRESSED:1;
178 tk 88
    unsigned CHANGE_ALL_STEPS:1;
89
    unsigned CHANGE_ALL_STEPS_SAME_VALUE:1;
90
    unsigned FAST_ENCODERS:1;
91
    unsigned SOLO:1;
92
    unsigned METRONOME:1;
93
    unsigned SCRUB:1;
240 tk 94
    unsigned REW:1;
95
    unsigned FWD:1;
96
    unsigned COPY:1;
97
    unsigned PASTE:1;
98
    unsigned CLEAR:1;
99
    unsigned F1:1;
100
    unsigned F2:1;
101
    unsigned F3:1;
102
    unsigned F4:1;
103
    unsigned UP:1;
104
    unsigned DOWN:1;
167 tk 105
  };
106
} seq_ui_button_state_t;
134 tk 107
 
167 tk 108
 
168 tk 109
typedef enum {
110
  SEQ_UI_BUTTON_GP1,
111
  SEQ_UI_BUTTON_GP2,
112
  SEQ_UI_BUTTON_GP3,
113
  SEQ_UI_BUTTON_GP4,
114
  SEQ_UI_BUTTON_GP5,
115
  SEQ_UI_BUTTON_GP6,
116
  SEQ_UI_BUTTON_GP7,
117
  SEQ_UI_BUTTON_GP8,
118
  SEQ_UI_BUTTON_GP9,
119
  SEQ_UI_BUTTON_GP10,
120
  SEQ_UI_BUTTON_GP11,
121
  SEQ_UI_BUTTON_GP12,
122
  SEQ_UI_BUTTON_GP13,
123
  SEQ_UI_BUTTON_GP14,
124
  SEQ_UI_BUTTON_GP15,
125
  SEQ_UI_BUTTON_GP16,
126
  SEQ_UI_BUTTON_Exit,
127
  SEQ_UI_BUTTON_Select,
128
  SEQ_UI_BUTTON_Left,
129
  SEQ_UI_BUTTON_Right,
130
  SEQ_UI_BUTTON_Up,
131
  SEQ_UI_BUTTON_Down
132
} seq_ui_button_t;
167 tk 133
 
168 tk 134
 
135
typedef enum {
136
  SEQ_UI_ENCODER_GP1,
137
  SEQ_UI_ENCODER_GP2,
138
  SEQ_UI_ENCODER_GP3,
139
  SEQ_UI_ENCODER_GP4,
140
  SEQ_UI_ENCODER_GP5,
141
  SEQ_UI_ENCODER_GP6,
142
  SEQ_UI_ENCODER_GP7,
143
  SEQ_UI_ENCODER_GP8,
144
  SEQ_UI_ENCODER_GP9,
145
  SEQ_UI_ENCODER_GP10,
146
  SEQ_UI_ENCODER_GP11,
147
  SEQ_UI_ENCODER_GP12,
148
  SEQ_UI_ENCODER_GP13,
149
  SEQ_UI_ENCODER_GP14,
150
  SEQ_UI_ENCODER_GP15,
151
  SEQ_UI_ENCODER_GP16,
152
  SEQ_UI_ENCODER_Datawheel
153
} seq_ui_encoder_t;
154
 
155
 
240 tk 156
typedef enum {
157
  SEQ_UI_EDIT_MODE_NORMAL,
158
  SEQ_UI_EDIT_MODE_COPY,
159
  SEQ_UI_EDIT_MODE_PASTE,
160
  SEQ_UI_EDIT_MODE_CLEAR,
161
  SEQ_UI_EDIT_MODE_MOVE,
162
  SEQ_UI_EDIT_MODE_SCROLL,
163
  SEQ_UI_EDIT_MODE_RANDOM,
164
  SEQ_UI_EDIT_MODE_RECORD
165
} seq_ui_edit_mode_t;
168 tk 166
 
240 tk 167
 
134 tk 168
/////////////////////////////////////////////////////////////////////////////
169
// Prototypes
170
/////////////////////////////////////////////////////////////////////////////
171
 
172
extern s32 SEQ_UI_Init(u32 mode);
173
 
178 tk 174
extern s32 SEQ_UI_InitEncSpeed(u32 auto_config);
175
 
134 tk 176
extern s32 SEQ_UI_Button_Handler(u32 pin, u32 pin_value);
177
extern s32 SEQ_UI_Encoder_Handler(u32 encoder, s32 incrementer);
178
extern s32 SEQ_UI_LED_Handler(void);
179
extern s32 SEQ_UI_LED_Handler_Periodic();
184 tk 180
extern s32 SEQ_UI_LCD_Handler(void);
168 tk 181
extern s32 SEQ_UI_MENU_Handler_Periodic();
134 tk 182
 
167 tk 183
extern s32 SEQ_UI_PageSet(seq_ui_page_t page);
184
 
185
extern s32 SEQ_UI_InstallInitCallback(void *callback);
168 tk 186
extern s32 SEQ_UI_InstallButtonCallback(void *callback);
187
extern s32 SEQ_UI_InstallEncoderCallback(void *callback);
188
extern s32 SEQ_UI_InstallLEDCallback(void *callback);
189
extern s32 SEQ_UI_InstallLCDCallback(void *callback);
167 tk 190
 
168 tk 191
extern u8  SEQ_UI_VisibleTrackGet(void);
178 tk 192
extern s32 SEQ_UI_IsSelectedTrack(u8 track);
193
 
240 tk 194
extern s32 SEQ_UI_SelectedStepSet(u8 step);
195
 
168 tk 196
extern s32 SEQ_UI_GxTyInc(s32 incrementer);
240 tk 197
extern s32 SEQ_UI_Var16_Inc(u16 *value, u16 min, u16 max, s32 incrementer);
198
extern s32 SEQ_UI_Var8_Inc(u8 *value, u16 min, u16 max, s32 incrementer);
179 tk 199
extern s32 SEQ_UI_CC_Inc(u8 cc, u16 min, u16 max, s32 incrementer);
200
extern s32 SEQ_UI_CC_Set(u8 cc, u16 value);
201
extern s32 SEQ_UI_CC_SetFlags(u8 cc, u16 flag_mask, u16 value);
134 tk 202
 
203
 
204
/////////////////////////////////////////////////////////////////////////////
240 tk 205
// Prototypes for functions implemented in seq_ui_*.c
206
/////////////////////////////////////////////////////////////////////////////
207
 
208
extern s32 SEQ_UI_EDIT_LCD_Handler(u8 high_prio, seq_ui_edit_mode_t edit_mode);
209
extern s32 SEQ_UI_EDIT_LED_Handler(u16 *gp_leds);
210
 
211
extern s32 SEQ_UI_UTIL_CopyButton(s32 depressed);
212
extern s32 SEQ_UI_UTIL_PasteButton(s32 depressed);
213
extern s32 SEQ_UI_UTIL_ClearButton(s32 depressed);
214
extern s32 SEQ_UI_UTIL_UndoButton(s32 depressed);
215
 
216
extern s32 SEQ_UI_UTIL_UndoUpdate(u8 track);
217
 
218
extern u8 SEQ_UI_UTIL_CopyPasteBeginGet(void);
219
extern u8 SEQ_UI_UTIL_CopyPasteEndGet(void);
220
 
221
 
222
/////////////////////////////////////////////////////////////////////////////
134 tk 223
// Export global variables
224
/////////////////////////////////////////////////////////////////////////////
225
 
159 tk 226
extern u8 seq_ui_display_update_req;
227
extern u8 seq_ui_display_init_req;
134 tk 228
 
167 tk 229
extern seq_ui_button_state_t seq_ui_button_state;
230
 
134 tk 231
extern u8 ui_selected_group;
232
extern u8 ui_selected_tracks;
233
extern u8 ui_selected_par_layer;
234
extern u8 ui_selected_trg_layer;
235
extern u8 ui_selected_step_view;
236
extern u8 ui_selected_step;
168 tk 237
extern u8 ui_selected_item;
134 tk 238
 
240 tk 239
extern u16 ui_hold_msg_ctr;
240
 
206 tk 241
extern seq_ui_page_t ui_page;
242
extern seq_ui_page_t ui_shortcut_prev_page;
243
 
173 tk 244
extern volatile u8 ui_cursor_flash;
168 tk 245
 
193 tk 246
extern u8 ui_seq_pause;
247
 
134 tk 248
#endif /* _SEQ_UI_H */