Subversion Repositories svn.mios32

Compare Revisions

Ignore whitespace Rev 2437 → Rev 2438

/trunk/apps/processing/midibox_cv_v2/src/components/MbCvEnvironment.cpp
775,6 → 775,27
 
 
/////////////////////////////////////////////////////////////////////////////
// to request current value of NRPN parameter (e.g. used by RGB LEDs)
// *value ranges from -1.0 to 1.0
// returns false if parameter not mapped
/////////////////////////////////////////////////////////////////////////////
bool MbCvEnvironment::getNRPNEffectiveValue(u16 nrpnNumber, float *value)
{
u16 select = nrpnNumber >> 10;
 
// channel access
if( select == 0xf ) {
return getGlobalNRPNEffectiveValue(nrpnNumber, value);
} else if( select < CV_SE_NUM ) { // direct channel selection
return mbCv[select].getNRPNEffectiveValue(nrpnNumber, value);
}
 
return false; // parameter not mapped
}
 
 
 
/////////////////////////////////////////////////////////////////////////////
// NRPNs
/////////////////////////////////////////////////////////////////////////////
 
1021,7 → 1042,17
return false; // parameter not mapped
}
 
/////////////////////////////////////////////////////////////////////////////
// to request current effective value of NRPN parameter (e.g. used by RGB LEDs)
// *value ranges from -1.0 to 1.0
// returns false if parameter not mapped
/////////////////////////////////////////////////////////////////////////////
bool MbCvEnvironment::getGlobalNRPNEffectiveValue(u16 nrpnNumber, float *value)
{
return false; // parameter not mapped
}
 
 
/////////////////////////////////////////////////////////////////////////////
// set/get knob values
/////////////////////////////////////////////////////////////////////////////
/trunk/apps/processing/midibox_cv_v2/src/components/MbCv.cpp
1157,6 → 1157,43
}
 
/////////////////////////////////////////////////////////////////////////////
// to request current effective value of NRPN parameter (e.g. used by RGB LEDs)
// *value ranges from -1.0 to 1.0
// returns false if parameter not mapped
/////////////////////////////////////////////////////////////////////////////
bool MbCv::getNRPNEffectiveValue(u16 nrpnNumber, float *value)
{
// quick hack to check if this makes sense...
if( (nrpnNumber & 0xf80) == 0x100 ) { // LFO1
*value = (float)mbCvLfo[0].lfoOut / 32768.0;
return true;
} else if( (nrpnNumber & 0xf80) == 0x180 ) { // LFO2
*value = (float)mbCvLfo[1].lfoOut / 32768.0;
return true;
} else if( (nrpnNumber & 0xf80) == 0x200 ) { // ENV1
*value = (float)mbCvEnv1[0].envOut / 32768.0;
return true;
} else if( (nrpnNumber & 0xf80) == 0x280 ) { // ENV2
*value = (float)mbCvEnv2[0].envOut / 32768.0;
return true;
} else if( (nrpnNumber & 0xff0) == 0x300 ) { // MOD1 Depth
*value = (float)mbCvMod.modOut[0] / 32768.0;
return true;
} else if( (nrpnNumber & 0xff0) == 0x310 ) { // MOD2 Depth
*value = (float)mbCvMod.modOut[1] / 32768.0;
return true;
} else if( (nrpnNumber & 0xff0) == 0x320 ) { // MOD3 Depth
*value = (float)mbCvMod.modOut[2] / 32768.0;
return true;
} else if( (nrpnNumber & 0xff0) == 0x330 ) { // MOD4 Depth
*value = (float)mbCvMod.modOut[3] / 32768.0;
return true;
}
 
return false; // parameter not mapped
}
 
/////////////////////////////////////////////////////////////////////////////
// returns NRPN informations depending on first 10 bits
// MSBs already decoded in MbCvEnvironment
// returns false if parameter not mapped
/trunk/apps/processing/midibox_cv_v2/src/components/MbCvEnvironment.h
116,11 → 116,15
bool setNRPN(u16 nrpnNumber, u16 value);
bool getNRPN(u16 nrpnNumber, u16 *value);
bool getNRPNInfo(u16 nrpnNumber, MbCvNrpnInfoT *info);
 
// to request current effective value of NRPN parameter (e.g. used by RGB LEDs)
bool getNRPNEffectiveValue(u16 nrpnNumber, float *value);
 
// global NRPNs
bool setGlobalNRPN(u16 nrpnNumber, u16 value);
bool getGlobalNRPN(u16 nrpnNumber, u16 *value);
bool getGlobalNRPNInfo(u16 nrpnNumber, MbCvNrpnInfoT *info);
bool getGlobalNRPNEffectiveValue(u16 nrpnNumber, float *value);
 
