Subversion Repositories svn.mios32

Rev

Rev 180 | Rev 193 | 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 184 2008-12-15 21:41:04Z 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!
184 tk 22
#define SEQ_UI_PAGES 11
167 tk 23
 
24
typedef enum {
25
  SEQ_UI_PAGE_NONE,
26
  SEQ_UI_PAGE_EDIT,
184 tk 27
  SEQ_UI_PAGE_MUTE,
28
  SEQ_UI_PAGE_PATTERN,
174 tk 29
  SEQ_UI_PAGE_TRKEVNT,
180 tk 30
  SEQ_UI_PAGE_TRKMODE,
173 tk 31
  SEQ_UI_PAGE_TRKDIR,
32
  SEQ_UI_PAGE_TRKDIV,
180 tk 33
  SEQ_UI_PAGE_TRKLEN,
34
  SEQ_UI_PAGE_TRKTRAN,
35
  SEQ_UI_PAGE_TRGASG
167 tk 36
} seq_ui_page_t;
37
 
38
 
39
// Prototypes for all UI pages are burried here
40
extern s32 SEQ_UI_TODO_Init(u32 mode);
41
extern s32 SEQ_UI_EDIT_Init(u32 mode);
184 tk 42
extern s32 SEQ_UI_MUTE_Init(u32 mode);
43
extern s32 SEQ_UI_PATTERN_Init(u32 mode);
174 tk 44
extern s32 SEQ_UI_TRKEVNT_Init(u32 mode);
180 tk 45
extern s32 SEQ_UI_TRKMODE_Init(u32 mode);
167 tk 46
extern s32 SEQ_UI_TRKDIR_Init(u32 mode);
173 tk 47
extern s32 SEQ_UI_TRKDIV_Init(u32 mode);
48
extern s32 SEQ_UI_TRKLEN_Init(u32 mode);
180 tk 49
extern s32 SEQ_UI_TRKTRAN_Init(u32 mode);
50
extern s32 SEQ_UI_TRGASG_Init(u32 mode);
167 tk 51
 
52
 
134 tk 53
/////////////////////////////////////////////////////////////////////////////
54
// Global definitions
55
/////////////////////////////////////////////////////////////////////////////
56
 
168 tk 57
// cursor flash with following waveform:
58
// 0..399 mS: cursor on
59
// 400..499 mS: cursor off
60
#define SEQ_UI_CURSOR_FLASH_CTR_MAX     500  // mS
61
#define SEQ_UI_CURSOR_FLASH_CTR_LED_OFF 400  // mS
134 tk 62
 
168 tk 63
 
134 tk 64
/////////////////////////////////////////////////////////////////////////////
65
// Global Types
66
/////////////////////////////////////////////////////////////////////////////
67
 
167 tk 68
typedef union {
69
  struct {
70
    unsigned ALL:8;
71
  };
72
  struct {
73
    unsigned MENU_PRESSED:1;
168 tk 74
    unsigned MENU_PAGE_DISPLAYED:1;
178 tk 75
    unsigned CHANGE_ALL_STEPS:1;
76
    unsigned CHANGE_ALL_STEPS_SAME_VALUE:1;
77
    unsigned FAST_ENCODERS:1;
78
    unsigned SOLO:1;
79
    unsigned METRONOME:1;
80
    unsigned SCRUB:1;
167 tk 81
  };
82
} seq_ui_button_state_t;
134 tk 83
 
167 tk 84
 
168 tk 85
typedef enum {
86
  SEQ_UI_BUTTON_GP1,
87
  SEQ_UI_BUTTON_GP2,
88
  SEQ_UI_BUTTON_GP3,
89
  SEQ_UI_BUTTON_GP4,
90
  SEQ_UI_BUTTON_GP5,
91
  SEQ_UI_BUTTON_GP6,
92
  SEQ_UI_BUTTON_GP7,
93
  SEQ_UI_BUTTON_GP8,
94
  SEQ_UI_BUTTON_GP9,
95
  SEQ_UI_BUTTON_GP10,
96
  SEQ_UI_BUTTON_GP11,
97
  SEQ_UI_BUTTON_GP12,
98
  SEQ_UI_BUTTON_GP13,
99
  SEQ_UI_BUTTON_GP14,
100
  SEQ_UI_BUTTON_GP15,
101
  SEQ_UI_BUTTON_GP16,
102
  SEQ_UI_BUTTON_Exit,
103
  SEQ_UI_BUTTON_Select,
104
  SEQ_UI_BUTTON_Left,
105
  SEQ_UI_BUTTON_Right,
106
  SEQ_UI_BUTTON_Up,
107
  SEQ_UI_BUTTON_Down
108
} seq_ui_button_t;
167 tk 109
 
