Subversion Repositories svn.mios32

Rev

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