// set/get knob values
u8 getKnobValue(u8 knob);
/trunk/apps/processing/midibox_cv_v2/src/components/MbCv.h
92,6 → 92,9
bool getNRPN(u16 nrpnNumber, u16 *value);
bool getNRPNInfo(u16 nrpnNumber, MbCvNrpnInfoT *info);
 
// to request current effective value of NRPN parameter (e.g. used by RGB LEDs)
bool getNRPNEffectiveValue(u16 nrpnNumber, float *value);
 
};
 
#endif /* _MB_CV_H */
/trunk/apps/processing/midibox_cv_v2/src/mbcv_hwcfg.c
100,7 → 100,10
},
};
 
// will be initialized in MBCV_HWCFG_Init()
mbcv_hwcfg_ws2812_t mbcv_hwcfg_ws2812[MBCV_RGB_LED_NUM];
 
 
/////////////////////////////////////////////////////////////////////////////
// Initialisation
/////////////////////////////////////////////////////////////////////////////
121,5 → 124,14
MIOS32_ENC_ConfigSet(i, enc_config);
}
 
// clear all LED entries
{
mbcv_hwcfg_ws2812_t *ws2812 = &mbcv_hwcfg_ws2812[0];
for(i=0; i<MBCV_RGB_LED_NUM; ++i, ++ws2812) {
ws2812->pos = i;
ws2812->mode = MBCV_RGB_MODE_DISABLED;
}
}
 
return 0; // no error
}
/trunk/apps/processing/midibox_cv_v2/src/mbcv_hwcfg.h
16,6 → 16,7
 
#include <MbCvStructs.h>
#include "mbcv_lre.h"
#include "mbcv_rgb.h"
 
#ifdef __cplusplus
extern "C" {
56,7 → 57,12
u8 ledring_pattern_sr2;
} mbcv_hwcfg_lre_t;
 
typedef struct {
u8 pos;
mbcv_rgb_mode_t mode;
} mbcv_hwcfg_ws2812_t;
 
 
/////////////////////////////////////////////////////////////////////////////
// Prototypes
/////////////////////////////////////////////////////////////////////////////
71,6 → 77,7
extern mbcv_hwcfg_button_t mbcv_hwcfg_button;
extern mbcv_hwcfg_dout_t mbcv_hwcfg_dout;
extern mbcv_hwcfg_lre_t mbcv_hwcfg_lre[MBCV_LRE_NUM];
extern mbcv_hwcfg_ws2812_t mbcv_hwcfg_ws2812[MBCV_RGB_LED_NUM];
 
#ifdef __cplusplus
}
/trunk/apps/processing/midibox_cv_v2/src/scs_config.cpp
1402,7 → 1402,7
 
 
/////////////////////////////////////////////////////////////////////////////
// Access functions for MBCV_BUTTON
// Access functions for MBCV_BUTTON and MBCV_RGB
s32 SCS_CONFIG_CvSet(u8 cv)
{
selectedCv = cv;
1409,6 → 1409,11
return 0; // no error
}
 
u8 SCS_CONFIG_CvGet(void)
{
return selectedCv;
}
 