168 tk 110
 
111
typedef enum {
112
  SEQ_UI_ENCODER_GP1,
113
  SEQ_UI_ENCODER_GP2,
114
  SEQ_UI_ENCODER_GP3,
115
  SEQ_UI_ENCODER_GP4,
116
  SEQ_UI_ENCODER_GP5,
117
  SEQ_UI_ENCODER_GP6,
118
  SEQ_UI_ENCODER_GP7,
119
  SEQ_UI_ENCODER_GP8,
120
  SEQ_UI_ENCODER_GP9,
121
  SEQ_UI_ENCODER_GP10,
122
  SEQ_UI_ENCODER_GP11,
123
  SEQ_UI_ENCODER_GP12,
124
  SEQ_UI_ENCODER_GP13,
125
  SEQ_UI_ENCODER_GP14,
126
  SEQ_UI_ENCODER_GP15,
127
  SEQ_UI_ENCODER_GP16,
128
  SEQ_UI_ENCODER_Datawheel
129
} seq_ui_encoder_t;
130
 
131
 
132
 
134 tk 133
/////////////////////////////////////////////////////////////////////////////
134
// Prototypes
135
/////////////////////////////////////////////////////////////////////////////
136
 
137
extern s32 SEQ_UI_Init(u32 mode);
138
 
178 tk 139
extern s32 SEQ_UI_InitEncSpeed(u32 auto_config);
140
 
134 tk 141
extern s32 SEQ_UI_Button_Handler(u32 pin, u32 pin_value);
142
extern s32 SEQ_UI_Encoder_Handler(u32 encoder, s32 incrementer);
143
extern s32 SEQ_UI_LED_Handler(void);
144
extern s32 SEQ_UI_LED_Handler_Periodic();
184 tk 145
extern s32 SEQ_UI_LCD_Handler(void);
168 tk 146
extern s32 SEQ_UI_MENU_Handler_Periodic();
134 tk 147
 
167 tk 148
extern s32 SEQ_UI_PageSet(seq_ui_page_t page);
149
 
150
extern s32 SEQ_UI_InstallInitCallback(void *callback);
168 tk 151
extern s32 SEQ_UI_InstallButtonCallback(void *callback);
152
extern s32 SEQ_UI_InstallEncoderCallback(void *callback);
153
extern s32 SEQ_UI_InstallLEDCallback(void *callback);
154
extern s32 SEQ_UI_InstallLCDCallback(void *callback);
167 tk 155
 
168 tk 156
extern u8  SEQ_UI_VisibleTrackGet(void);
178 tk 157
extern s32 SEQ_UI_IsSelectedTrack(u8 track);
158
 
168 tk 159
extern s32 SEQ_UI_GxTyInc(s32 incrementer);
179 tk 160
extern s32 SEQ_UI_CC_Inc(u8 cc, u16 min, u16 max, s32 incrementer);
161
extern s32 SEQ_UI_CC_Set(u8 cc, u16 value);
162
extern s32 SEQ_UI_CC_SetFlags(u8 cc, u16 flag_mask, u16 value);
134 tk 163
 
164
 
165
/////////////////////////////////////////////////////////////////////////////
166
// Export global variables
167
/////////////////////////////////////////////////////////////////////////////
168
 
159 tk 169
extern u8 seq_ui_display_update_req;
170
extern u8 seq_ui_display_init_req;
134 tk 171
 
167 tk 172
extern seq_ui_button_state_t seq_ui_button_state;
173
 
134 tk 174
extern u8 ui_selected_group;
175
extern u8 ui_selected_tracks;
176
extern u8 ui_selected_par_layer;
177
extern u8 ui_selected_trg_layer;
178
extern u8 ui_selected_step_view;
179
extern u8 ui_selected_step;
168 tk 180
extern u8 ui_selected_item;
134 tk 181
 
173 tk 182
extern volatile u8 ui_cursor_flash;
168 tk 183
 
134 tk 184
#endif /* _SEQ_UI_H */