Subversion Repositories svn.mios32

Rev

Rev 513 | Rev 591 | 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 524 2009-05-16 20:11:13Z 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 {
326 tk 41
    unsigned ALL:32;
167 tk 42
  };
43
  struct {
44
    unsigned MENU_PRESSED:1;
306 tk 45
    unsigned MENU_FIRST_PAGE_SELECTED:1;
178 tk 46
    unsigned CHANGE_ALL_STEPS:1;
47
    unsigned CHANGE_ALL_STEPS_SAME_VALUE:1;
48
    unsigned FAST_ENCODERS:1;
49
    unsigned SOLO:1;
50
    unsigned SCRUB:1;
513 tk 51
    unsigned STEP_VIEW:1;
326 tk 52
    unsigned PAR_LAYER_SEL:1;
53
    unsigned TRG_LAYER_SEL:1;
513 tk 54
    unsigned TRACK_SEL:1;
240 tk 55
    unsigned REW:1;
56
    unsigned FWD:1;
57
    unsigned COPY:1;
58
    unsigned PASTE:1;
59
    unsigned CLEAR:1;
513 tk 60
    unsigned TAP_TEMPO:1;
61
    unsigned TEMPO_PRESET:1;
240 tk 62
    unsigned UP:1;
63
    unsigned DOWN:1;
167 tk 64
  };
65
} seq_ui_button_state_t;
134 tk 66
 
167 tk 67
 
168 tk 68
typedef enum {
69
  SEQ_UI_BUTTON_GP1,
70
  SEQ_UI_BUTTON_GP2,
71
  SEQ_UI_BUTTON_GP3,
72
  SEQ_UI_BUTTON_GP4,
73
  SEQ_UI_BUTTON_GP5,
74
  SEQ_UI_BUTTON_GP6,
75
  SEQ_UI_BUTTON_GP7,
76
  SEQ_UI_BUTTON_GP8,
77
  SEQ_UI_BUTTON_GP9,
78
  SEQ_UI_BUTTON_GP10,
79
  SEQ_UI_BUTTON_GP11,
80
  SEQ_UI_BUTTON_GP12,
81
  SEQ_UI_BUTTON_GP13,
82
  SEQ_UI_BUTTON_GP14,
83
  SEQ_UI_BUTTON_GP15,
84
  SEQ_UI_BUTTON_GP16,
85
  SEQ_UI_BUTTON_Exit,
86
  SEQ_UI_BUTTON_Select,
87
  SEQ_UI_BUTTON_Left,
88
  SEQ_UI_BUTTON_Right,
89
  SEQ_UI_BUTTON_Up,
90
  SEQ_UI_BUTTON_Down
91
} seq_ui_button_t;
167 tk 92
 
168 tk 93
 
94
typedef enum {
95
  SEQ_UI_ENCODER_GP1,
96
  SEQ_UI_ENCODER_GP2,
97
  SEQ_UI_ENCODER_GP3,
98
  SEQ_UI_ENCODER_GP4,
99
  SEQ_UI_ENCODER_GP5,
100
  SEQ_UI_ENCODER_GP6,
101
  SEQ_UI_ENCODER_GP7,
102
  SEQ_UI_ENCODER_GP8,
103
  SEQ_UI_ENCODER_GP9,
104
  SEQ_UI_ENCODER_GP10,
105
  SEQ_UI_ENCODER_GP11,
106
  SEQ_UI_ENCODER_GP12,
107
  SEQ_UI_ENCODER_GP13,
108
  SEQ_UI_ENCODER_GP14,
109
  SEQ_UI_ENCODER_GP15,
110
  SEQ_UI_ENCODER_GP16,
111
  SEQ_UI_ENCODER_Datawheel
112
} seq_ui_encoder_t;
113
 
114
 
240 tk 115
typedef enum {
116
  SEQ_UI_EDIT_MODE_NORMAL,
117
  SEQ_UI_EDIT_MODE_COPY,
118
  SEQ_UI_EDIT_MODE_PASTE,
119
  SEQ_UI_EDIT_MODE_CLEAR,
120
  SEQ_UI_EDIT_MODE_MOVE,
121
  SEQ_UI_EDIT_MODE_SCROLL,
122
  SEQ_UI_EDIT_MODE_RANDOM,
123
  SEQ_UI_EDIT_MODE_RECORD
124
} seq_ui_edit_mode_t;
168 tk 125
 
240 tk 126
 
134 tk 127
/////////////////////////////////////////////////////////////////////////////
128
// Prototypes
129
/////////////////////////////////////////////////////////////////////////////
130
 
131
extern s32 SEQ_UI_Init(u32 mode);
132
 
178 tk 133
extern s32 SEQ_UI_InitEncSpeed(u32 auto_config);
134
 
134 tk 135
extern s32 SEQ_UI_Button_Handler(u32 pin, u32 pin_value);
524 tk 136
extern s32 SEQ_UI_BLM_Button_Handler(u32 row, u32 pin, u32 pin_value);
134 tk 137
extern s32 SEQ_UI_Encoder_Handler(u32 encoder, s32 incrementer);
138
extern s32 SEQ_UI_LED_Handler(void);
139
extern s32 SEQ_UI_LED_Handler_Periodic();
184 tk 140
extern s32 SEQ_UI_LCD_Handler(void);
168 tk 141
extern s32 SEQ_UI_MENU_Handler_Periodic();
134 tk 142
 