s32 SCS_CONFIG_LfoSet(u8 lfo)
{
selectedLfo = lfo;
/trunk/apps/processing/midibox_cv_v2/src/app.cpp
24,7 → 24,6
 
#include <file.h>
 
// include source of the SCS
#include <scs.h>
#include <scs_lcd.h>
#include "scs_config.h"
42,6 → 41,7
#include "mbcv_map.h"
#include "mbcv_button.h"
#include "mbcv_lre.h"
#include "mbcv_rgb.h"
#include "mbcv_file.h"
#include "mbcv_file_p.h"
#include "mbcv_file_b.h"
168,6 → 168,7
MBCV_PATCH_Init(0);
MBCV_BUTTON_Init(0);
MBCV_LRE_Init(0);
MBCV_RGB_Init(0);
UIP_TASK_Init(0);
 
SCS_Init(0);
425,8 → 426,9
// MIDI In/Out monitor
MIDI_PORT_Period1mS();
 
// LED rings
// LED rings and RGB LEDs
MBCV_LRE_UpdateAllLedRings();
MBCV_RGB_UpdateAllLeds();
 
// output and reset current stopwatch max value each second
if( MIOS32_TIMESTAMP_GetDelay(performance_print_timestamp) > 1000 ) {
/trunk/apps/processing/midibox_cv_v2/src/scs_config.h
31,11 → 31,11
extern s32 SCS_CONFIG_Init(u32 mode);
 
extern s32 SCS_CONFIG_CvSet(u8 cv);
extern u8 SCS_CONFIG_CvGet();
extern s32 SCS_CONFIG_LfoSet(u8 lfo);
extern s32 SCS_CONFIG_EnvSet(u8 env);
extern s32 SCS_CONFIG_ScopeSet(u8 scope);
 
 
/////////////////////////////////////////////////////////////////////////////
// Export global variables
/////////////////////////////////////////////////////////////////////////////
/trunk/apps/processing/midibox_cv_v2/src/mbcv_file_hw.cpp
345,6 → 345,10
enc_type = DETENTED2;
} else if( strcmp(word, "DETENTED3") == 0 ) {
enc_type = DETENTED3;
} else if( strcmp(word, "DETENTED4") == 0 ) {
enc_type = DETENTED4;
} else if( strcmp(word, "DETENTED5") == 0 ) {
enc_type = DETENTED5;
} else {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MBCV_FILE_HW] ERROR in LRE%d_ENC%s definition: invalid type '%s'!", lre+1, parameter, word);
426,6 → 430,55
 
 
////////////////////////////////////////////////////////////////////////////////////////////
// WS2812
////////////////////////////////////////////////////////////////////////////////////////////
} else if( strncmp(parameter, "WS2812", 6) == 0 ) {
parameter += 6;
if( strncmp(parameter, "_LED", 4) == 0 ) {
parameter += 4;
s32 led = get_dec(parameter);
if( led < 1 || led > MBCV_RGB_LED_NUM ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MBCV_FILE_HW] ERROR in WS2812_LED%s definition: expecting LED1..LED%d!", parameter, MBCV_RGB_LED_NUM);
#endif
continue;
}
--led; // counting from 0
 
char *word = strtok_r(NULL, separators, &brkt);
s32 pos = get_dec(word);
if( pos < 0 || pos > MBCV_RGB_LED_NUM ) {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MBCV_FILE_HW] ERROR in WS2812_LED%s definition: invalid position '%s'!", parameter, word);
#endif
continue;
}
 
word = strtok_r(NULL, separators, &brkt);
mbcv_rgb_mode_t mode = MBCV_RGB_MODE_DISABLED;
if( strcmp(word, "DISABLED") == 0 ) {
mode = MBCV_RGB_MODE_DISABLED;
} else if( strcmp(word, "CHANNEL_HUE") == 0 ) {
mode = MBCV_RGB_MODE_CHANNEL_HUE;
} else {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MBCV_FILE_HW] ERROR in WS2812%d_LED%s definition: invalid mode '%s'!", parameter, word);
#endif
continue;
}
 
mbcv_hwcfg_ws2812_t *ws2812 = &mbcv_hwcfg_ws2812[led];
ws2812->pos = pos;
ws2812->mode = mode;
 
} else {
#if DEBUG_VERBOSE_LEVEL >= 1
DEBUG_MSG("[MBCV_FILE_HW] ERROR unknown config 'WS2812_%s'!", parameter);
#endif
}
 
 
////////////////////////////////////////////////////////////////////////////////////////////
// DOUT assignments
////////////////////////////////////////////////////////////////////////////////////////////
} else if( strcmp(parameter, "GATE_CV_DOUT_SR") == 0 ) {
/trunk/apps/processing/midibox_cv_v2/src/mbcv_lre.cpp
22,6 → 22,7
#include <MbCvEnvironment.h>
 
#include "mbcv_lre.h"
#include "mbcv_rgb.h"
#include "mbcv_hwcfg.h"
 
 
754,6 → 755,7
u16 nrpnValue;
if( !env->getNRPN(e->nrpn, &nrpnValue) ) {
MBCV_LRE_UpdateLedRing(enc);
MBCV_RGB_UpdateLed(enc);
return 0; // no valid NRPN value mapped
}
 
789,6 → 791,7
}
 
MBCV_LRE_UpdateLedRing(enc);
MBCV_RGB_UpdateLed(enc);
 
return 0; // no error
}
/trunk/apps/processing/midibox_cv_v2/Makefile
23,6 → 23,7
src/mbcv_patch.cpp \
src/mbcv_map.cpp \
src/mbcv_lre.cpp \
src/mbcv_rgb.cpp \
src/mbcv_button.cpp \
src/mbcv_file.cpp \
src/mbcv_file_hw.cpp \
114,6 → 115,9
# AOUT Driver
include $(MIOS32_PATH)/modules/aout/aout.mk
 
