ELEC2645 (2015/16) / Mbed 2 deprecated Main_code_ver18

Dependencies:   FATFileSystem N5110_mod SDFileSystem USBDevice mbed

Embed: (wiki syntax)

« Back to documentation index

main.h File Reference

main.h File Reference

Header file containing functions prototypes, defines, and global variables. More...

Go to the source code of this file.

Data Structures

struct  buttons_struct
 # Flags, maps & variables More...

Namespaces

namespace  keyMap
 

indicates name of button pressed


namespace  ButtonOut_val
 

used to map the button presses on to the boolean flags


namespace  ButtonOut_pos
 

stores the current position of the ButtonOut scan, in order to select the correct value for the output from the ButtonOut_val array


namespace  Button_init
 

# Functions


namespace  Button_scan_ISR
 

function called by Button_scan_tkr


namespace  Button_update
 

Used to update the boolean flags within Buttons_struct.


namespace  shift_LED
 

LED above the shift button on the PCB.


namespace  LED_buffer
 

# Flags, maps & variables


namespace  LED_pos
 

stores the current position of the LED_bus scan, in order to select the correct value for the output from the LED_buffer array


namespace  LED_write
 

updates the values within LED_buffer to those required for the current output


namespace  Sequence_struct
 

generates the variables requred for a sequence


namespace  drawMenu
 

draws menu to LCD, and returns selected value


namespace  drawVariable
 

draws variable to LCD


namespace  bool_to_int
 

converts boolean array to integer


namespace  selector
 

selects value between 0 and 7 based on step button press


Functions

BusOut ButtonOut (PTE26, PTE25, PTD3, PTC8)
 # IO & interrupts
InterruptIn ButtonIn_A (PTB11)
 interrupt pins connected to button matrix outputs
void Button_init ()
 initialises button matrix
void Button_scan_ISR ()
void Button_update (int row)
void ButtonIn_A_ISR ()
 interrupt subroutines for ButtonIn_* input
void ButtonIn_B_ISR ()
void ButtonIn_C_ISR ()
void ButtonIn_D_ISR ()
void ButtonIn_E_ISR ()
BusOut LED_bus (PTC0, PTC9, PTC5, PTC7, PTC2, PTA2, PTB23, PTA1)
 # IO & interrupts
void LED_scan_ISR ()
 # LED functions
void LED_write (uint16_t value)
 Matrix refresh routine.
void LED_init ()
 initialises LEDs
N5110 lcd (PTE26, PTA0, PTC4, PTD0, PTD2, PTD1, PTC3)
 # IO
void LCD_init ()
 # LCD functions
void LCD_set ()
 function to set brightness and PWM frequency values
void LCD_printMain ()
 function to print main screen to display
void Sequence_init ()
 # Sequence functions
void Sequence_write ()
 writes input data to sequence gate
void Sequence_increment_ISR ()
 interrupt call for sequence increment
void Sequence_increment ()
 increments sequencer
InterruptIn tempo_tapIn (PTB9)
 interrupt for tap tempo button
void tempo_init ()
 # functions
void tempo_ISR ()
 interrupt called by tap tempo input
void tempo_set ()
 tempo set routine
void tempo_update ()
 Indicates tempo to be updated (used when tempo is set via menu)
void Audio_init ()
 map to indicate positions of RAW WAV files on SD card
void Audio_ISR ()
 updates speaker output
void USB_init ()
 # functions
void decay_ISR ()
 called by decay ticker
void audio_tkr_ISR ()
 # USB audio functions
void mainMenu_draw ()
 # functions
void editMenu_draw ()
 function to control edit menu navigation
int drawMenu (const char *array[])
 draws single level menu on screen
void drawVariable (const char *variableName, float *variable, float step_size, float max, float min, void(*function)())
SDFileSystem sd (PTE3, PTE1, PTE2, PTE4,"sd")
 # IO
void load ()
 # Functions
void save ()
 saves current sequence data to SD card
AnalogOut SOUND_OUT_1 (DAC0_OUT)
 # IO
void init ()
 trigger channels
void IO_init ()
 initialises general IO
int bool_to_int (bool *array, int shifter)
void selector (bool *flag, int *variable)
void check_flags ()
 checks interrupt flags

Variables

Ticker Button_scan_tkr
 ticker to rotate ButtonOut bus
bool ButtonFlag_zero = 0
 used to indicate if any button has been pressed
bool ButtonFlag_cols [4] = {0,0,0,0}
 used to indicate if the input on the column during the last scan was equal to zero
Ticker LED_scan_tkr
 ticker used to scan through the LED matrix values
float brightness = 0.32
 # LCD variables
float PWM_freq = 50
 current backlight PWM frequency
bool inverse = false
 boolean to keep track of screen colour inversion
char * inst_names []
 # Sequence data
Ticker Sequence_increment_tkr
 # Sequence IO & interrupts
int Seq_current_inst = 0
 # flags & variables
int Seq_current_seq = 0
 currently selected sequence
int Seq_prev_inst = 0
 previously selected instrument channel (used when skip button is pressed)
int Seq_current_step = 15
 current sequence step
volatile int Seq_flag = 0
 flag to indicate step increment
float tempo = 60
 current tempo value
bool running = 1
 flag to indicate if the sequence is currently running
bool inst_flag = 0
 indicates whether system is waiting for instrument channel selection
bool pattern_flag = 0
 indicates whether system is waiting for sequence pattern selection
bool skip_flag = 0
 indicates whether in skip setup mode
Timer tempo_time
 # IO & interrupts
volatile int tempo_flag
 # flags & variables
int tempo_timerState
 indicates how many times tap tempo button has been pressed
float tempo_debounce = 0
 keeps track of button bounces
volatile int tempo_update_flag = 0
 indicates that tempo has been changed
char * audio_buffer [8]
 # flags & variables
int USB_mode = 3
 # flags & variables
volatile int decay_flag = 0
 indicates whether the output needs clearing
USBMIDI * midi = 0
 # IO & interrupts
USBSerial * pc = 0
 pointer to serial function
USBAudio * audio = 0
 pointer to audio function
Ticker decay_tkr
 ticker for note decay
Ticker audio_tkr
 # flags & variables
int16_t USBaudio_buffer [96/2]
 buffer to contain incoming audio packets
volatile bool USBaudio_packet_available = false
 indicates availability of audio data
int USBaudio_index_buffer = 0
 indicates current position within USBaudio_buffer
uint16_t audio_prev_val = 0
 maintains previous speaker value until more data is available
const char * mainMenu []
 # Menu maps
const char * displayMenu []
 map for display submenu
const char * usbMenu []
 map for USB mode submenu
const char * outputMenu []
 map for output mode submenu
const char * editMenu []
 map for edit menu

Detailed Description

Header file containing functions prototypes, defines, and global variables.

K64F drum machine project, for ELEC2645

Author:
Peter J.G. Nye
Date:
May 2016

Definition in file main.h.