Subversion Repositories svn.mios

Rev

Rev 781 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 781 Rev 1201
Line 131... Line 131...
131
  for(input=0;input<16;input++)
131
  for(input=0;input<16;input++)
132
    outputs[input] = 0;
132
    outputs[input] = 0;
133
  for(input=0;input<16;input++){
133
  for(input=0;input<16;input++){
134
    for(bus=0;bus<16;bus++){
134
    for(bus=0;bus<16;bus++){
135
      for(input=0;input<16;input++){
135
      for(input=0;input<16;input++){
136
        if(current_preset[bus].inputs & int_bit_ormask[input])
136
        if(current_preset[bus].inputs & int_bit_ormask[input]){
137
          outputs[input] |= current_preset[bus].outputs;
137
          outputs[input] |= current_preset[bus].outputs;
-
 
138
        }
138
        }
139
      }
139
      }
140
    }
140
    }
141
  }
141
  for(input=0;input<16;input++){
142
  for(input=0;input<16;input++){
142
    i=0;
143
    i=0;
143
    for(output=0;output<16;output++)
144
    for(output=0;output<16;output++){
144
      if(outputs[input]&int_bit_ormask[output])
145
      if(outputs[input]&int_bit_ormask[output]){
145
        midi_inout_map[input][i++]=output;
146
        midi_inout_map[input][i++]=output;
-
 
147
      }
-
 
148
    }
146
    midi_inout_map[input][i] = 0xff;
149
    midi_inout_map[input][i] = 0xff;
147
    }
150
  }
148
  }
151
}
149
 
152
 
150
//-------------screen-------------------
153
//-------------screen-------------------
Line 152... Line 155...
152
void info_screen_print(unsigned char info_screen) __wparam{
155
void info_screen_print(unsigned char info_screen) __wparam{
153
  unsigned int values_set = 0;
156
  unsigned int values_set = 0;
154
  unsigned char bus;
157
  unsigned char bus;
155
  switch(info_screen){
158
  switch(info_screen){
156
    case 0://buses assigned to inputs?
159
    case 0://buses assigned to inputs?
157
      for(bus=0;bus<16;bus++)
160
      for(bus=0;bus<16;bus++){
158
        if(current_preset[bus].inputs && (temp_value==0xff || current_preset[bus].inputs & int_bit_ormask[temp_value]))
161
        if(current_preset[bus].inputs && (temp_value==0xff || current_preset[bus].inputs & int_bit_ormask[temp_value])){
159
          values_set |= int_bit_ormask[bus];
162
          values_set |= int_bit_ormask[bus];
-
 
163
        }
-
 
164
      }
160
      break;
165
      break;
161
    case 1://buses assigned to outputs?
166
    case 1://buses assigned to outputs?
162
      for(bus=0;bus<16;bus++)
167
      for(bus=0;bus<16;bus++){
163
        if(current_preset[bus].outputs && (temp_value==0xff || current_preset[bus].outputs & int_bit_ormask[temp_value]))
168
        if(current_preset[bus].outputs && (temp_value==0xff || current_preset[bus].outputs & int_bit_ormask[temp_value])){
164
          values_set |= int_bit_ormask[bus];
169
          values_set |= int_bit_ormask[bus];
-
 
170
        }
-
 
171
      }
165
      break;
172
      break;
166
    case 2://inputs assigned to buses?
173
    case 2://inputs assigned to buses?
167
      if(temp_value==0xff){//inputs of all buses
174
      if(temp_value==0xff){//inputs of all buses
168
        for(bus=0;bus<16;bus++)
175
        for(bus=0;bus<16;bus++){
169
          values_set |= current_preset[bus].inputs;
176
          values_set |= current_preset[bus].inputs;
170
        }
177
        }
-
 
178
      }
171
      else//only inputs of bus [temp_value]
179
      else{//only inputs of bus [temp_value]
172
        values_set = current_preset[temp_value].inputs;
180
        values_set = current_preset[temp_value].inputs;
-
 
181
      }
173
      break;
182
      break;
174
    case 3://inputs assigned to outputs?
183
    case 3://inputs assigned to outputs?
175
      for(bus=0;bus<16;bus++)
184
      for(bus=0;bus<16;bus++){
176
        if(current_preset[bus].outputs && (temp_value==0xff || current_preset[bus].outputs & int_bit_ormask[temp_value]))
185
        if(current_preset[bus].outputs && (temp_value==0xff || current_preset[bus].outputs & int_bit_ormask[temp_value])){
177
          values_set |= current_preset[bus].inputs;
186
          values_set |= current_preset[bus].inputs;
-
 
187
        }
-
 
188
      }
178
      break;
189
      break;
179
    case 4://outputs assigned to buses?
190
    case 4://outputs assigned to buses?
180
      if(temp_value==0xff){//outputs of all buses
191
      if(temp_value==0xff){//outputs of all buses
181
        for(bus=0;bus<16;bus++)
192
        for(bus=0;bus<16;bus++){
182
          values_set |= current_preset[bus].outputs;
193
          values_set |= current_preset[bus].outputs;
183
        }
194
        }
-
 
195
      }
184
      else//only outputs of bus [temp_value]
196
      else{//only outputs of bus [temp_value]
185
        values_set = current_preset[temp_value].outputs;
197
        values_set = current_preset[temp_value].outputs;
-
 
198
      }
186
      break;
199
      break;
187
    case 5://outputs assigned to inputs?
200
    case 5://outputs assigned to inputs?
188
      for(bus=0;bus<16;bus++)
201
      for(bus=0;bus<16;bus++){
189
        if(current_preset[bus].inputs && (temp_value==0xff || current_preset[bus].inputs & int_bit_ormask[temp_value]))
202
        if(current_preset[bus].inputs && (temp_value==0xff || current_preset[bus].inputs & int_bit_ormask[temp_value])){
190
          values_set |= current_preset[bus].outputs;
203
          values_set |= current_preset[bus].outputs;
-
 
204
        }
-
 
205
      }
191
      break;
206
      break;
192
    }
207
  }
193
  MIOS_DOUT_SRSet(0x01,(unsigned char)(values_set & 0x00ff));
208
  MIOS_DOUT_SRSet(0x01,(unsigned char)(values_set & 0x00ff));
194
  MIOS_DOUT_SRSet(0x02,(unsigned char)((values_set >>8) & 0x00ff));
209
  MIOS_DOUT_SRSet(0x02,(unsigned char)((values_set >>8) & 0x00ff));
195
  }
210
}
Line 238... Line 253...
238
        info_screen_print(5);
