Subversion Repositories svn.mios32

Rev

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