# WS2812 RGB LED strip driver
include $(MIOS32_PATH)/modules/ws2812/ws2812.mk
 
# Notestack functions
include $(MIOS32_PATH)/modules/notestack/notestack.mk
 
/trunk/apps/processing/midibox_cv_v2/hwcfg/standard/MBCV_HW.CV2
78,7 → 78,7
# encoder assignments
# SR = 0: encoder disabled
# SR = 1..16: DIN assignment
# Types: NON_DETENTED, DETENTED1, DETENTED2, DETENTED3
# Types: NON_DETENTED, DETENTED1, DETENTED2, DETENTED3, DETENTED4, DETENTED5
 
# SR Pin Type
LRE1_ENC1 3 0 NON_DETENTED
/trunk/apps/processing/midibox_cv_v2/hwcfg/latigidon/MBCV_HW.CV2
New file
0,0 → 1,219
##################################################
# Setup File for MIDIbox CV V2 Standard Frontpanel
# $Id$
##################################################
 
 
##################################################
# AOUT interface
# Following interfaces are supported:
# o none
# o AOUT
# o AOUT_LC
# o AOUT_NG
# o MCP_Gx1
# o MCP_Gx2
##################################################
 
AOUT_IF AOUT_NG
 
 
##################################################
# Gate and Clock outputs
##################################################
 
# DOUT Shift Register number of the 8 CV gate outputs
# (1..16, 0 disables the outputs)
# - gate of CV1 will be available at output D7
# - gate of CV2 will be available at output D6
# - ...
# - gate of CV8 will be available at output D0
 
GATE_CV_DOUT_SR 3
 
 
# shift register number of the clock and start/stop signal (DIN Sync)
# (1..16, 0 disables the outputs)
# - start/stop will be available at output D7
# - clock1 will be available at output D6
# - clock2 will be available at output D5
# - ...
# - clock7 will be available at output D0
 
CLK_DOUT_SR 4
 
 
##################################################
# Optional LRE8x2 modules (encoders and LED rings)
# Up to two modules can be chained, makes up to
# 32 encoders and 32 LEDrings
##################################################
 
# enable first LRE module
# 0: disabled
# 1: enabled, and LEDring select lines are not inverted
# 2: enabled, and LEDring select lines are inverted (use this if a ULN2803 is mounted!)
LRE1_ENABLED 2
 
# first LRE8x2 module
LRE1_LEDRING_SELECT_DOUT_SR1 0
LRE1_LEDRING_SELECT_DOUT_SR2 0
LRE1_LEDRING_PATTERN_DOUT_SR1 0
LRE1_LEDRING_PATTERN_DOUT_SR2 0
 
 
# enable second LRE module
# 0: disabled
# 1: enabled, and LEDring select lines are not inverted
# 2: enabled, and LEDring select lines are inverted (use this if a ULN2803 is mounted!)
LRE2_ENABLED 2
 
# second LRE8x2 module
LRE2_LEDRING_SELECT_DOUT_SR1 0
LRE2_LEDRING_SELECT_DOUT_SR2 0
LRE2_LEDRING_PATTERN_DOUT_SR1 0
LRE2_LEDRING_PATTERN_DOUT_SR2 0
 
 
# encoder assignments
# SR = 0: encoder disabled
# SR = 1..16: DIN assignment
# Types: NON_DETENTED, DETENTED1, DETENTED2, DETENTED3, DETENTED4, DETENTED5
 
# SR Pin Type
LRE1_ENC1 1 1 DETENTED3
LRE1_ENC5 1 3 DETENTED3
LRE1_ENC9 1 5 DETENTED3
LRE1_ENC13 1 7 DETENTED3
LRE1_ENC2 2 1 DETENTED3
LRE1_ENC6 2 3 DETENTED3
LRE1_ENC10 2 5 DETENTED3
LRE1_ENC14 2 7 DETENTED3
LRE1_ENC3 3 1 DETENTED3
LRE1_ENC7 3 3 DETENTED3
LRE1_ENC11 3 5 DETENTED3
LRE1_ENC15 3 7 DETENTED3
LRE1_ENC4 4 1 DETENTED3
LRE1_ENC8 4 3 DETENTED3
LRE1_ENC12 4 5 DETENTED3
LRE1_ENC16 4 7 DETENTED3
 