253
        info_screen_print(5);
239
      else{//regular output screen
254
      else{//regular output screen
240
        MIOS_DOUT_SRSet(0x01,(unsigned char)(current_preset[current_bus_num].outputs & 0x00ff));
255
        MIOS_DOUT_SRSet(0x01,(unsigned char)(current_preset[current_bus_num].outputs & 0x00ff));
241
        MIOS_DOUT_SRSet(0x02,(unsigned char)((current_preset[current_bus_num].outputs >>8) & 0x00ff));
256
        MIOS_DOUT_SRSet(0x02,(unsigned char)((current_preset[current_bus_num].outputs >>8) & 0x00ff));
242
        }
257
      }
-
 
258
      break;
243
    }
259
  }
244
  }
260
}
245
 
261
 
246
void current_screen_set(unsigned char value) __wparam{
262
void current_screen_set(unsigned char value) __wparam{
247
  current_screen_num = value;
263
  current_screen_num = value;
Line 292... Line 308...
292
  if(led_flash_led == 0xff){
308
  if(led_flash_led == 0xff){
293
    state = (state ? 0xff : 0x00);
309
    state = (state ? 0xff : 0x00);
294
    MIOS_DOUT_SRSet(0x01,state);
310
    MIOS_DOUT_SRSet(0x01,state);
295
    MIOS_DOUT_SRSet(0x02,state);
311
    MIOS_DOUT_SRSet(0x02,state);
296
    }
312
  }
297
  else
313
  else{
298
    MIOS_DOUT_PinSet(led_flash_led,state);
314
    MIOS_DOUT_PinSet(led_flash_led,state);
-
 
315
  }
299
  }
316
}
300
317
301
318
302
void Tick(void) __wparam{
319
void Tick(void) __wparam{
303
  unsigned char i;
320
  unsigned char i;
Line 307... Line 324...
307
    timed_function_stop();
324
    timed_function_stop();
308
    if(!current_screen_num){//screen is preset
325
    if(!current_screen_num){//screen is preset
309
      preset_init(0);
326
      preset_init(0);
310
      preset_store(0);
327
      preset_store(0);
311
      preset_init(1);
328
      preset_init(1);
312
      for(i=1;i<16;i++)
329
      for(i=1;i<16;i++){
313
        preset_store(i);
330
        preset_store(i);
-
 
331
      }
314
      current_preset_set(0);
332
      current_preset_set(0);
315
      current_bus_set(0);
333
      current_bus_set(0);
316
      inout_map_build();
334
      inout_map_build();
317
      led_flash_start(0xff,5,10);//flash 5 times
335
      led_flash_start(0xff,5,10);//flash 5 times
318
      }
336
    }
Line 350... Line 368...
350
          case 0://preset screen
368
        case 0://preset screen
351
            if (current_shift_state & MIOS_HLP_GetBitORMask(0)){
369
          if (current_shift_state & MIOS_HLP_GetBitORMask(0)){
352
              preset_store(current_preset_num);
370
            preset_store(current_preset_num);
353
              led_flash_start(current_preset_num+8,0,50);//LED off for half a second to indicate save
371
            led_flash_start(current_preset_num+8,0,50);//LED off for half a second to indicate save
354
              }
372
          }
355
            else
373
          else{
356
              current_preset_set(temp_value);
374
            current_preset_set(temp_value);
-
 
375
          }
357
            break;      
376
          break;      
358
          case 1://bus screen
377
        case 1://bus screen
359
            current_bus_set(temp_value);
378
          current_bus_set(temp_value);
360
            break;      
379
          break;      
361
          case 2://input screen
380
        case 2://input screen
Line 388... Line 407...
388
          }
407
      }
