uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
Functions | Variables
expression.c File Reference

Expression pedal implementation. More...

#include <stdbool.h>
#include <string.h>
#include <avr/eeprom.h>
#include "lib/adc.h"
#include "lib/leds.h"
#include "lib/math.h"
#include "lib/midi.h"
#include "lib/usb.h"
#include "config.h"
#include "expression.h"
Include dependency graph for expression.c:

Functions

static void send_enable_message (bool enable)
 Send a MIDI note on/off message. More...
 
bool exec_cal (const char *command)
 Handler for the serial command 'cal'. More...
 
bool exec_echo (const char *command)
 Handler for the serial command 'echo'. More...
 
bool exec_mute (const char *command)
 Handler for the serial command 'mute'. More...
 
void handle_enable_switch (void)
 A background task that handles the enable switch. More...
 
void init_expression_module (void)
 Initializes the expression module. More...
 
void trigger_expression_conversion (void)
 Triggers an ADC conversion of the expression pedal input. More...
 
void update_expression_value (uint16_t adc_value)
 Updates the stored expression value. More...
 

Variables

static uint8_t current_expression_value = 0
 The latest known expression value. More...
 
static bool echo = false
 Status variable for expression value console echo. More...
 
static bool switch_state = false
 
uint16_t adc_offset = 0
 
uint16_t adc_offset_eemem EEMEM
 
static uint8_t mute_enabled
 

Detailed Description

Expression pedal implementation.

Function Documentation

◆ exec_cal()

bool exec_cal ( const char *  command)

Handler for the serial command 'cal'.

◆ exec_echo()

bool exec_echo ( const char *  command)

Handler for the serial command 'echo'.

◆ exec_mute()

bool exec_mute ( const char *  command)

Handler for the serial command 'mute'.

◆ handle_enable_switch()

void handle_enable_switch ( void  )

A background task that handles the enable switch.

This task polls the enable switch input. If the input changed, a MIDI note on / off message is transmitted.

See also
MIDI_NOTE_ENABLE_WAH

◆ init_expression_module()

void init_expression_module ( void  )

Initializes the expression module.

Reads calibration values from EEPROM.

◆ send_enable_message()

static void send_enable_message ( bool  enable)
static

Send a MIDI note on/off message.

Parameters
enabletrue sends "note on"; false sends "note off"

◆ trigger_expression_conversion()

void trigger_expression_conversion ( void  )

Triggers an ADC conversion of the expression pedal input.

◆ update_expression_value()

void update_expression_value ( uint16_t  new_value)

Updates the stored expression value.

If the value changed, the new value is sent as a MIDI control change message for controller #69 (Waldorf Blofeld's F1 Cutoff).

Variable Documentation

◆ adc_offset

uint16_t adc_offset = 0

◆ current_expression_value

uint8_t current_expression_value = 0
static

The latest known expression value.

◆ echo

bool echo = false
static

Status variable for expression value console echo.

◆ EEMEM

uint8_t mute_enabled_eemem EEMEM

◆ mute_enabled

uint8_t mute_enabled
static

◆ switch_state

bool switch_state = false
static