Subversion Repositories svn.mios32

Rev

Rev 1068 | Rev 1121 | 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 1090 2010-10-04 22:14:20Z 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
 
272 tk 21
#include "seq_ui_pages.inc"
167 tk 22
 
23
 
134 tk 24
/////////////////////////////////////////////////////////////////////////////
25
// Global definitions
26
/////////////////////////////////////////////////////////////////////////////
27
 
168 tk 28
// cursor flash with following waveform:
29
// 0..399 mS: cursor on
30
// 400..499 mS: cursor off
31
#define SEQ_UI_CURSOR_FLASH_CTR_MAX     500  // mS
32
#define SEQ_UI_CURSOR_FLASH_CTR_LED_OFF 400  // mS
134 tk 33
 
168 tk 34
 
134 tk 35
/////////////////////////////////////////////////////////////////////////////
36
// Global Types
37
/////////////////////////////////////////////////////////////////////////////
38
 
167 tk 39
typedef union {
40
  struct {
848 tk 41
    u32 ALL;
167 tk 42
  };
43
  struct {
848 tk 44
    u8 PAGE_CHANGE_BUTTON_FLAGS:6;
678 tk 45
  };
46
  struct {
47
    // these button functions will change a page (special "radio button" handling required)
848 tk 48
    u8 MENU_PRESSED:1;
49
    u8 STEP_VIEW:1;
50
    u8 PAR_LAYER_SEL:1;
51
    u8 TRG_LAYER_SEL:1;
52
    u8 TRACK_SEL:1;
53
    u8 TEMPO_PRESET:1;
678 tk 54
 
55
    // remaining functions
848 tk 56
    u8 MENU_FIRST_PAGE_SELECTED:1;
57
    u8 CHANGE_ALL_STEPS:1;
58
    u8 CHANGE_ALL_STEPS_SAME_VALUE:1;
59
    u8 SELECT_PRESSED:1;
60
    u8 EDIT_PRESSED:1;
61
    u8 MUTE_PRESSED:1;
62
    u8 PATTERN_PRESSED:1;
63
    u8 SONG_PRESSED:1;
64
    u8 FAST_ENCODERS:1;
65
    u8 SOLO:1;
66
    u8 SCRUB:1;
67
    u8 REW:1;
68
    u8 FWD:1;
69
    u8 COPY:1;
70
    u8 PASTE:1;
71
    u8 CLEAR:1;
1014 tk 72
    u8 UNDO:1;
848 tk 73
    u8 TAP_TEMPO:1;
74
    u8 UP:1;
75
    u8 DOWN:1;
167 tk 76
  };
77
} seq_ui_button_state_t;
134 tk 78
 
167 tk 79
 
168 tk 80
typedef enum {
81
  SEQ_UI_BUTTON_GP1,
82
  SEQ_UI_BUTTON_GP2,
83
  SEQ_UI_BUTTON_GP3,
84
  SEQ_UI_BUTTON_GP4,
85
  SEQ_UI_BUTTON_GP5,
86
  SEQ_UI_BUTTON_GP6,
87
  SEQ_UI_BUTTON_GP7,
88
  SEQ_UI_BUTTON_GP8,
89
  SEQ_UI_BUTTON_GP9,
90
  SEQ_UI_BUTTON_GP10,
91
  SEQ_UI_BUTTON_GP11,
92
  SEQ_UI_BUTTON_GP12,
93
  SEQ_UI_BUTTON_GP13,
94
  SEQ_UI_BUTTON_GP14,
95
  SEQ_UI_BUTTON_GP15,
96
  SEQ_UI_BUTTON_GP16,
97
  SEQ_UI_BUTTON_Exit,
98
  SEQ_UI_BUTTON_Select,
99
  SEQ_UI_BUTTON_Left,
100
  SEQ_UI_BUTTON_Right,
101
  SEQ_UI_BUTTON_Up,
102
  SEQ_UI_BUTTON_Down
103
} seq_ui_button_t;
167 tk 104
 
168 tk 105
 