389
        }
408
    }
390
    }
409
  }
391
  else if(pin < 4){
410
  else if(pin < 4){
392
    temp_value = 0xff;
411
    temp_value = 0xff;
393
    if(pin_value)
412
    if(pin_value){
394
      current_shift_state &= ~MIOS_HLP_GetBitORMask(pin);//remove shift flag
413
      current_shift_state &= ~MIOS_HLP_GetBitORMask(pin);//remove shift flag
-
 
414
    }
395
    else{
415
    else{
396
      if(!current_shift_state){
416
      if(!current_shift_state){
397
        current_screen_set(pin);
417
        current_screen_set(pin);
398
        if(pin < 2)//start init request countdown
418
        if(pin < 2)//start init request countdown
399
          timed_function_start(1);
419
          timed_function_start(1);
Line 429... Line 449...
429
        fx_status = 0;
449
        fx_status = 0;
430
       }  
450
    }  
431
      }
451
  }
432
    else if(fx_status){
452
  else if(fx_status){
433
      MIOS_MIDI_TxBufferPut(byte);
453
    MIOS_MIDI_TxBufferPut(byte);
434
      if(fx_status!=0xff)
454
    if(fx_status!=0xff){
435
        fx_status--;
455
      fx_status--;
-
 
456
    }
436
     }
457
  }
437
   }
458
}
438
459
439
460
440
void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam{
461
void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam{
Line 443... Line 464...
443
  unsigned char in_chn = evnt0 & 0x0f;
464
  unsigned char in_chn = evnt0 & 0x0f;
444
  unsigned char evnt2_send = !(evnt_type == 0xc0 || evnt_type == 0xd0);
465
  unsigned char evnt2_send = !(evnt_type == 0xc0 || evnt_type == 0xd0);
445
  for(i=0;i<16 && midi_inout_map[in_chn][i]!=-1;i++){
466
  for(i=0;i<16 && midi_inout_map[in_chn][i]!=-1;i++){
446
    MIOS_MIDI_TxBufferPut(evnt_type+midi_inout_map[in_chn][i]);
467
    MIOS_MIDI_TxBufferPut(evnt_type+midi_inout_map[in_chn][i]);
447
    MIOS_MIDI_TxBufferPut(evnt1);
468
    MIOS_MIDI_TxBufferPut(evnt1);
448
    if(evnt2_send)
469
    if(evnt2_send){
449
      MIOS_MIDI_TxBufferPut(evnt2);
470
      MIOS_MIDI_TxBufferPut(evnt2);
-
 
471
    }
450
    }
472
  }
451
  }
473
}
452
474
453
475
454
476