Subversion Repositories svn.mios32

Rev

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

Rev 2461 Rev 2531
Line 1... Line 1...
1
// $Id: app.c 2461 2016-12-19 21:37:44Z tk $
1
// $Id: app.c 2531 2017-10-11 22:55:38Z tk $
2
/*
2
/*
3
 * MIDIbox SEQ V4
3
 * MIDIbox SEQ V4
4
 *
4
 *
5
 * ==========================================================================
5
 * ==========================================================================
6
 *
6
 *
Line 25... Line 25...
25
#ifndef MBSEQV4L
25
#ifndef MBSEQV4L
26
#include <blm.h>
26
#include <blm.h>
27
#else
27
#else
28
#include <blm_cheapo.h>
28
#include <blm_cheapo.h>
29
#endif
29
#endif
30
#include <blm_x.h>
-
 
31
#include <blm_scalar_master.h>
30
#include <blm_scalar_master.h>
32
#include <ws2812.h>
31
#include <ws2812.h>
33
32
34
#include "tasks.h"
33
#include "tasks.h"
35
34
Line 39... Line 38...
39
38
40
#include "seq_hwcfg.h"
39
#include "seq_hwcfg.h"
41
40
42
#include "seq_core.h"
41
#include "seq_core.h"
43
#include "seq_led.h"
42
#include "seq_led.h"
-
 
43
#include "seq_blm8x8.h"
44
#include "seq_tpd.h"
44
#include "seq_tpd.h"
45
#include "seq_ui.h"
45
#include "seq_ui.h"
46
#include "seq_pattern.h"
46
#include "seq_pattern.h"
47
#include "seq_mixer.h"
47
#include "seq_mixer.h"
48
#include "seq_song.h"
48
#include "seq_song.h"
Line 117... Line 117...
117
#ifndef MBSEQV4L
117
#ifndef MBSEQV4L
118
  BLM_Init(0);
118
  BLM_Init(0);
119
#else
119
#else
120
  BLM_CHEAPO_Init(0);
120
  BLM_CHEAPO_Init(0);
121
#endif
121
#endif
122
  BLM_X_Init();
122
  SEQ_BLM8X8_Init(0);
123
123
124
  WS2812_Init(0);
124
  WS2812_Init(0);
125
125
126
  // initialize hardware soft-config
126
  // initialize hardware soft-config
127
  SEQ_HWCFG_Init(0);
127
  SEQ_HWCFG_Init(0);
Line 258... Line 258...
258
  BLM_CHEAPO_PrepareCol();
258
  BLM_CHEAPO_PrepareCol();
259
#endif
259
#endif
260
260
261
  if( seq_hwcfg_blm8x8.enabled ) {
261
  if( seq_hwcfg_blm8x8.enabled ) {
262
    // prepare DOUT registers of 8x8 BLM to drive the row
262
    // prepare DOUT registers of 8x8 BLM to drive the row
263
    BLM_X_PrepareRow();
263
    SEQ_BLM8X8_PrepareRow();
264
  }
264
  }
265
265
266
  // TK: using MIOS32_DOUT_SRSet/PinSet instead of SEQ_LED_SRSet/PinSet to ensure compatibility with MBSEQV4L
266
  // TK: using MIOS32_DOUT_SRSet/PinSet instead of SEQ_LED_SRSet/PinSet to ensure compatibility with MBSEQV4L
267
  if( seq_hwcfg_bpm_digits.enabled ) {
267
  if( seq_hwcfg_bpm_digits.enabled ) {
268
    // invert for common anodes
268
    // invert for common anodes
Line 357... Line 357...
357
  BLM_CHEAPO_GetRow();
357
  BLM_CHEAPO_GetRow();
358
#endif
358
#endif
359
359
360
  if( seq_hwcfg_blm8x8.enabled ) {
360
  if( seq_hwcfg_blm8x8.enabled ) {
361
    // call the BL_X_GetRow function after scan is finished to capture the read DIN values
361
    // call the BL_X_GetRow function after scan is finished to capture the read DIN values
362
    BLM_X_GetRow();
362
    SEQ_BLM8X8_GetRow();
363
  }
363
  }
364
}
364
}
365
365
366
366
367
/////////////////////////////////////////////////////////////////////////////
367
/////////////////////////////////////////////////////////////////////////////
Line 413... Line 413...
413
#endif
413
#endif
414
}
414
}
415
415
416
416
417
/////////////////////////////////////////////////////////////////////////////
417
/////////////////////////////////////////////////////////////////////////////
418
// This hook is called when a BLM_X button has been toggled
418
// This hook is called when a SEQ_BLM8X8 button has been toggled
419
// (see also SEQ_TASK_Period1mS)
419
// (see also SEQ_TASK_Period1mS)
420
// pin_value is 1 when button released, and 0 when button pressed
420
// pin_value is 1 when button released, and 0 when button pressed
421
/////////////////////////////////////////////////////////////////////////////
421
/////////////////////////////////////////////////////////////////////////////
422
void APP_BLM_X_NotifyToggle(u32 pin, u32 pin_value)
422
void APP_SEQ_BLM8X8_NotifyToggle(u8 blm, u32 pin, u32 pin_value)
423
{
423
{
424
  if( app_din_testmode ) {
424
  if( app_din_testmode ) {
425
    DEBUG_MSG("[DIN_TESTMODE] BLM8x8 Pin M%d D%d %s\n", (pin>>3)+1, pin&7, pin_value ? "depressed" : "pressed");
425
    DEBUG_MSG("[DIN_TESTMODE] BLM8x8%c Pin M%d D%d %s\n", 'A'+blm, (pin>>3)+1, pin&7, pin_value ? "depressed" : "pressed");
426
  }
426
  }
427
427
428
#ifndef MBSEQV4L
428
#ifndef MBSEQV4L
429
  SEQ_LCD_LOGO_ScreenSaver_Disable();
429
  SEQ_LCD_LOGO_ScreenSaver_Disable();
430
#endif
430
#endif
Line 502... Line 502...
502
  // -> BLM_CHEAPO driver
502
  // -> BLM_CHEAPO driver
503
  BLM_CHEAPO_ButtonHandler(APP_BLM_NotifyToggle);
503
  BLM_CHEAPO_ButtonHandler(APP_BLM_NotifyToggle);
504
#endif
504
#endif
505
505
506
  if( seq_hwcfg_blm8x8.enabled ) {
506
  if( seq_hwcfg_blm8x8.enabled ) {
507
    // check for BLM_X pin changes, call button handler of sequencer on each toggled pin
507
    // check for SEQ_BLM8X8 pin changes, call button handler of sequencer on each toggled pin
508
    BLM_X_BtnHandler(APP_BLM_X_NotifyToggle);
508
    SEQ_BLM8X8_ButtonHandler(APP_SEQ_BLM8X8_NotifyToggle);
509
  }
509
  }
510
#endif
510
#endif
511
}
511
}
512
512
513
513