# SR Pin Type
LRE2_ENC1 0 0 DETENTED3
LRE2_ENC2 0 0 DETENTED3
LRE2_ENC3 0 0 DETENTED3
LRE2_ENC4 0 0 DETENTED3
LRE2_ENC5 0 0 DETENTED3
LRE2_ENC6 0 0 DETENTED3
LRE2_ENC7 0 0 DETENTED3
LRE2_ENC8 0 0 DETENTED3
LRE2_ENC9 0 0 DETENTED3
LRE2_ENC10 0 0 DETENTED3
LRE2_ENC11 0 0 DETENTED3
LRE2_ENC12 0 0 DETENTED3
LRE2_ENC13 0 0 DETENTED3
LRE2_ENC14 0 0 DETENTED3
LRE2_ENC15 0 0 DETENTED3
LRE2_ENC16 0 0 DETENTED3
 
 
##################################################
# Optional WS2812B based RGB LEDs as replacement
# for the LED rings
#
# Supported functions:
# DISABLED: LED always off
# CHANNEL_HUE: Hue controlled by channel number
##################################################
 
# Pos Function
WS2812_LED1 1 CHANNEL_HUE
WS2812_LED2 8 CHANNEL_HUE
WS2812_LED3 9 CHANNEL_HUE
WS2812_LED4 16 CHANNEL_HUE
WS2812_LED5 2 CHANNEL_HUE
WS2812_LED6 7 CHANNEL_HUE
WS2812_LED7 10 CHANNEL_HUE
WS2812_LED8 15 CHANNEL_HUE
WS2812_LED9 3 CHANNEL_HUE
WS2812_LED10 6 CHANNEL_HUE
WS2812_LED11 11 CHANNEL_HUE
WS2812_LED12 14 CHANNEL_HUE
WS2812_LED13 4 CHANNEL_HUE
WS2812_LED14 5 CHANNEL_HUE
WS2812_LED15 12 CHANNEL_HUE
WS2812_LED16 13 CHANNEL_HUE
 
# Pos Function
WS2812_LED17 0 CHANNEL_HUE
WS2812_LED18 0 CHANNEL_HUE
WS2812_LED19 0 CHANNEL_HUE
WS2812_LED20 0 CHANNEL_HUE
WS2812_LED21 0 CHANNEL_HUE
WS2812_LED22 0 CHANNEL_HUE
WS2812_LED23 0 CHANNEL_HUE
WS2812_LED24 0 CHANNEL_HUE
WS2812_LED25 0 CHANNEL_HUE
WS2812_LED26 0 CHANNEL_HUE
WS2812_LED27 0 CHANNEL_HUE
WS2812_LED28 0 CHANNEL_HUE
WS2812_LED29 0 CHANNEL_HUE
WS2812_LED30 0 CHANNEL_HUE
WS2812_LED31 0 CHANNEL_HUE
WS2812_LED32 0 CHANNEL_HUE
 
 
##################################################
# Button assignments to DIN pins
# SR = 0: Button disabled
# SR = 1..16: directly triggered from DIN pin
##################################################
 
# select CV channel
# SR Pin
BUTTON_CV1 0 0
BUTTON_CV2 0 0
BUTTON_CV3 0 0
BUTTON_CV4 0 0
BUTTON_CV5 0 0
BUTTON_CV6 0 0
BUTTON_CV7 0 0
BUTTON_CV8 0 0
 
# select (LRE) encoder bank
# SR Pin
BUTTON_ENCBANK1 0 0
BUTTON_ENCBANK2 0 0
BUTTON_ENCBANK3 0 0
BUTTON_ENCBANK4 0 0
BUTTON_ENCBANK5 0 0
BUTTON_ENCBANK6 0 0
BUTTON_ENCBANK7 0 0
BUTTON_ENCBANK8 0 0
 
# These button functions combine both: CV channel and LRE ENC bank selected
# Means: each CV channel has it's own encoder bank
# SR Pin
BUTTON_CV_AND_ENCBANK1 0 0
BUTTON_CV_AND_ENCBANK2 0 0
BUTTON_CV_AND_ENCBANK3 0 0
BUTTON_CV_AND_ENCBANK4 0 0
BUTTON_CV_AND_ENCBANK5 0 0
BUTTON_CV_AND_ENCBANK6 0 0
BUTTON_CV_AND_ENCBANK7 0 0
BUTTON_CV_AND_ENCBANK8 0 0
 
# SR Pin
BUTTON_LFO1 0 0
BUTTON_LFO2 0 0
BUTTON_ENV1 0 0
BUTTON_ENV2 0 0
 
# SR Pin
BUTTON_SCOPE1 0 0
BUTTON_SCOPE2 0 0
BUTTON_SCOPE3 0 0
BUTTON_SCOPE4 0 0
 
 
# more button functions are available on request
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property