106
typedef enum {
107
  SEQ_UI_ENCODER_GP1,
108
  SEQ_UI_ENCODER_GP2,
109
  SEQ_UI_ENCODER_GP3,
110
  SEQ_UI_ENCODER_GP4,
111
  SEQ_UI_ENCODER_GP5,
112
  SEQ_UI_ENCODER_GP6,
113
  SEQ_UI_ENCODER_GP7,
114
  SEQ_UI_ENCODER_GP8,
115
  SEQ_UI_ENCODER_GP9,
116
  SEQ_UI_ENCODER_GP10,
117
  SEQ_UI_ENCODER_GP11,
118
  SEQ_UI_ENCODER_GP12,
119
  SEQ_UI_ENCODER_GP13,
120
  SEQ_UI_ENCODER_GP14,
121
  SEQ_UI_ENCODER_GP15,
122
  SEQ_UI_ENCODER_GP16,
123
  SEQ_UI_ENCODER_Datawheel
124
} seq_ui_encoder_t;
125
 
126
 
240 tk 127
typedef enum {
128
  SEQ_UI_EDIT_MODE_NORMAL,
129
  SEQ_UI_EDIT_MODE_COPY,
130
  SEQ_UI_EDIT_MODE_PASTE,
131
  SEQ_UI_EDIT_MODE_CLEAR,
132
  SEQ_UI_EDIT_MODE_MOVE,
133
  SEQ_UI_EDIT_MODE_SCROLL,
134
  SEQ_UI_EDIT_MODE_RANDOM,
600 tk 135
  SEQ_UI_EDIT_MODE_RECORD,
136
  SEQ_UI_EDIT_MODE_MANUAL
240 tk 137
} seq_ui_edit_mode_t;
168 tk 138
 
240 tk 139
 
596 tk 140
typedef enum {
141
  SEQ_UI_MSG_USER,
741 tk 142
  SEQ_UI_MSG_USER_R,
740 tk 143
  SEQ_UI_MSG_SDCARD,
756 tk 144
  SEQ_UI_MSG_DELAYED_ACTION,
145
  SEQ_UI_MSG_DELAYED_ACTION_R
596 tk 146
} seq_ui_msg_type_t;
147
 
148
 
625 tk 149
typedef enum {
626 tk 150
  SEQ_UI_REMOTE_MODE_AUTO=0,
625 tk 151
  SEQ_UI_REMOTE_MODE_SERVER,
152
  SEQ_UI_REMOTE_MODE_CLIENT
153
} seq_ui_remote_mode_t;
154
 
155
 
134 tk 156
/////////////////////////////////////////////////////////////////////////////
157
// Prototypes
158
/////////////////////////////////////////////////////////////////////////////
159
 
160
extern s32 SEQ_UI_Init(u32 mode);
161
 
178 tk 162
extern s32 SEQ_UI_InitEncSpeed(u32 auto_config);
163
 
134 tk 164
extern s32 SEQ_UI_Button_Handler(u32 pin, u32 pin_value);
524 tk 165
extern s32 SEQ_UI_BLM_Button_Handler(u32 row, u32 pin, u32 pin_value);
134 tk 166
extern s32 SEQ_UI_Encoder_Handler(u32 encoder, s32 incrementer);
626 tk 167
extern s32 SEQ_UI_REMOTE_MIDI_Receive(mios32_midi_port_t port, mios32_midi_package_t midi_package);
742 tk 168
extern s32 SEQ_UI_REMOTE_MIDI_Keyboard(u8 key, u8 depressed);
741 tk 169
 
1068 tk 170
extern s32 SEQ_UI_Button_Play(s32 depressed);
171
extern s32 SEQ_UI_Button_Stop(s32 depressed);
172
 
134 tk 173
extern s32 SEQ_UI_LED_Handler(void);
174
extern s32 SEQ_UI_LED_Handler_Periodic();
184 tk 175
extern s32 SEQ_UI_LCD_Handler(void);
168 tk 176
extern s32 SEQ_UI_MENU_Handler_Periodic();
134 tk 177
 
