Subversion Repositories svn.mios32

Rev

Rev 168 | Rev 174 | 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 173 2008-12-09 22:45:19Z 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!
173 tk 22
#define SEQ_UI_PAGES 5
167 tk 23
 
24
typedef enum {
25
  SEQ_UI_PAGE_NONE,
26
  SEQ_UI_PAGE_EDIT,
173 tk 27
  SEQ_UI_PAGE_TRKDIR,
28
  SEQ_UI_PAGE_TRKDIV,
29
  SEQ_UI_PAGE_TRKLEN
167 tk 30
} seq_ui_page_t;
31
 
32
 
33
// Prototypes for all UI pages are burried here
34
extern s32 SEQ_UI_TODO_Init(u32 mode);
35
extern s32 SEQ_UI_EDIT_Init(u32 mode);
36
extern s32 SEQ_UI_TRKDIR_Init(u32 mode);
173 tk 37
extern s32 SEQ_UI_TRKDIV_Init(u32 mode);
38
extern s32 SEQ_UI_TRKLEN_Init(u32 mode);
167 tk 39
 
40
 
134 tk 41
/////////////////////////////////////////////////////////////////////////////
42
// Global definitions
43
/////////////////////////////////////////////////////////////////////////////
44
 
168 tk 45
// cursor flash with following waveform:
46
// 0..399 mS: cursor on
47
// 400..499 mS: cursor off
48
#define SEQ_UI_CURSOR_FLASH_CTR_MAX     500  // mS
49
#define SEQ_UI_CURSOR_FLASH_CTR_LED_OFF 400  // mS
134 tk 50
 
168 tk 51
 
134 tk 52
/////////////////////////////////////////////////////////////////////////////
53
// Global Types
54
/////////////////////////////////////////////////////////////////////////////
55
 
167 tk 56
typedef union {
57
  struct {
58
    unsigned ALL:8;
59
  };
60
  struct {
61
    unsigned MENU_PRESSED:1;
168 tk 62
    unsigned MENU_PAGE_DISPLAYED: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
 
114
 
134 tk 115
/////////////////////////////////////////////////////////////////////////////
116
// Prototypes
117
/////////////////////////////////////////////////////////////////////////////
118
 
119
extern s32 SEQ_UI_Init(u32 mode);
120
 
121
extern s32 SEQ_UI_Button_Handler(u32 pin, u32 pin_value);
122
extern s32 SEQ_UI_Encoder_Handler(u32 encoder, s32 incrementer);
123
extern s32 SEQ_UI_LED_Handler(void);
124
extern s32 SEQ_UI_LED_Handler_Periodic();
168 tk 125
extern s32 SEQ_UI_MENU_Handler_Periodic();
134 tk 126
 
167 tk 127
extern s32 SEQ_UI_PageSet(seq_ui_page_t page);
128
 
129
extern s32 SEQ_UI_InstallInitCallback(void *callback);
168 tk 130
extern s32 SEQ_UI_InstallButtonCallback(void *callback);
131
extern s32 SEQ_UI_InstallEncoderCallback(void *callback);
132
extern s32 SEQ_UI_InstallLEDCallback(void *callback);
133
extern s32 SEQ_UI_InstallLCDCallback(void *callback);
167 tk 134
 
168 tk 135
extern u8  SEQ_UI_VisibleTrackGet(void);
136
extern s32 SEQ_UI_GxTyInc(s32 incrementer);
137
extern s32 SEQ_UI_CCInc(u8 cc, u16 min, u16 max, s32 incrementer);
173 tk 138
extern s32 SEQ_UI_CCSetFlags(u8 cc, u16 flag_mask, u16 value);
134 tk 139
 
140
 
141
/////////////////////////////////////////////////////////////////////////////
142
// Export global variables
143
/////////////////////////////////////////////////////////////////////////////
144
 
159 tk 145
extern u8 seq_ui_display_update_req;
146
extern u8 seq_ui_display_init_req;
134 tk 147
 
167 tk 148
extern seq_ui_button_state_t seq_ui_button_state;
149
 
134 tk 150
extern u8 ui_selected_group;
151
extern u8 ui_selected_tracks;
152
extern u8 ui_selected_par_layer;
153
extern u8 ui_selected_trg_layer;
154
extern u8 ui_selected_step_view;
155
extern u8 ui_selected_step;
168 tk 156
extern u8 ui_selected_item;
134 tk 157
 
173 tk 158
extern volatile u8 ui_cursor_flash;
168 tk 159
 
134 tk 160
#endif /* _SEQ_UI_H */