167 tk 143
extern s32 SEQ_UI_PageSet(seq_ui_page_t page);
272 tk 144
extern char *SEQ_UI_PageNameGet(seq_ui_page_t page);
167 tk 145
 
146
extern s32 SEQ_UI_InstallInitCallback(void *callback);
168 tk 147
extern s32 SEQ_UI_InstallButtonCallback(void *callback);
148
extern s32 SEQ_UI_InstallEncoderCallback(void *callback);
149
extern s32 SEQ_UI_InstallLEDCallback(void *callback);
150
extern s32 SEQ_UI_InstallLCDCallback(void *callback);
167 tk 151
 
353 tk 152
extern s32 SEQ_UI_LCD_Update(void);
153
 
328 tk 154
extern s32 SEQ_UI_CheckSelections(void);
155
 
168 tk 156
extern u8  SEQ_UI_VisibleTrackGet(void);
178 tk 157
extern s32 SEQ_UI_IsSelectedTrack(u8 track);
158
 
240 tk 159
extern s32 SEQ_UI_SelectedStepSet(u8 step);
160
 
168 tk 161
extern s32 SEQ_UI_GxTyInc(s32 incrementer);
240 tk 162
extern s32 SEQ_UI_Var16_Inc(u16 *value, u16 min, u16 max, s32 incrementer);
163
extern s32 SEQ_UI_Var8_Inc(u8 *value, u16 min, u16 max, s32 incrementer);
248 tk 164
extern s32 SEQ_UI_CC_Inc(u8 cc, u8 min, u8 max, s32 incrementer);
165
extern s32 SEQ_UI_CC_Set(u8 cc, u8 value);
166
extern s32 SEQ_UI_CC_SetFlags(u8 cc, u8 flag_mask, u8 value);
134 tk 167
 
168
 
169
/////////////////////////////////////////////////////////////////////////////
240 tk 170
// Prototypes for functions implemented in seq_ui_*.c
171
/////////////////////////////////////////////////////////////////////////////
172
 
173
extern s32 SEQ_UI_EDIT_LCD_Handler(u8 high_prio, seq_ui_edit_mode_t edit_mode);
174
extern s32 SEQ_UI_EDIT_LED_Handler(u16 *gp_leds);
175
 
286 tk 176
extern s32 SEQ_UI_MENU_StopwatchInit(void);
177
extern s32 SEQ_UI_MENU_StopwatchReset(void);
178
extern s32 SEQ_UI_MENU_StopwatchCapture(void);
179
 
240 tk 180
extern s32 SEQ_UI_UTIL_CopyButton(s32 depressed);
181
extern s32 SEQ_UI_UTIL_PasteButton(s32 depressed);
182
extern s32 SEQ_UI_UTIL_ClearButton(s32 depressed);
183
extern s32 SEQ_UI_UTIL_UndoButton(s32 depressed);
184
 
280 tk 185
extern s32 SEQ_UI_MIXER_Copy(void);
186
extern s32 SEQ_UI_MIXER_Paste(void);
187
extern s32 SEQ_UI_MIXER_Clear(void);
188
extern s32 SEQ_UI_MIXER_Undo(u8 mixer_map);
189
extern s32 SEQ_UI_MIXER_UndoUpdate(void);
190
 
240 tk 191
extern s32 SEQ_UI_UTIL_UndoUpdate(u8 track);
192
 
193
extern u8 SEQ_UI_UTIL_CopyPasteBeginGet(void);
194
extern u8 SEQ_UI_UTIL_CopyPasteEndGet(void);
195
 
299 tk 196
extern s32 SEQ_UI_SDCardMsg(u16 delay, char *line1, char *line2);
197
extern s32 SEQ_UI_SDCardErrMsg(u16 delay, s32 status);
240 tk 198
 
299 tk 199
 
240 tk 200
/////////////////////////////////////////////////////////////////////////////
134 tk 201
// Export global variables
202
/////////////////////////////////////////////////////////////////////////////
203
 
159 tk 204
extern u8 seq_ui_display_update_req;
205
extern u8 seq_ui_display_init_req;
134 tk 206
 
167 tk 207
extern seq_ui_button_state_t seq_ui_button_state;
208
 
134 tk 209
extern u8 ui_selected_group;
484 tk 210
extern u16 ui_selected_tracks;
134 tk 211
extern u8 ui_selected_par_layer;
212
extern u8 ui_selected_trg_layer;
328 tk 213
extern u8 ui_selected_instrument;
134 tk 214
extern u8 ui_selected_step_view;
215
extern u8 ui_selected_step;
168 tk 216
extern u8 ui_selected_item;
134 tk 217
 
240 tk 218
extern u16 ui_hold_msg_ctr;
219
 
206 tk 220
extern seq_ui_page_t ui_page;
272 tk 221
extern seq_ui_page_t ui_selected_page;
303 tk 222
extern seq_ui_page_t ui_stepview_prev_page;
326 tk 223
extern seq_ui_page_t ui_trglayer_prev_page;
224
extern seq_ui_page_t ui_parlayer_prev_page;
206 tk 225
 
173 tk 226
extern volatile u8 ui_cursor_flash;
168 tk 227
 
316 tk 228
extern u8 ui_edit_name_cursor;
229
extern u8 ui_edit_preset_num_category;
230
extern u8 ui_edit_preset_num_label;
231
 
193 tk 232
extern u8 ui_seq_pause;
233
 
134 tk 234
#endif /* _SEQ_UI_H */