167 tk 178
extern s32 SEQ_UI_PageSet(seq_ui_page_t page);
272 tk 179
extern char *SEQ_UI_PageNameGet(seq_ui_page_t page);
167 tk 180
 
181
extern s32 SEQ_UI_InstallInitCallback(void *callback);
168 tk 182
extern s32 SEQ_UI_InstallButtonCallback(void *callback);
183
extern s32 SEQ_UI_InstallEncoderCallback(void *callback);
184
extern s32 SEQ_UI_InstallLEDCallback(void *callback);
185
extern s32 SEQ_UI_InstallLCDCallback(void *callback);
690 tk 186
extern s32 SEQ_UI_InstallExitCallback(void *callback);
752 tk 187
extern s32 SEQ_UI_InstallDelayedActionCallback(void *callback, u16 delay_mS, u32 parameter);
740 tk 188
extern s32 SEQ_UI_UnInstallDelayedActionCallback(void *callback);
167 tk 189
 
353 tk 190
extern s32 SEQ_UI_LCD_Update(void);
191
 
328 tk 192
extern s32 SEQ_UI_CheckSelections(void);
193
 
168 tk 194
extern u8  SEQ_UI_VisibleTrackGet(void);
178 tk 195
extern s32 SEQ_UI_IsSelectedTrack(u8 track);
196
 
240 tk 197
extern s32 SEQ_UI_SelectedStepSet(u8 step);
198
 
168 tk 199
extern s32 SEQ_UI_GxTyInc(s32 incrementer);
240 tk 200
extern s32 SEQ_UI_Var16_Inc(u16 *value, u16 min, u16 max, s32 incrementer);
201
extern s32 SEQ_UI_Var8_Inc(u8 *value, u16 min, u16 max, s32 incrementer);
248 tk 202
extern s32 SEQ_UI_CC_Inc(u8 cc, u8 min, u8 max, s32 incrementer);
203
extern s32 SEQ_UI_CC_Set(u8 cc, u8 value);
204
extern s32 SEQ_UI_CC_SetFlags(u8 cc, u8 flag_mask, u8 value);
134 tk 205
 
744 tk 206
extern s32 SEQ_UI_SelectListItem(s32 incrementer, u8 num_items, u8 max_items_on_screen, u8 *selected_item_on_screen, u8 *view_offset);
134 tk 207
 
752 tk 208
extern s32 SEQ_UI_KeyPad_Init(void);
209
extern s32 SEQ_UI_KeyPad_Handler(seq_ui_encoder_t encoder, s32 incrementer, char *edit_str, u8 len);
210
extern s32 SEQ_UI_KeyPad_LCD_Msg(void);
744 tk 211
 
752 tk 212
 
134 tk 213
/////////////////////////////////////////////////////////////////////////////
240 tk 214
// Prototypes for functions implemented in seq_ui_*.c
215
/////////////////////////////////////////////////////////////////////////////
216
 
758 tk 217
extern s32 SEQ_UI_EDIT_LED_Handler(u16 *gp_leds);
218
extern s32 SEQ_UI_EDIT_Button_Handler(seq_ui_button_t button, s32 depressed);
240 tk 219
extern s32 SEQ_UI_EDIT_LCD_Handler(u8 high_prio, seq_ui_edit_mode_t edit_mode);
220
 
221
extern s32 SEQ_UI_UTIL_CopyButton(s32 depressed);
222
extern s32 SEQ_UI_UTIL_PasteButton(s32 depressed);
223
extern s32 SEQ_UI_UTIL_ClearButton(s32 depressed);
224
extern s32 SEQ_UI_UTIL_UndoButton(s32 depressed);
225
 
280 tk 226
extern s32 SEQ_UI_MIXER_Copy(void);
227
extern s32 SEQ_UI_MIXER_Paste(void);
228
extern s32 SEQ_UI_MIXER_Clear(void);
1014 tk 229
extern s32 SEQ_UI_MIXER_Undo(void);
280 tk 230
extern s32 SEQ_UI_MIXER_UndoUpdate(void);
231
 
729 tk 232
extern s32 SEQ_UI_SONG_Copy(void);
233
extern s32 SEQ_UI_SONG_Paste(void);
234
extern s32 SEQ_UI_SONG_Clear(void);
235
extern s32 SEQ_UI_SONG_Insert(void);
236
extern s32 SEQ_UI_SONG_Delete(void);
752 tk 237
extern s32 SEQ_UI_SONG_EditPosSet(u8 new_edit_pos);
729 tk 238
 
1090 tk 239
extern s32 SEQ_UI_BPM_TapTempo(void);
240
 
240 tk 241
extern s32 SEQ_UI_UTIL_UndoUpdate(u8 track);
242
 
243
extern u8 SEQ_UI_UTIL_CopyPasteBeginGet(void);
244
extern u8 SEQ_UI_UTIL_CopyPasteEndGet(void);
245
 
596 tk 246
extern s32 SEQ_UI_Msg(seq_ui_msg_type_t msg_type, u16 delay, char *line1, char *line2);
247
extern s32 SEQ_UI_MsgStop(void);
299 tk 248
extern s32 SEQ_UI_SDCardErrMsg(u16 delay, s32 status);
240 tk 249
 
299 tk 250
 
240 tk 251
/////////////////////////////////////////////////////////////////////////////
134 tk 252
// Export global variables
253
/////////////////////////////////////////////////////////////////////////////
254
 
159 tk 255
extern u8 seq_ui_display_update_req;
256
extern u8 seq_ui_display_init_req;
134 tk 257
 
167 tk 258
extern seq_ui_button_state_t seq_ui_button_state;
259
 
134 tk 260
extern u8 ui_selected_group;
484 tk 261
extern u16 ui_selected_tracks;
134 tk 262
extern u8 ui_selected_par_layer;
263
extern u8 ui_selected_trg_layer;
328 tk 264
extern u8 ui_selected_instrument;
134 tk 265
extern u8 ui_selected_step_view;
266
extern u8 ui_selected_step;
168 tk 267
extern u8 ui_selected_item;
134 tk 268
 
240 tk 269
extern u16 ui_hold_msg_ctr;
270
 
206 tk 271
extern seq_ui_page_t ui_page;
272 tk 272
extern seq_ui_page_t ui_selected_page;
303 tk 273
extern seq_ui_page_t ui_stepview_prev_page;
326 tk 274
extern seq_ui_page_t ui_trglayer_prev_page;
275
extern seq_ui_page_t ui_parlayer_prev_page;
206 tk 276
 
173 tk 277
extern volatile u8 ui_cursor_flash;
740 tk 278
extern volatile u8 ui_cursor_flash_overrun_ctr;
1020 tk 279
extern u16 ui_cursor_flash_ctr;
168 tk 280
 
316 tk 281
extern u8 ui_edit_name_cursor;
282
extern u8 ui_edit_preset_num_category;
283
extern u8 ui_edit_preset_num_label;
729 tk 284
extern u8 ui_edit_preset_num_drum;
316 tk 285
 
193 tk 286
extern u8 ui_seq_pause;
287
 
625 tk 288
extern seq_ui_remote_mode_t seq_ui_remote_mode;
626 tk 289
extern seq_ui_remote_mode_t seq_ui_remote_active_mode;
625 tk 290
extern mios32_midi_port_t seq_ui_remote_port;
626 tk 291
extern mios32_midi_port_t seq_ui_remote_active_port;
625 tk 292
extern u8 seq_ui_remote_id;
626 tk 293
extern u16 seq_ui_remote_client_timeout_ctr;
294
extern u8 seq_ui_remote_force_lcd_update;
295
extern u8 seq_ui_remote_force_led_update;
625 tk 296
 
634 tk 297
extern u8 seq_ui_backup_req;
740 tk 298
extern u8 seq_ui_format_req;
974 tk 299
extern u8 seq_ui_saveall_req;
634 tk 300
 
746 tk 301
extern char ui_global_dir_list[80];
744 tk 302
 
134 tk 303
#endif /* _SEQ_UI_H */