├── front ├── LxrAvr_bootloader │ ├── default │ │ ├── SD_Card.eep │ │ └── makedep.mk │ ├── SD_main.c │ ├── lcd │ │ ├── lcd.c │ │ └── lcd.h │ ├── FileParser.c │ ├── UART_routines.h │ ├── SD_Bootloader.atsuo │ ├── config.h │ ├── SPI_routines.h │ ├── userInterface.c │ ├── userInterface.h │ ├── README.md │ ├── SD_Bootloader.atsln │ ├── SPI_routines.c │ ├── elmChan │ │ ├── integer.h │ │ └── diskio.h │ ├── FileParser.h │ ├── dout.h │ ├── Bootloader │ │ └── BootloaderCommands.h │ ├── SD_Bootloader.aws │ ├── sd_routines.h │ ├── UART_routines.c │ └── dout.c └── LxrAvr │ ├── DrumSynthFront.atsuo │ ├── Preset │ ├── PresetManager.h │ └── SeqStep.h │ ├── Menu │ ├── screensaver.h │ ├── CcNr2Text.h │ └── copyClearTools.h │ ├── config.h │ ├── IO │ ├── adcPots.h │ ├── uart.h │ ├── dout.h │ ├── din.h │ ├── dout.c │ ├── adcPots.c │ └── din.c │ ├── Hardware │ ├── timebase.h │ ├── SD │ │ ├── integer.h │ │ ├── SPI_routines.h │ │ ├── SPI_routines.c │ │ ├── diskio.h │ │ └── sd_routines.h │ └── timebase.c │ ├── README.md │ ├── front.h │ ├── .project │ ├── DrumSynthFront.atsln │ ├── fifo.h │ ├── fifo.c │ ├── encoder.h │ └── ledHandler.h ├── mod_targ_lineup.xls ├── firmware image └── FIRMWARE.BIN ├── tools ├── bin │ ├── FirmwareImageBuilder.exe │ └── makeFirmware.bat └── FirmwareImageBuilder │ ├── Release │ └── FirmwareImageBuilder.exe │ ├── FirmwareImageBuilder │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h │ ├── FirmwareImageBuilder.sln │ └── Makefile ├── mainboard ├── LxrStm32 │ ├── src │ │ ├── Hardware │ │ │ ├── FIFO.h │ │ │ ├── SD_FAT │ │ │ │ ├── integer.h │ │ │ │ ├── diskio.h │ │ │ │ └── sd_routines.h │ │ │ └── USB │ │ │ │ └── usb_manager.h │ │ ├── stm32f4xx_it.h │ │ ├── stm32f4xx_conf.h │ │ ├── SampleRom │ │ │ ├── SampleMemory.h │ │ │ └── SampleMemory.c │ │ ├── stm32f4xx_it.c │ │ ├── DSPAudio │ │ │ ├── Samples.h │ │ │ ├── random.h │ │ │ ├── squareRootLut.h │ │ │ ├── snapEg.h │ │ │ ├── Decay.h │ │ │ ├── random.c │ │ │ ├── mixer.h │ │ │ ├── automationNode.h │ │ │ ├── wavetable.h │ │ │ ├── distortion.c │ │ │ ├── distortion.h │ │ │ ├── snapEg.c │ │ │ ├── 1PoleLp.h │ │ │ └── dither.c │ │ ├── datatypes.h │ │ ├── globals.h │ │ ├── Sequencer │ │ │ ├── SomData.h │ │ │ ├── SomGenerator.h │ │ │ ├── EuklidGenerator.h │ │ │ └── clockSync.h │ │ ├── AudioCodecManager │ │ │ ├── AudioCodecManager.h │ │ │ └── AudioCodecManager.c │ │ ├── hardfault.S │ │ └── MIDI │ │ │ ├── frontPanelParser.h │ │ │ ├── Uart.h │ │ │ └── valueShaper.h │ ├── Libraries │ │ ├── Device │ │ │ └── STM32F4xx │ │ │ │ └── Include │ │ │ │ ├── stm32f4xx.h │ │ │ │ └── system_stm32f4xx.h │ │ ├── CMSIS │ │ │ └── CMSIS END USER LICENCE AGREEMENT.pdf │ │ ├── STM32_USB_Device_Library │ │ │ └── Core │ │ │ │ └── inc │ │ │ │ ├── usbd_conf.h │ │ │ │ ├── usbd_req.h │ │ │ │ └── usbd_core.h │ │ ├── STM32F4xx_StdPeriph_Driver │ │ │ └── inc │ │ │ │ └── stm32f4xx_crc.h │ │ └── STM32_USB_OTG_Driver │ │ │ └── inc │ │ │ ├── usb_otg.h │ │ │ └── usb_bsp.h │ └── .project └── LxrStm32_bootloader │ ├── src │ ├── FIFO.h │ ├── stm32f4xx_it.h │ ├── stm32f4xx_it.c │ ├── stm32f4xx_conf.h │ ├── globals.h │ └── uart.h │ ├── Libraries │ ├── Device │ │ └── STM32F4xx │ │ │ └── Include │ │ │ ├── stm32f4xx.h │ │ │ └── system_stm32f4xx.h │ ├── CMSIS │ │ └── CMSIS END USER LICENCE AGREEMENT.pdf │ └── STM32F4xx_StdPeriph_Driver │ │ └── inc │ │ └── stm32f4xx_crc.h │ └── Release │ ├── objects.mk │ ├── sources.mk │ ├── Libraries │ └── STM32F4-Discovery │ │ └── subdir.mk │ ├── src │ └── subdir.mk │ └── makefile ├── .gitignore ├── linux_build_guide.txt ├── LICENSE.txt └── Makefile /front/LxrAvr_bootloader/default/SD_Card.eep: -------------------------------------------------------------------------------- 1 | :04000005008002373E 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /mod_targ_lineup.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/mod_targ_lineup.xls -------------------------------------------------------------------------------- /firmware image/FIRMWARE.BIN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/firmware image/FIRMWARE.BIN -------------------------------------------------------------------------------- /front/LxrAvr/DrumSynthFront.atsuo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/front/LxrAvr/DrumSynthFront.atsuo -------------------------------------------------------------------------------- /front/LxrAvr/Preset/PresetManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/front/LxrAvr/Preset/PresetManager.h -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/SD_main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/front/LxrAvr_bootloader/SD_main.c -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/lcd/lcd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/front/LxrAvr_bootloader/lcd/lcd.c -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/lcd/lcd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/front/LxrAvr_bootloader/lcd/lcd.h -------------------------------------------------------------------------------- /tools/bin/FirmwareImageBuilder.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/tools/bin/FirmwareImageBuilder.exe -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/FileParser.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/front/LxrAvr_bootloader/FileParser.c -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/UART_routines.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/front/LxrAvr_bootloader/UART_routines.h -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/Hardware/FIFO.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/mainboard/LxrStm32/src/Hardware/FIFO.h -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/src/FIFO.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/mainboard/LxrStm32_bootloader/src/FIFO.h -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/SD_Bootloader.atsuo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/front/LxrAvr_bootloader/SD_Bootloader.atsuo -------------------------------------------------------------------------------- /tools/FirmwareImageBuilder/Release/FirmwareImageBuilder.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/tools/FirmwareImageBuilder/Release/FirmwareImageBuilder.exe -------------------------------------------------------------------------------- /mainboard/LxrStm32/Libraries/Device/STM32F4xx/Include/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/mainboard/LxrStm32/Libraries/Device/STM32F4xx/Include/stm32f4xx.h -------------------------------------------------------------------------------- /mainboard/LxrStm32/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/mainboard/LxrStm32/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/Libraries/Device/STM32F4xx/Include/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/mainboard/LxrStm32_bootloader/Libraries/Device/STM32F4xx/Include/stm32f4xx.h -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brendanclarke/LXR/HEAD/mainboard/LxrStm32_bootloader/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/Release/objects.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | USER_OBJS := 6 | 7 | LIBS := 8 | 9 | -------------------------------------------------------------------------------- /tools/bin/makeFirmware.bat: -------------------------------------------------------------------------------- 1 | del "..\..\firmware image\old_FIRMWARE.BIN" 2>nul 2 | ren "..\..\firmware image\FIRMWARE.BIN" old_FIRMWARE.BIN 2>nul 3 | firmwareimagebuilder ..\..\mainboard\firmware\DrumSynth_FPU\Release\DrumSynth_FPU.bin ..\..\front\AVR\Release\DrumSynthAvr.bin "..\..\firmware image\FIRMWARE.BIN" 4 | pause 5 | -------------------------------------------------------------------------------- /front/LxrAvr/Menu/screensaver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * screensaver.h 3 | * 4 | * Created: 25.01.2013 17:07:52 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #ifndef SCREENSAVER_H_ 10 | #define SCREENSAVER_H_ 11 | 12 | 13 | void screensaver_touch(); 14 | void screensaver_check(); 15 | 16 | extern volatile uint16_t screensaver_timer; 17 | 18 | #endif /* SCREENSAVER_H_ */ -------------------------------------------------------------------------------- /tools/FirmwareImageBuilder/FirmwareImageBuilder/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // FirmwareImageBuilder.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /tools/FirmwareImageBuilder/FirmwareImageBuilder/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | 14 | 15 | // TODO: reference additional headers your program requires here 16 | -------------------------------------------------------------------------------- /front/LxrAvr/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * config.h 3 | * 4 | * Created: 23.10.2012 10:15:14 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #ifndef CONFIG_H_ 10 | #define CONFIG_H_ 11 | 12 | #define USE_SD_CARD 1 //set to "1" if the SD reader is connected to the AVR, "0" if the cortex uses it 13 | #define USE_DRUM_MAP_GENERATOR 0 14 | 15 | 16 | #define UART_DEBUG_ECHO_MODE 0 17 | #define DEBUG_CRASH_MODE 0 18 | 19 | #endif /* CONFIG_H_ */ -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * config.h 3 | * 4 | * Created: 07.07.2012 11:38:44 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #ifndef CONFIG_H_ 10 | #define CONFIG_H_ 11 | 12 | #include "./lcd/lcd.h" 13 | 14 | #include "./elmChan/ff.h" 15 | extern FIL firmwareFile; /* place to hold 1 file*/ 16 | 17 | #define CORTEX_RESET_PIN PD7 18 | #define CORTEX_RESET_PORT PORTD 19 | #define CORTEX_RESET_DDR DDRD 20 | 21 | #endif /* CONFIG_H_ */ -------------------------------------------------------------------------------- /front/LxrAvr/IO/adcPots.h: -------------------------------------------------------------------------------- 1 | /* 2 | * adcPots.h 3 | * 4 | * Created: 27.04.2012 15:51:29 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #ifndef ADCPOTS_H_ 10 | #define ADCPOTS_H_ 11 | 12 | #include 13 | 14 | void adc_init(void); 15 | 16 | uint16_t adc_read( uint8_t channel ); 17 | uint16_t adc_readAvg( uint8_t channel, uint8_t nsamples ); 18 | //check the connected potentiometers and parse their values 19 | void adc_checkPots(); 20 | 21 | 22 | 23 | #endif /* ADCPOTS_H_ */ -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/SPI_routines.h: -------------------------------------------------------------------------------- 1 | #ifndef _SPI_ROUTINES_H_ 2 | #define _SPI_ROUTINES_H_ 3 | 4 | #define SPI_SD SPCR = (1< 13 | #include 14 | #include "../Menu/screensaver.h" 15 | 16 | extern volatile uint16_t time_sysTick; /**< system time in 16,384 ms steps*/ 17 | 18 | /** this timer is the main timebase for the program. 19 | it measures ticks since program start*/ 20 | void time_initTimer(); 21 | 22 | 23 | 24 | 25 | 26 | #endif /* TIMEBASE_H_ */ 27 | -------------------------------------------------------------------------------- /front/LxrAvr/README.md: -------------------------------------------------------------------------------- 1 | Drumsynth Frontpanel Firmware 2 | ============================= 3 | 4 | Copyright Julian Schmidt 2013 5 | 013 6 | 7 | 8 | 9 | 10 | The sourcecode is provided as AVR Studio 5.0 project. 11 | 12 | 13 | Some 3rd party libs were used in this project: 14 | 15 | The FAT filesystem used is FatFs by ELM ChaN 16 | http://elm-chan.org/fsw/ff/00index_e.html 17 | 18 | The SD and SPI routines are based on a demo project from 19 | CC Dharmani, Chennai (India) 20 | www.dharmanitech.com 21 | http://www.dharmanitech.com/2009/01/sd-card-interfacing-with-atmega8-fat32.html 22 | 23 | thanks a lot! 24 | 25 | -------------------------------------------------------------------------------- /front/LxrAvr/front.h: -------------------------------------------------------------------------------- 1 | /* 2 | * front.h 3 | * 4 | * Created on: Nov 4, 2013 5 | * Author: anshak 6 | */ 7 | 8 | #ifndef FRONT_H_ 9 | #define FRONT_H_ 10 | 11 | //js does not work with latest GCC 12 | #define DISABLE_CONV_WARNING _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wconversion\"") 13 | #define DISABLE_SIGN_WARNING _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wsign-conversion\"") 14 | #define END_DISABLE_WARNING _Pragma("GCC diagnostic pop") 15 | #define END_DISABLE_CONV_WARNING END_DISABLE_WARNING 16 | 17 | 18 | #endif /* FRONT_H_ */ 19 | -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/userInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * userInterface.h 3 | * 4 | * Created: 08.07.2012 16:06:40 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #ifndef USERINTERFACE_H_ 10 | #define USERINTERFACE_H_ 11 | #include 12 | 13 | #define SIGNAL_LED PD2 //start stop button led 14 | #define SIGNAL_LED_PORT PORTD 15 | #define SIGNAL_LED_DDR DDRD 16 | 17 | #define SIGNAL_BUTTON PC2 //encoder button 18 | #define SIGNAL_BUTTON_PORT PORTC 19 | #define SIGNAL_BUTTON_DDR DDRC 20 | 21 | #define ENCODER_BUTTON (PINC & (1< 12 | 13 | /** a copy of the step struct from the sequencer.h file from the cortex src 14 | used to load step data from sequencer and write it to the pattern preset*/ 15 | typedef struct StepStruct 16 | { 17 | //uint8_t active; // bit 0: on/off 18 | uint8_t volume; // 0-127 volume -> 0x7f => lower 7 bit, upper bit => active 19 | uint8_t prob; //step probability 20 | uint8_t note; 21 | 22 | //parameter automation 23 | uint8_t param1Nr; 24 | uint8_t param1Val; 25 | 26 | uint8_t param2Nr; 27 | uint8_t param2Val; 28 | 29 | }StepData; 30 | 31 | 32 | 33 | 34 | #endif /* SEQSTEP_H_ */ -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/SD_Bootloader.atsln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # AvrStudio Solution File, Format Version 11.00 4 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "SD_Bootloader", "SD_Bootloader.cproj", "{733935F3-60B5-4DFF-A64F-FBE17A9EBAE1}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | default|AVR = default|AVR 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {733935F3-60B5-4DFF-A64F-FBE17A9EBAE1}.default|AVR.ActiveCfg = default|AVR 12 | {733935F3-60B5-4DFF-A64F-FBE17A9EBAE1}.default|AVR.Build.0 = default|AVR 13 | EndGlobalSection 14 | GlobalSection(SolutionProperties) = preSolution 15 | HideSolutionNode = FALSE 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/SPI_routines.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "SPI_routines.h" 3 | 4 | //SPI initialize for SD card 5 | void spi_init(void) 6 | { 7 | 8 | //init port 9 | DDRB |= (1< 14 | #include 15 | 16 | #include "../fifo.h" 17 | 18 | 19 | 20 | //------------------------------------------- 21 | #define ACK 1 22 | #define NACK -1 23 | //------------------------------------------- 24 | #define ACK 1 25 | #define NACK -1 26 | //------------------------------------------- 27 | 28 | 29 | void uart_init(); 30 | uint8_t uart_putc(unsigned char c); 31 | void uart_puts (char *s); 32 | uint8_t uart_getc(uint8_t *data); 33 | 34 | //waits for a ACK message on the uart 35 | uint8_t uart_waitAck(); 36 | //check if there is some data received an parse it 37 | void uart_checkAndParse(); 38 | 39 | 40 | #endif /* UART_H_ */ 41 | -------------------------------------------------------------------------------- /front/LxrAvr/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | AVR 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 25 | 26 | 27 | -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/src/stm32f4xx_it.c: -------------------------------------------------------------------------------- 1 | 2 | /* Includes ------------------------------------------------------------------*/ 3 | #include "stm32f4xx_it.h" 4 | #include "globals.h" 5 | 6 | 7 | // time since system start 8 | volatile uint32_t systick_ticks=0; 9 | 10 | 11 | void NMI_Handler(void) 12 | { 13 | } 14 | 15 | 16 | void HardFault_Handler(void) 17 | { 18 | while (1) 19 | { 20 | } 21 | } 22 | 23 | void MemManage_Handler(void) 24 | { 25 | while (1) 26 | { 27 | } 28 | } 29 | 30 | void BusFault_Handler(void) 31 | { 32 | while (1) 33 | { 34 | } 35 | } 36 | 37 | void UsageFault_Handler(void) 38 | { 39 | while (1) 40 | { 41 | } 42 | } 43 | 44 | void SVC_Handler(void) 45 | { 46 | } 47 | 48 | void DebugMon_Handler(void) 49 | { 50 | } 51 | 52 | void PendSV_Handler(void) 53 | { 54 | } 55 | 56 | void SysTick_Handler(void) 57 | { 58 | systick_ticks++; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LxrStm32 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 25 | 26 | 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.d 4 | *.lst 5 | 6 | # Libraries 7 | *.lib 8 | *.a 9 | 10 | # Shared objects (inc. Windows DLLs) 11 | *.dll 12 | *.so 13 | *.so.* 14 | *.dylib 15 | 16 | # Executables 17 | *.exe 18 | !FirmwareImageBuilder.exe 19 | *.out 20 | *.app 21 | 22 | #except this tool 23 | !tools/bin/FirmwareImageBuilder.exe 24 | 25 | # binaries 26 | *.hex 27 | *.elf 28 | *.bin 29 | *.lss 30 | 31 | !firmware image/FIRMWARE.BIN 32 | 33 | #eclipse staging areas 34 | mainboard/firmware/DrumSynth_FPU/Debug/ 35 | mainboard/firmware/DrumSynth_FPU/Release/ 36 | front/AVR/Debug/ 37 | front/AVR/Release/ 38 | 39 | # miscellaneous eclipse etc 40 | *.metadata 41 | *RemoteSystemsTempFiles 42 | *.settings 43 | *.bak 44 | *.svn 45 | *.map 46 | *.html 47 | *.rar 48 | *.zip 49 | 50 | # visual studio stuff 51 | *.pdb 52 | *.ncb 53 | *.suo 54 | *.ilk 55 | *.manifest 56 | *.obj 57 | *.pch 58 | *.idb 59 | *.user 60 | *.res 61 | *.dep 62 | *.htm 63 | -------------------------------------------------------------------------------- /front/LxrAvr/DrumSynthFront.atsln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # AvrStudio Solution File, Format Version 11.00 4 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "DrumSynthFront", "DrumSynthFront.cproj", "{2793F1E7-A992-4B77-938E-B0EB2E8F6389}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|AVR = Debug|AVR 9 | Release|AVR = Release|AVR 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {2793F1E7-A992-4B77-938E-B0EB2E8F6389}.Debug|AVR.ActiveCfg = Debug|AVR 13 | {2793F1E7-A992-4B77-938E-B0EB2E8F6389}.Debug|AVR.Build.0 = Debug|AVR 14 | {2793F1E7-A992-4B77-938E-B0EB2E8F6389}.Release|AVR.ActiveCfg = Release|AVR 15 | {2793F1E7-A992-4B77-938E-B0EB2E8F6389}.Release|AVR.Build.0 = Release|AVR 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /front/LxrAvr/Menu/CcNr2Text.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CcNr2Text.h 3 | * 4 | * Created: 16.02.2013 13:57:05 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #ifndef CCNR2TEXT_H_ 10 | #define CCNR2TEXT_H_ 11 | 12 | #include "menu.h" 13 | 14 | //typedef struct Cc2NameStruct 15 | //{ 16 | // uint8_t voiceNr; // 1-6 => 0x6 = 0b110 17 | // uint8_t nameIdx;// 18 | //} Cc2Name; 19 | 20 | // initialize the above array 21 | void paramToModTargetInit(); 22 | 23 | // return the total number of mod targets that exist (all voices) 24 | uint8_t getNumModTargets(); 25 | 26 | // returns 1 based index or 0 for invalid 27 | uint8_t voiceFromModTargValue(uint8_t val); 28 | 29 | // returns an index into modTargets based on a 0 based voice # and an index into modtarget gaps array 30 | uint8_t getModTargetIdxFromGapIdx(uint8_t v, uint8_t gapidx); 31 | 32 | // return an index into mod target gap array given an index into modTargets 33 | uint8_t getModTargetGapIndex(uint8_t modTargetIdx); 34 | 35 | #endif /* CCNR2TEXT_H_ */ 36 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/stm32f4xx_conf.h: -------------------------------------------------------------------------------- 1 | #ifndef __STM32F4xx_CONF_H 2 | #define __STM32F4xx_CONF_H 3 | 4 | 5 | #include "stm32f4xx_adc.h" 6 | //#include "stm32f4xx_can.h" 7 | //#include "stm32f4xx_crc.h" 8 | //#include "stm32f4xx_cryp.h" 9 | #include "stm32f4xx_dac.h" 10 | #include "stm32f4xx_dbgmcu.h" 11 | #include "stm32f4xx_dcmi.h" 12 | #include "stm32f4xx_dma.h" 13 | #include "stm32f4xx_exti.h" 14 | #include "stm32f4xx_flash.h" 15 | #include "stm32f4xx_fsmc.h" 16 | //#include "stm32f4xx_hash.h" 17 | #include "stm32f4xx_gpio.h" 18 | //#include "stm32f4xx_i2c.h" 19 | #include "stm32f4xx_iwdg.h" 20 | #include "stm32f4xx_pwr.h" 21 | #include "stm32f4xx_rcc.h" 22 | #include "stm32f4xx_rng.h" 23 | #include "stm32f4xx_rtc.h" 24 | #include "stm32f4xx_sdio.h" 25 | #include "stm32f4xx_spi.h" 26 | #include "stm32f4xx_syscfg.h" 27 | #include "stm32f4xx_tim.h" 28 | #include "stm32f4xx_usart.h" 29 | #include "stm32f4xx_wwdg.h" 30 | #include "misc.h" 31 | 32 | #define assert_param(expr) ((void)0) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/src/stm32f4xx_conf.h: -------------------------------------------------------------------------------- 1 | #ifndef __STM32F4xx_CONF_H 2 | #define __STM32F4xx_CONF_H 3 | 4 | #include "stm32f4xx_adc.h" 5 | #include "stm32f4xx_can.h" 6 | #include "stm32f4xx_crc.h" 7 | #include "stm32f4xx_cryp.h" 8 | #include "stm32f4xx_dac.h" 9 | #include "stm32f4xx_dbgmcu.h" 10 | #include "stm32f4xx_dcmi.h" 11 | #include "stm32f4xx_dma.h" 12 | #include "stm32f4xx_exti.h" 13 | #include "stm32f4xx_flash.h" 14 | #include "stm32f4xx_fsmc.h" 15 | #include "stm32f4xx_hash.h" 16 | #include "stm32f4xx_gpio.h" 17 | #include "stm32f4xx_i2c.h" 18 | #include "stm32f4xx_iwdg.h" 19 | #include "stm32f4xx_pwr.h" 20 | #include "stm32f4xx_rcc.h" 21 | #include "stm32f4xx_rng.h" 22 | #include "stm32f4xx_rtc.h" 23 | #include "stm32f4xx_sdio.h" 24 | #include "stm32f4xx_spi.h" 25 | #include "stm32f4xx_syscfg.h" 26 | #include "stm32f4xx_tim.h" 27 | #include "stm32f4xx_usart.h" 28 | #include "stm32f4xx_wwdg.h" 29 | #include "misc.h" 30 | 31 | #define assert_param(expr) ((void)0) 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /front/LxrAvr/Hardware/SD/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _INTEGER 6 | #define _INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* These types must be 16-bit, 32-bit or larger integer */ 16 | typedef int INT; 17 | typedef unsigned int UINT; 18 | 19 | /* These types must be 8-bit integer */ 20 | typedef char CHAR; 21 | typedef unsigned char UCHAR; 22 | typedef unsigned char BYTE; 23 | 24 | /* These types must be 16-bit integer */ 25 | typedef short SHORT; 26 | typedef unsigned short USHORT; 27 | typedef unsigned short WORD; 28 | typedef unsigned short WCHAR; 29 | 30 | /* These types must be 32-bit integer */ 31 | typedef long LONG; 32 | typedef unsigned long ULONG; 33 | typedef unsigned long DWORD; 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/elmChan/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _INTEGER 6 | #define _INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* These types must be 16-bit, 32-bit or larger integer */ 16 | typedef int INT; 17 | typedef unsigned int UINT; 18 | 19 | /* These types must be 8-bit integer */ 20 | typedef char CHAR; 21 | typedef unsigned char UCHAR; 22 | typedef unsigned char BYTE; 23 | 24 | /* These types must be 16-bit integer */ 25 | typedef short SHORT; 26 | typedef unsigned short USHORT; 27 | typedef unsigned short WORD; 28 | typedef unsigned short WCHAR; 29 | 30 | /* These types must be 32-bit integer */ 31 | typedef long LONG; 32 | typedef unsigned long ULONG; 33 | typedef unsigned long DWORD; 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /tools/FirmwareImageBuilder/FirmwareImageBuilder.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FirmwareImageBuilder", "FirmwareImageBuilder\FirmwareImageBuilder.vcproj", "{6A06E9AD-C3BB-4E56-B2B0-DA0A8472E275}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {6A06E9AD-C3BB-4E56-B2B0-DA0A8472E275}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {6A06E9AD-C3BB-4E56-B2B0-DA0A8472E275}.Debug|Win32.Build.0 = Debug|Win32 14 | {6A06E9AD-C3BB-4E56-B2B0-DA0A8472E275}.Release|Win32.ActiveCfg = Release|Win32 15 | {6A06E9AD-C3BB-4E56-B2B0-DA0A8472E275}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /front/LxrAvr/Hardware/SD/SPI_routines.h: -------------------------------------------------------------------------------- 1 | //************************************************************** 2 | // ****** FUNCTIONS FOR SPI COMMUNICATION ******* 3 | //************************************************************** 4 | //Controller: ATmega32 (Clock: 8 Mhz-internal) 5 | //Compiler : AVR-GCC (winAVR with AVRStudio) 6 | //Project V.: Version - 2.4.1 7 | //Author : CC Dharmani, Chennai (India) 8 | // www.dharmanitech.com 9 | //Date : 24 Apr 2011 10 | //************************************************************** 11 | 12 | #ifndef _SPI_ROUTINES_H_ 13 | #define _SPI_ROUTINES_H_ 14 | 15 | #define SPI_SD SPCR = (1< 13 | #include "UART_routines.h" 14 | #include "config.h" 15 | 16 | /************************************************************************/ 17 | /* a firmware file consists of 3 elements 18 | 1) a info header 19 | 2) the AVR firmware 20 | 3) the cortex firmware 21 | 22 | the AVR and Cortex firmware needs to be zero padded for full sektor reads (512 bytes)*/ 23 | /************************************************************************/ 24 | 25 | struct InfoHeader 26 | { 27 | char headerId[4]; // should be SPFI (Sonic Potions Firmware Image) 28 | uint16_t avrCodeSize; // in byte 29 | uint32_t cortexCodeSize; //in byte 30 | }; 31 | 32 | uint8_t fileParser_parseNextBlock(unsigned long filesize); 33 | void fileParser_resetCortex(); 34 | 35 | #endif /* FILEPARSER_H_ */ -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/Hardware/SD_FAT/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _INTEGER 6 | #define _INTEGER 7 | #include "config.h" 8 | #if USE_SD_CARD 9 | #ifdef _WIN32 /* FatFs development platform */ 10 | 11 | #include 12 | #include 13 | 14 | #else /* Embedded platform */ 15 | 16 | /* These types must be 16-bit, 32-bit or larger integer */ 17 | typedef int INT; 18 | typedef unsigned int UINT; 19 | 20 | /* These types must be 8-bit integer */ 21 | typedef char CHAR; 22 | typedef unsigned char UCHAR; 23 | typedef unsigned char BYTE; 24 | 25 | /* These types must be 16-bit integer */ 26 | typedef short SHORT; 27 | typedef unsigned short USHORT; 28 | typedef unsigned short WORD; 29 | typedef unsigned short WCHAR; 30 | 31 | /* These types must be 32-bit integer */ 32 | typedef long LONG; 33 | typedef unsigned long ULONG; 34 | typedef unsigned long DWORD; 35 | 36 | #endif 37 | 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /front/LxrAvr/fifo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fifo.h 3 | * 4 | * Created: 25.04.2012 13:44:53 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #ifndef FIFO_H_ 10 | #define FIFO_H_ 11 | 12 | #include 13 | #include 14 | 15 | #define BUFFER_SIZE 256 //must be power of 2!!! (8, 16, 32, 64 ...) 16 | #define BUFFER_MASK (BUFFER_SIZE-1) 17 | //---------------------------------------------------------------------------- 18 | typedef struct FifoStruct { 19 | volatile uint8_t data[BUFFER_SIZE]; 20 | volatile uint8_t read; 21 | volatile uint8_t write; 22 | } FifoBuffer; 23 | //---------------------------------------------------------------------------- 24 | void fifo_init(FifoBuffer* fifo); 25 | //---------------------------------------------------------------------------- 26 | uint8_t fifo_bufferIn(FifoBuffer* fifo, uint8_t byte); 27 | //---------------------------------------------------------------------------- 28 | uint8_t fifo_BufferOut(FifoBuffer* fifo, uint8_t *pByte); 29 | //---------------------------------------------------------------------------- 30 | 31 | #endif /* FIFO_H_ */ -------------------------------------------------------------------------------- /front/LxrAvr/fifo.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fifo.c 3 | * 4 | * Created: 26.04.2012 16:57:26 5 | * Author: Julian 6 | */ 7 | #include "fifo.h" 8 | 9 | //---------------------------------------------------------------------------- 10 | void fifo_init(FifoBuffer* fifo) 11 | { 12 | memset((void*)fifo->data,0,BUFFER_SIZE); 13 | fifo->read = 0; 14 | fifo->write = 0; 15 | } 16 | //---------------------------------------------------------------------------- 17 | uint8_t fifo_bufferIn(FifoBuffer* fifo, uint8_t byte) 18 | { 19 | uint8_t next = (uint8_t)((fifo->write + 1) & BUFFER_MASK); 20 | if (fifo->read == next) 21 | return 0; 22 | fifo->data[fifo->write] = byte; 23 | fifo->write = next; 24 | return 1; 25 | } 26 | //---------------------------------------------------------------------------- 27 | uint8_t fifo_BufferOut(FifoBuffer* fifo, uint8_t *pByte) 28 | { 29 | if (fifo->read == fifo->write) 30 | return 0; 31 | *pByte = fifo->data[fifo->read]; 32 | fifo->read = (uint8_t)((fifo->read+1) & BUFFER_MASK); 33 | return 1; 34 | } 35 | //---------------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /front/LxrAvr/IO/dout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dout.h 3 | * 4 | * Created: 25.04.2012 15:19:43 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #ifndef DOUT_H_ 10 | #define DOUT_H_ 11 | 12 | #include 13 | 14 | //number of connected outputs 15 | #define NUM_OUTS 40 16 | 17 | //outputs 18 | #define DOUT_LOAD_PIN (1< 13 | 14 | //number of connected outputs 15 | #define NUM_OUTS 40 16 | 17 | //outputs 18 | #define DOUT_LOAD_PIN (1< 13 | 14 | //copy/clear mode helpers 15 | enum 16 | { 17 | MODE_NONE, 18 | MODE_CLEAR, 19 | MODE_COPY_PATTERN, 20 | MODE_COPY_TRACK, 21 | }; 22 | 23 | //clear targets 24 | enum 25 | { 26 | CLEAR_TRACK, 27 | CLEAR_PATTERN, 28 | CLEAR_AUTOMATION1, 29 | CLEAR_AUTOMATION2, 30 | }; 31 | extern uint8_t copyClear_Mode; 32 | 33 | void copyClear_executeClear(); 34 | void copyClear_clearCurrentTrack(); 35 | void copyClear_clearCurrentPattern(); 36 | void copyClear_copyTrack(); 37 | void copyClear_copyPattern(); 38 | uint8_t copyClear_getClearTarget(); 39 | uint8_t copyClear_isClearModeActive(); 40 | void copyClear_setClearTarget(uint8_t mode); 41 | void copyClear_armClearMenu(uint8_t isShown); 42 | 43 | uint8_t copyClear_srcSet(); 44 | void copyClear_setSrc(int8_t src, uint8_t type); 45 | void copyClear_setDst(int8_t dst, uint8_t type); 46 | 47 | void copyClear_reset(); 48 | 49 | 50 | #endif /* COPYCLEARTOOLS_H_ */ -------------------------------------------------------------------------------- /tools/FirmwareImageBuilder/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Makefile for LXR FirmwareImageBuilder tool 4 | # Author: Patrick Dowling 5 | # 6 | # Uses default CXX to compile 7 | # 8 | ############################################################################### 9 | 10 | ############################################################################### 11 | # OPTIONS 12 | EXE ?= ../bin/FirmwareImageBuilder 13 | 14 | # if VERBOSE is defined, spam output 15 | ifdef VERBOSE 16 | AT := 17 | ECHO := @true 18 | else 19 | AT := @ 20 | ECHO := @echo 21 | endif 22 | 23 | ############################################################################### 24 | # SOURCE FILES 25 | SRCDIR=./FirmwareImageBuilder 26 | 27 | ############################################################################### 28 | # SETUP 29 | 30 | .PHONY: all 31 | all: 32 | @echo "Valid targets are" 33 | @echo " clean : clean build directory" 34 | @echo " exe : build FirmwareImageBuilder tool" 35 | 36 | .PHONY: exe 37 | exe: $(EXE) 38 | 39 | $(EXE): $(SRCDIR)/FirmwareImageBuilder.cpp 40 | $(ECHO) "Compiling $@..." 41 | $(AT)$(CXX) $(CFLAGS) $(SRCDIR)/FirmwareImageBuilder.cpp -o $@ 42 | 43 | .PHONY: clean 44 | clean: 45 | $(AT)$(RM) $(EXE) 46 | -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/Bootloader/BootloaderCommands.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BootloaderCommands.h 3 | * 4 | * Created: 07.07.2012 21:42:54 5 | * Author: Julian Schmidt 6 | */ 7 | 8 | 9 | #ifndef BOOTLOADERCOMMANDS_H_ 10 | #define BOOTLOADERCOMMANDS_H_ 11 | 12 | 13 | /** send to the bootloader after reset to tell it to get ready for the new firmware. 14 | * if no INIT_BOOTLOADER message is received the bootloader will start the normal program and not update the firmware. 15 | * The bootloader sends ACK back to tell the host it is ready 16 | */ 17 | #define INIT_BOOTLOADER 1 18 | 19 | /** after the write data cmd is received 20 | * we expect a 4 byte message with unsigned int 32 bit data. 1st byte is MSB 4th byte is LSB 21 | */ 22 | #define WRITE_DATA 2 23 | 24 | /** set the address for the next received data block. 25 | we expect a 4 byte message with unsigned int 32 bit address 26 | the next received WRITE_DATA block will be written to this address 27 | */ 28 | #define WRITE_ADDRESS 3 29 | 30 | /** send by the bootloadr to the host to confirm a received message*/ 31 | #define ACK 4 32 | #define NACK 5 33 | 34 | /** signal end of transmission and end bootloader -> start application */ 35 | #define END_BOOTLOADER 6 36 | 37 | 38 | #endif /* BOOTLOADERCOMMANDS_H_ */ 39 | -------------------------------------------------------------------------------- /front/LxrAvr/Hardware/timebase.c: -------------------------------------------------------------------------------- 1 | #include "timebase.h" 2 | 3 | /* 4 | * timebase.c 5 | * 6 | * Created: 15.06.2012 16:17:40 7 | * Author: Julian 8 | */ 9 | 10 | 11 | volatile uint16_t time_sysTick=0; 12 | 13 | //--------------------------------------------- 14 | /* 15 | Timer Overflow Interrupt handler 16 | */ 17 | #ifndef TIMER2_OVF_vect 18 | // for older WinAVR versions e.g. WinAVR-20071221 19 | #define TIMER2_OVF_vect TIMER2_OVF0_vect 20 | #endif 21 | 22 | ISR (TIMER2_OVF_vect) 23 | { 24 | /* 8-bit timer = 256 werte 25 | Interrupt Aktion alle 26 | (20000000/1024)/256 Hz = 76,2939453125 Hz 27 | bzw. 28 | 1/ 76,2939453125 s = 13,1072 ms 29 | */ 30 | 31 | /* since sysTick is 16 bit = 65535 values 32 | and we have an interrupt duration of 13,1072 ms 33 | the sysTick value wraps every 34 | 13,1072 ms * 65535 values = 858,980352 sec = 14,3163392 min 35 | */ 36 | time_sysTick++; 37 | screensaver_timer++; 38 | } 39 | //--------------------------------------------- 40 | void time_initTimer() 41 | { 42 | // Config Timer0 43 | //TCCR2A = ; // Prescaler 1024 44 | TCCR2B = (1< 13 | 14 | //number of connected inputs 15 | #define NUM_INPUTS 39 16 | 17 | //outputs 18 | #define DIN_LOAD_PIN ((uint8_t)(1<. 25 | * 26 | * ------------------------------------------------------------------------------ 27 | * 28 | * 29 | * Created on: 26.10.2012 30 | * Author: Julian 31 | */ 32 | 33 | #ifndef USB_MANAGER_H_ 34 | #define USB_MANAGER_H_ 35 | 36 | #include "stm32f4xx.h" 37 | #include "usbd_conf.h" 38 | #include "usbd_usr.h" 39 | #include "usb_midi_core.h" 40 | #include "MidiMessages.h" 41 | 42 | #define USB_DETECT_PIN GPIO_Pin_2 43 | #define USB_DETECT_PORT GPIOB 44 | 45 | void usb_init(); 46 | void usb_stop(); 47 | void usb_start(); 48 | void usb_tick(); 49 | void usb_sendMidi(MidiMsg msg); 50 | uint8_t usb_getMidi(MidiMsg* msg); 51 | void usb_flushMidi(); 52 | 53 | #endif /* USB_MANAGER_H_ */ 54 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/SampleRom/SampleMemory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SampleMemory.h 3 | * 4 | * Created on: 16.10.2013 5 | * Author: Julian 6 | */ 7 | 8 | #ifndef SAMPLEMEMORY_H_ 9 | #define SAMPLEMEMORY_H_ 10 | 11 | #include "stm32f4xx.h" 12 | #include "flash_if.h" 13 | #include "config.h" 14 | #if USE_SD_CARD 15 | #include "SD_Manager.h" 16 | #endif 17 | //flash region = 0x08000000 to 0x080FA000 (1024k) 18 | //bootloader 0x08000000 to 0x08004000 19 | //the main programm starts at 0x08004000 20 | //if we reserve 512k for the main programm we get 21 | // 0x08004000 + 512k = 0x08004000 + 0x0007D000 = 0x08081000 22 | //page size is 0x4000 so we have to set the limit at 0x08080000 = ~524kb 23 | //this results in a sample rom size of 24 | // 0x080FA000 - 0x08080000 = 0x0007A000 = ~499kb 25 | #define SAMPLE_ROM_START_ADDRESS ((uint32_t)0x08080000) 26 | #define SAMPLE_PAGE_SIZE (uint32_t)0x20000 /* Page size = 128KByte */ 27 | 28 | //size for sample info struct = 7byte 29 | //50 samples = 350 byte = 0x15e 30 | // flash size 0x080FA000 - 0x15e = 0x080F9EA2 31 | //auf 400 byte aufgestockt = 0x190 32 | //flash size 0x080FA000 - 0x190 = 0x080F9E70 33 | #define SAMPLE_INFO_START_ADDRESS ((uint32_t)0x080F9E70) 34 | #define SAMPLE_INFO_SIZE 0x190 35 | #define SAMPLE_ROM_SIZE ((uint32_t)0x00078E70) //499.216 kByte 36 | 37 | typedef struct SampleInfoStruct 38 | { 39 | char name[3]; 40 | uint16_t size; //size in bytes 41 | uint32_t offset; //start address in bytes 42 | } SampleInfo; 43 | 44 | 45 | //-------------------------------------- 46 | void sampleMemory_init(); 47 | void sampleMemory_loadSamples(); 48 | SampleInfo sampleMemory_getSampleInfo(uint8_t index); 49 | uint8_t sampleMemory_getNumSamples(); 50 | void sampleMemory_setNumSamples(uint8_t num); 51 | 52 | 53 | #endif /* SAMPLEMEMORY_H_ */ 54 | -------------------------------------------------------------------------------- /linux_build_guide.txt: -------------------------------------------------------------------------------- 1 | This file gives a short overview of the required compiler packages to build the LXR sourcecode on linux with the included makefiles. You will need the ARM GCC compiler and the AVR GCC compiler as well as the AVR libc. 2 | 3 | 4 | 5 | GNU Tools for ARM Embedded Processors 6 | ------------------------------------- 7 | https://launchpad.net/gcc-arm-embedded 8 | 9 | 10 | For Ubuntu 10.04/12.04/13.04 32/64-bit user, PPA is available at https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded. 11 | 12 | otherwise you can download the 32bit binaries here 13 | https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2 14 | 15 | 16 | --- Installing the ARM GCC binaries ---- 17 | 18 | download the binary package: 19 | wget https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2 20 | 21 | extract it: 22 | tar xvjf gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2 23 | 24 | move it to /opt/ARM: 25 | sudo mv gcc-arm-none-eabi-4_8-2014q1 /opt/ARM 26 | 27 | include it permanently in your PATH variable 28 | echo "PATH=$PATH:/opt/ARM/bin" >> ~/.bashrc 29 | 30 | IMPORTANT! 31 | for x64 systems you have to install the 32-bit version of libc6 or you will get an 'arm-none-eabi-gcc: not found' error: 32 | sudo apt-get install libc6-dev-i386 33 | 34 | 35 | 36 | AVR GCC 37 | -------------------------------------- 38 | sudo apt-get install gcc-avr avr-libc 39 | 40 | 41 | Now you should be ready to go. 42 | to build the firmware, go to the LXR folder containing this file and type: 43 | make firmware 44 | 45 | you should now find a new FIRMWARE.BIN file in the 'firmware image' subfolder 46 | 47 | 48 | Thanks a lot to Patrick Dowling and Andrew Shakinovsky for their code contributions! 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /front/LxrAvr/Hardware/SD/SPI_routines.c: -------------------------------------------------------------------------------- 1 | //************************************************************** 2 | // ****** FUNCTIONS FOR SPI COMMUNICATION ******* 3 | //************************************************************** 4 | //Controller: ATmega32 (Clock: 8 Mhz-internal) 5 | //Compiler : AVR-GCC (winAVR with AVRStudio) 6 | //Project V.: Version - 2.4.1 7 | //Author : CC Dharmani, Chennai (India) 8 | // www.dharmanitech.com 9 | //Date : 24 Apr 2011 10 | //************************************************************** 11 | 12 | #include 13 | #include "SPI_routines.h" 14 | 15 | 16 | 17 | //SPI initialize for SD card 18 | //clock rate: 125Khz 19 | void spi_init(void) 20 | { 21 | 22 | //init port 23 | DDRB |= (1< 11 | #include 12 | 13 | // target: ATmega32 14 | //------------------------------------------------------------------------ 15 | #ifndef F_CPU 16 | #define F_CPU 20000000UL 17 | #endif 18 | //#define XTAL 8e6 // 8MHz 19 | 20 | #define PIN_A (1< 2 | -------------------------------------------------------------------------------- /front/LxrAvr/IO/dout.c: -------------------------------------------------------------------------------- 1 | /* 2 | * dout.c 3 | * 4 | * Created: 25.04.2012 15:30:25 5 | * Author: Julian 6 | */ 7 | 8 | #include "dout.h" 9 | #include 10 | 11 | #define USE_BRIGHTNESS 0 12 | 13 | #if USE_BRIGHTNESS 14 | static uint8_t dout_ledBrightness[NUM_OUTS]; 15 | static uint8_t dout_brightnessCounter = 0; 16 | #endif 17 | 18 | uint8_t dout_outputData[NUM_OUTS/8]; 19 | //--------------------------------------------------------------------------------- 20 | void dout_init() 21 | { 22 | uint8_t outPins = DOUT_LOAD_PIN | DOUT_CLK_PIN | DOUT_OUTPUT_PIN; 23 | 24 | //configure as outputs 25 | DOUT_DDR |= outPins; 26 | 27 | //set outputs to low 28 | DOUT_PORT &= (uint8_t)(~outPins); 29 | 30 | //clear the input data array 31 | memset(dout_outputData,0,NUM_OUTS/8); 32 | 33 | #if USE_BRIGHTNESS 34 | for(int i=0;i 9 | #include "../Menu/menu.h" 10 | 11 | #define HYSTERSIS 3 12 | #define MIN( a, b ) (a < b) ? a : b 13 | 14 | 15 | uint16_t adc_potValues[4]; 16 | uint16_t adc_potAvg[4]; 17 | //------------------------------------------------------------------------ 18 | void adc_init(void) { 19 | 20 | memset((void*)adc_potValues,0,8); 21 | memset((void*)adc_potAvg,0,8); 22 | uint16_t result; 23 | 24 | // AVCC as ref voltage 25 | ADMUX = (1< 8mhz clock = 125 kHz (must be between 50 and 200kHz) 29 | ADCSRA |= (1< ( adc_potValues[i] + HYSTERSIS)) || 72 | ( adc_potValues[i] > (newValue + HYSTERSIS))) 73 | { 74 | adc_potValues[i] = newValue; 75 | menu_parseKnobValue(i,(uint8_t)(newValue>>2)); 76 | menu_repaintAll(); 77 | } 78 | } 79 | } 80 | }; 81 | //------------------------------------------------------------------------ 82 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/Libraries/STM32_USB_Device_Library/Core/inc/usbd_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_conf_template.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 19-March-2012 7 | * @brief usb device configuration template file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_CONF__H__ 30 | #define __USBD_CONF__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | //#include "usb_conf.h" 34 | 35 | /** @defgroup USB_CONF_Exported_Defines 36 | * @{ 37 | */ 38 | //#define USE_USB_OTG_HS 39 | 40 | #define USBD_CFG_MAX_NUM 1 41 | #define USBD_ITF_MAX_NUM 2 42 | #define USB_MAX_STR_DESC_SIZ 64 43 | #define USBD_EP0_MAX_PACKET_SIZE 64 44 | 45 | #define MIDI_OUT_EP 0x01 46 | #define MIDI_IN_EP 0x81 47 | 48 | #define MIDI_PACKET_SIZE 0x40 49 | 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | 56 | /** @defgroup USB_CONF_Exported_Types 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | /** @defgroup USB_CONF_Exported_Macros 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup USB_CONF_Exported_Variables 72 | * @{ 73 | */ 74 | /** 75 | * @} 76 | */ 77 | 78 | /** @defgroup USB_CONF_Exported_FunctionsPrototype 79 | * @{ 80 | */ 81 | /** 82 | * @} 83 | */ 84 | 85 | 86 | #endif //__USBD_CONF__H__ 87 | 88 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 89 | 90 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/Libraries/Device/STM32F4xx/Include/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.0.0RC1 6 | * @date 25-August-2011 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f4xx_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F4XX_H 34 | #define __SYSTEM_STM32F4XX_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F4xx_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F4xx_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @addtogroup STM32F4xx_System_Exported_Constants 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @addtogroup STM32F4xx_System_Exported_Macros 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @addtogroup STM32F4xx_System_Exported_Functions 77 | * @{ 78 | */ 79 | 80 | extern void SystemInit(void); 81 | extern void SystemCoreClockUpdate(void); 82 | /** 83 | * @} 84 | */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /*__SYSTEM_STM32F4XX_H */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 100 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.0.0RC1 6 | * @date 25-August-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_CRC_H 25 | #define __STM32F4xx_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup CRC_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** 50 | * @} 51 | */ 52 | 53 | /* Exported macro ------------------------------------------------------------*/ 54 | /* Exported functions --------------------------------------------------------*/ 55 | 56 | void CRC_ResetDR(void); 57 | uint32_t CRC_CalcCRC(uint32_t Data); 58 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 59 | uint32_t CRC_GetCRC(void); 60 | void CRC_SetIDRegister(uint8_t IDValue); 61 | uint8_t CRC_GetIDRegister(void); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __STM32F4xx_CRC_H */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/Libraries/Device/STM32F4xx/Include/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.0.0RC1 6 | * @date 25-August-2011 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f4xx_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F4XX_H 34 | #define __SYSTEM_STM32F4XX_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F4xx_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F4xx_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @addtogroup STM32F4xx_System_Exported_Constants 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @addtogroup STM32F4xx_System_Exported_Macros 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @addtogroup STM32F4xx_System_Exported_Functions 77 | * @{ 78 | */ 79 | 80 | extern void SystemInit(void); 81 | extern void SystemCoreClockUpdate(void); 82 | /** 83 | * @} 84 | */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /*__SYSTEM_STM32F4XX_H */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 100 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/Libraries/STM32_USB_OTG_Driver/inc/usb_otg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_otg.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief OTG Core Header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_OTG__ 30 | #define __USB_OTG__ 31 | 32 | 33 | /** @addtogroup USB_OTG_DRIVER 34 | * @{ 35 | */ 36 | 37 | /** @defgroup USB_OTG 38 | * @brief This file is the 39 | * @{ 40 | */ 41 | 42 | 43 | /** @defgroup USB_OTG_Exported_Defines 44 | * @{ 45 | */ 46 | 47 | 48 | void USB_OTG_InitiateSRP(void); 49 | void USB_OTG_InitiateHNP(uint8_t state , uint8_t mode); 50 | void USB_OTG_Switchback (USB_OTG_CORE_DEVICE *pdev); 51 | uint32_t USB_OTG_GetCurrentState (USB_OTG_CORE_DEVICE *pdev); 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | /** @defgroup USB_OTG_Exported_Types 59 | * @{ 60 | */ 61 | /** 62 | * @} 63 | */ 64 | 65 | 66 | /** @defgroup USB_OTG_Exported_Macros 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USB_OTG_Exported_Variables 74 | * @{ 75 | */ 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USB_OTG_Exported_FunctionsPrototype 81 | * @{ 82 | */ 83 | /** 84 | * @} 85 | */ 86 | 87 | 88 | #endif //__USB_OTG__ 89 | 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | 100 | -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.0.0RC1 6 | * @date 25-August-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_CRC_H 25 | #define __STM32F4xx_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup CRC_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** 50 | * @} 51 | */ 52 | 53 | /* Exported macro ------------------------------------------------------------*/ 54 | /* Exported functions --------------------------------------------------------*/ 55 | 56 | void CRC_ResetDR(void); 57 | uint32_t CRC_CalcCRC(uint32_t Data); 58 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 59 | uint32_t CRC_GetCRC(void); 60 | void CRC_SetIDRegister(uint8_t IDValue); 61 | uint8_t CRC_GetIDRegister(void); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __STM32F4xx_CRC_H */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/UART_routines.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "UART_routines.h" 4 | #include 5 | #include 6 | #include "Bootloader/BootloaderCommands.h" 7 | #include 8 | 9 | //************************************************** 10 | //UART0 initialize 11 | //baud rate: 19200 (for controller clock = 8MHz) 12 | //char size: 8 bit 13 | //parity: Disabled 14 | //************************************************** 15 | void uart_init(void) 16 | { 17 | #ifdef MEGA32 18 | UBRRH = UBRR_VAL >> 8; 19 | UBRRL = UBRR_VAL & 0xFF; 20 | 21 | UCSRB |= (1<= 1024)) */ 53 | #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */ 54 | #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */ 55 | 56 | /* Generic command */ 57 | #define CTRL_POWER 5 /* Get/Set power status */ 58 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */ 59 | #define CTRL_EJECT 7 /* Eject media */ 60 | 61 | /* MMC/SDC specific ioctl command */ 62 | #define MMC_GET_TYPE 10 /* Get card type */ 63 | #define MMC_GET_CSD 11 /* Get CSD */ 64 | #define MMC_GET_CID 12 /* Get CID */ 65 | #define MMC_GET_OCR 13 /* Get OCR */ 66 | #define MMC_GET_SDSTAT 14 /* Get SD status */ 67 | 68 | /* ATA/CF specific ioctl command */ 69 | #define ATA_GET_REV 20 /* Get F/W revision */ 70 | #define ATA_GET_MODEL 21 /* Get model name */ 71 | #define ATA_GET_SN 22 /* Get serial number */ 72 | 73 | /* NAND specific ioctl command */ 74 | #define NAND_FORMAT 30 /* Create physical format */ 75 | 76 | 77 | #define _DISKIO 78 | #endif 79 | -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/elmChan/diskio.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------- 2 | / Low level disk interface modlue include file 3 | /-----------------------------------------------------------------------*/ 4 | #include "../config.h" 5 | 6 | 7 | #ifndef _DISKIO 8 | 9 | #define _READONLY 0 /* 1: Remove write functions */ 10 | #define _USE_IOCTL 1 /* 1: Use disk_ioctl fucntion */ 11 | 12 | #include "integer.h" 13 | 14 | 15 | /* Status of Disk Functions */ 16 | typedef BYTE DSTATUS; 17 | 18 | /* Results of Disk Functions */ 19 | typedef enum { 20 | RES_OK = 0, /* 0: Successful */ 21 | RES_ERROR, /* 1: R/W Error */ 22 | RES_WRPRT, /* 2: Write Protected */ 23 | RES_NOTRDY, /* 3: Not Ready */ 24 | RES_PARERR /* 4: Invalid Parameter */ 25 | } DRESULT; 26 | 27 | 28 | /*---------------------------------------*/ 29 | /* Prototypes for disk control functions */ 30 | 31 | int assign_drives (int, int); 32 | DSTATUS disk_initialize (BYTE); 33 | DSTATUS disk_status (BYTE); 34 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); 35 | #if _READONLY == 0 36 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); 37 | #endif 38 | DRESULT disk_ioctl (BYTE, BYTE, void*); 39 | 40 | 41 | 42 | /* Disk Status Bits (DSTATUS) */ 43 | 44 | #define STA_NOINIT 0x01 /* Drive not initialized */ 45 | #define STA_NODISK 0x02 /* No medium in the drive */ 46 | #define STA_PROTECT 0x04 /* Write protected */ 47 | 48 | 49 | /* Command code for disk_ioctrl fucntion */ 50 | 51 | /* Generic command (defined for FatFs) */ 52 | #define CTRL_SYNC 0 /* Flush disk cache (for write functions) */ 53 | #define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */ 54 | #define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */ 55 | #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */ 56 | #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */ 57 | 58 | /* Generic command */ 59 | #define CTRL_POWER 5 /* Get/Set power status */ 60 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */ 61 | #define CTRL_EJECT 7 /* Eject media */ 62 | 63 | /* MMC/SDC specific ioctl command */ 64 | #define MMC_GET_TYPE 10 /* Get card type */ 65 | #define MMC_GET_CSD 11 /* Get CSD */ 66 | #define MMC_GET_CID 12 /* Get CID */ 67 | #define MMC_GET_OCR 13 /* Get OCR */ 68 | #define MMC_GET_SDSTAT 14 /* Get SD status */ 69 | 70 | /* ATA/CF specific ioctl command */ 71 | #define ATA_GET_REV 20 /* Get F/W revision */ 72 | #define ATA_GET_MODEL 21 /* Get model name */ 73 | #define ATA_GET_SN 22 /* Get serial number */ 74 | 75 | /* NAND specific ioctl command */ 76 | #define NAND_FORMAT 30 /* Create physical format */ 77 | 78 | 79 | #define _DISKIO 80 | #endif 81 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/Hardware/SD_FAT/diskio.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------- 2 | / Low level disk interface modlue include file 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO 6 | 7 | #include "config.h" 8 | #if USE_SD_CARD 9 | 10 | #define _READONLY 0 /* 1: Remove write functions */ 11 | #define _USE_IOCTL 1 /* 1: Use disk_ioctl fucntion */ 12 | 13 | #include "integer.h" 14 | 15 | 16 | /* Status of Disk Functions */ 17 | typedef BYTE DSTATUS; 18 | 19 | /* Results of Disk Functions */ 20 | typedef enum { 21 | RES_OK = 0, /* 0: Successful */ 22 | RES_ERROR, /* 1: R/W Error */ 23 | RES_WRPRT, /* 2: Write Protected */ 24 | RES_NOTRDY, /* 3: Not Ready */ 25 | RES_PARERR /* 4: Invalid Parameter */ 26 | } DRESULT; 27 | 28 | 29 | /*---------------------------------------*/ 30 | /* Prototypes for disk control functions */ 31 | 32 | int assign_drives (int, int); 33 | DSTATUS disk_initialize (BYTE); 34 | DSTATUS disk_status (BYTE); 35 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); 36 | #if _READONLY == 0 37 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); 38 | #endif 39 | DRESULT disk_ioctl (BYTE, BYTE, void*); 40 | 41 | 42 | 43 | /* Disk Status Bits (DSTATUS) */ 44 | 45 | #define STA_NOINIT 0x01 /* Drive not initialized */ 46 | #define STA_NODISK 0x02 /* No medium in the drive */ 47 | #define STA_PROTECT 0x04 /* Write protected */ 48 | 49 | 50 | /* Command code for disk_ioctrl fucntion */ 51 | 52 | /* Generic command (defined for FatFs) */ 53 | #define CTRL_SYNC 0 /* Flush disk cache (for write functions) */ 54 | #define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */ 55 | #define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */ 56 | #define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */ 57 | #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */ 58 | 59 | /* Generic command */ 60 | #define CTRL_POWER 5 /* Get/Set power status */ 61 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */ 62 | #define CTRL_EJECT 7 /* Eject media */ 63 | 64 | /* MMC/SDC specific ioctl command */ 65 | #define MMC_GET_TYPE 10 /* Get card type */ 66 | #define MMC_GET_CSD 11 /* Get CSD */ 67 | #define MMC_GET_CID 12 /* Get CID */ 68 | #define MMC_GET_OCR 13 /* Get OCR */ 69 | #define MMC_GET_SDSTAT 14 /* Get SD status */ 70 | 71 | /* ATA/CF specific ioctl command */ 72 | #define ATA_GET_REV 20 /* Get F/W revision */ 73 | #define ATA_GET_MODEL 21 /* Get model name */ 74 | #define ATA_GET_SN 22 /* Get serial number */ 75 | 76 | /* NAND specific ioctl command */ 77 | #define NAND_FORMAT 30 /* Create physical format */ 78 | 79 | 80 | #define _DISKIO 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/Release/makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | -include ../makefile.init 6 | 7 | RM := rm -rf 8 | 9 | # All of the sources participating in the build are defined here 10 | -include sources.mk 11 | -include src/subdir.mk 12 | -include Libraries/STM32F4xx_StdPeriph_Driver/src/subdir.mk 13 | -include Libraries/STM32F4-Discovery/subdir.mk 14 | -include subdir.mk 15 | -include objects.mk 16 | 17 | ifneq ($(MAKECMDGOALS),clean) 18 | ifneq ($(strip $(C_DEPS)),) 19 | -include $(C_DEPS) 20 | endif 21 | ifneq ($(strip $(ASM_DEPS)),) 22 | -include $(ASM_DEPS) 23 | endif 24 | ifneq ($(strip $(S_UPPER_DEPS)),) 25 | -include $(S_UPPER_DEPS) 26 | endif 27 | endif 28 | 29 | -include ../makefile.defs 30 | 31 | # Add inputs and outputs from these tool invocations to the build variables 32 | SECONDARY_FLASH += \ 33 | UartBootloader_FPU.hex \ 34 | 35 | SECONDARY_LIST += \ 36 | UartBootloader_FPU.lst \ 37 | 38 | SECONDARY_SIZE += \ 39 | UartBootloader_FPU.siz \ 40 | 41 | 42 | # All Target 43 | all: UartBootloader_FPU.elf secondary-outputs 44 | 45 | # Tool invocations 46 | UartBootloader_FPU.elf: $(OBJS) $(USER_OBJS) 47 | @echo 'Building target: $@' 48 | @echo 'Invoking: ARM Windows GCC C Linker' 49 | arm-none-eabi-gcc -T"E:\Eclipse_Drum_Synth_STM32\DrumSynth_Workspace\UartBootloader_FPU\stm32_flash.ld" -Xlinker --gc-sections -Wl,-Map,UartBootloader_FPU.map -v -mcpu=cortex-m4 -mthumb -g3 -gdwarf-2 -o "UartBootloader_FPU.elf" $(OBJS) $(USER_OBJS) $(LIBS) 50 | @echo 'Finished building target: $@' 51 | @echo ' ' 52 | 53 | UartBootloader_FPU.hex: UartBootloader_FPU.elf 54 | @echo 'Invoking: ARM Windows GNU Create Flash Image' 55 | arm-none-eabi-objcopy -O ihex UartBootloader_FPU.elf "UartBootloader_FPU.hex" 56 | @echo 'Finished building: $@' 57 | @echo ' ' 58 | 59 | UartBootloader_FPU.lst: UartBootloader_FPU.elf 60 | @echo 'Invoking: ARM Windows GNU Create Listing' 61 | arm-none-eabi-objcopy -h -S UartBootloader_FPU.elf > "UartBootloader_FPU.lst" 62 | @echo 'Finished building: $@' 63 | @echo ' ' 64 | 65 | UartBootloader_FPU.siz: UartBootloader_FPU.elf 66 | @echo 'Invoking: ARM Windows GNU Print Size' 67 | arm-none-eabi-size --format=berkeley UartBootloader_FPU.elf 68 | @echo 'Finished building: $@' 69 | @echo ' ' 70 | 71 | # Other Targets 72 | clean: 73 | -$(RM) $(SECONDARY_SIZE)$(OBJS)$(C_DEPS)$(ASM_DEPS)$(SECONDARY_FLASH)$(EXECUTABLES)$(SECONDARY_LIST)$(S_UPPER_DEPS) UartBootloader_FPU.elf 74 | -@echo ' ' 75 | 76 | secondary-outputs: $(SECONDARY_FLASH) $(SECONDARY_LIST) $(SECONDARY_SIZE) 77 | 78 | .PHONY: all clean dependents 79 | .SECONDARY: 80 | 81 | -include ../makefile.targets 82 | -------------------------------------------------------------------------------- /front/LxrAvr_bootloader/dout.c: -------------------------------------------------------------------------------- 1 | /* 2 | * dout.c 3 | * 4 | * Created: 25.04.2012 15:30:25 5 | * Author: Julian 6 | */ 7 | 8 | #include "dout.h" 9 | #include 10 | 11 | #define USE_BRIGHTNESS 0 12 | 13 | #if USE_BRIGHTNESS 14 | static uint8_t dout_ledBrightness[NUM_OUTS]; 15 | static uint8_t dout_brightnessCounter = 0; 16 | #endif 17 | 18 | uint8_t dout_outputData[NUM_OUTS/8]; 19 | //--------------------------------------------------------------------------------- 20 | void dout_init() 21 | { 22 | uint8_t outPins = DOUT_LOAD_PIN | DOUT_CLK_PIN | DOUT_OUTPUT_PIN; 23 | 24 | //configure as outputs 25 | DOUT_DDR |= outPins; 26 | 27 | //set outputs to low 28 | DOUT_PORT &= ~outPins; 29 | 30 | //clear the input data array 31 | memset(dout_outputData,0,NUM_OUTS/8); 32 | 33 | #if USE_BRIGHTNESS 34 | for(int i=0;i>8; 54 | /* 55 | dout_outputData[3] = (dout_outputData[3]<<1); 56 | if(dout_outputData[3]==0x00) 57 | { 58 | dout_outputData[4] = 1 | (dout_outputData[4]<<1); 59 | } 60 | */ 61 | #if USE_BRIGHTNESS 62 | dout_brightnessCounter++; 63 | #endif 64 | 65 | for(int i=0;i
© COPYRIGHT 2012 STMicroelectronics
12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_BSP__H__ 30 | #define __USB_BSP__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_core.h" 34 | #include "usb_conf.h" 35 | 36 | /** @addtogroup USB_OTG_DRIVER 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USB_BSP 41 | * @brief This file is the 42 | * @{ 43 | */ 44 | 45 | 46 | /** @defgroup USB_BSP_Exported_Defines 47 | * @{ 48 | */ 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | /** @defgroup USB_BSP_Exported_Types 55 | * @{ 56 | */ 57 | /** 58 | * @} 59 | */ 60 | 61 | 62 | /** @defgroup USB_BSP_Exported_Macros 63 | * @{ 64 | */ 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup USB_BSP_Exported_Variables 70 | * @{ 71 | */ 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USB_BSP_Exported_FunctionsPrototype 77 | * @{ 78 | */ 79 | void BSP_Init(void); 80 | 81 | void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev); 82 | void USB_OTG_BSP_uDelay (const uint32_t usec); 83 | void USB_OTG_BSP_mDelay (const uint32_t msec); 84 | void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev); 85 | #ifdef USE_HOST_MODE 86 | void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev); 87 | void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state); 88 | #endif 89 | /** 90 | * @} 91 | */ 92 | 93 | #endif //__USB_BSP__H__ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 103 | 104 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/globals.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------------------------------------------------------------ 3 | * Copyright 2013 Julian Schmidt 4 | * Julian@sonic-potions.com 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * This file is part of the Sonic Potions LXR drumsynth firmware. 7 | * ------------------------------------------------------------------------------------------------------------------------ 8 | * Redistribution and use of the LXR code or any derivative works are permitted 9 | * provided that the following conditions are met: 10 | * 11 | * - The code may not be sold, nor may it be used in a commercial product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the complete 14 | * source code, including the source code for all components used by a binary built 15 | * from the modified sources. However, as a special exception, the source code distributed 16 | * need not include anything that is normally distributed (in either source or binary form) 17 | * with the major components (compiler, kernel, and so on) of the operating system on which 18 | * the executable runs, unless that component itself accompanies the executable. 19 | * 20 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 21 | * following disclaimer in the documentation and/or other materials provided with the distribution. 22 | * ------------------------------------------------------------------------------------------------------------------------ 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 29 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * ------------------------------------------------------------------------------------------------------------------------ 31 | */ 32 | 33 | 34 | 35 | #ifndef GLOBAL_VARS_FILE 36 | #define GLOBAL_VARS_FILE 37 | 38 | #include "stm32f4xx.h" 39 | 40 | // global vars 41 | extern volatile uint32_t systick_ticks; 42 | extern int16_t audioOutBuffer[2]; 43 | extern uint8_t bCurrentSampleValid; 44 | #define SAMPLE_VALID 0xff 45 | #define FILTER_SHAPER -0.9f 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/squareRootLut.h: -------------------------------------------------------------------------------- 1 | /* 2 | * squareRootLut.h 3 | * 4 | * Created on: 22.06.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef SQUAREROOTLUT_H_ 38 | #define SQUAREROOTLUT_H_ 39 | 40 | /**Square Root Table 41 | * sqrt(x) with x = [0:1] 42 | * used to calculate the pan for left an right channel 43 | */ 44 | extern const float squareRootLut[128]; 45 | 46 | #endif /* SQUAREROOTLUT_H_ */ 47 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/Sequencer/SomData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SomData.h 3 | * 4 | * Created on: 30.04.2013 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef SOMDATA_H_ 38 | #define SOMDATA_H_ 39 | 40 | #include "stm32f4xx.h" 41 | 42 | 43 | /* 44 | extern uint8_t Node_0[][128]; 45 | extern uint8_t Node_1[][128]; 46 | extern uint8_t Node_2[][128]; 47 | */ 48 | 49 | extern const uint8_t* som_nodes[9]; 50 | 51 | #endif /* SOMDATA_H_ */ 52 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/AudioCodecManager/AudioCodecManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AudioCodecManager.h 3 | * ------------------------------------------------------------------------------------------------------------------------ 4 | * Copyright 2013 Julian Schmidt 5 | * Julian@sonic-potions.com 6 | * ------------------------------------------------------------------------------------------------------------------------ 7 | * This file is part of the Sonic Potions LXR drumsynth firmware. 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * Redistribution and use of the LXR code or any derivative works are permitted 10 | * provided that the following conditions are met: 11 | * 12 | * - The code may not be sold, nor may it be used in a commercial product or activity. 13 | * 14 | * - Redistributions that are modified from the original source must include the complete 15 | * source code, including the source code for all components used by a binary built 16 | * from the modified sources. However, as a special exception, the source code distributed 17 | * need not include anything that is normally distributed (in either source or binary form) 18 | * with the major components (compiler, kernel, and so on) of the operating system on which 19 | * the executable runs, unless that component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 22 | * following disclaimer in the documentation and/or other materials provided with the distribution. 23 | * ------------------------------------------------------------------------------------------------------------------------ 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * ------------------------------------------------------------------------------------------------------------------------ 32 | */ 33 | 34 | 35 | #ifndef AUDIOCODECMANAGER_H_ 36 | #define AUDIOCODECMANAGER_H_ 37 | 38 | #include "stm32f4xx.h" 39 | #include "config.h" 40 | #include "globals.h" 41 | #include "cs4344_cs5343.h" 42 | 43 | #define DMA_MODE_ACTIVE 1 44 | //----------------------------------- 45 | int CodecInit(); 46 | 47 | #endif /* AUDIOCODECMANAGER_H_ */ 48 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/snapEg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * snapEg.h 3 | * 4 | * Created on: 16.06.2013 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef SNAPEG_H_ 38 | #define SNAPEG_H_ 39 | 40 | #include "stm32f4xx.h" 41 | 42 | typedef struct Snap_EG_Struct 43 | { 44 | float value; 45 | } SnapEg; 46 | 47 | 48 | void SnapEg_init(SnapEg* eg); 49 | void SnapEg_trigger(SnapEg* eg); 50 | float SnapEg_calc(SnapEg* eg, float time); 51 | 52 | 53 | 54 | #endif /* SNAPEG_H_ */ 55 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/SampleRom/SampleMemory.c: -------------------------------------------------------------------------------- 1 | /* 2 | * SampleMemory.c 3 | * 4 | * Created on: 16.10.2013 5 | * Author: Julian 6 | */ 7 | 8 | 9 | #include "SampleMemory.h" 10 | #include "../Hardware/SD_FAT/SPI_routines.h" 11 | #include "string.h" 12 | 13 | 14 | //----- Vars ---------- 15 | //1st word is number of samples! 16 | static uint16_t *sampleMemory_data = (uint16_t*) SAMPLE_ROM_START_ADDRESS; 17 | static SampleInfo* sampleMemory_infoData = (SampleInfo*) SAMPLE_INFO_START_ADDRESS; 18 | 19 | //----- functions ----- 20 | void sampleMemory_init() 21 | { 22 | FLASH_If_Init(); 23 | 24 | //disable write protection if enabled 25 | if(FLASH_If_GetWriteProtectionStatus()) 26 | { 27 | FLASH_If_DisableWriteProtection(); 28 | } 29 | 30 | 31 | #if USE_SD_CARD 32 | sdManager_init(); 33 | #endif 34 | } 35 | //--------------------------------------------------------------- 36 | SampleInfo sampleMemory_getSampleInfo(uint8_t index) 37 | { 38 | return sampleMemory_infoData[index]; 39 | } 40 | //--------------------------------------------------------------- 41 | uint8_t sampleMemory_getNumSamples() 42 | { 43 | return sampleMemory_data[0]; 44 | } 45 | //--------------------------------------------------------------- 46 | void sampleMemory_setNumSamples(uint8_t num) 47 | { 48 | // sampleMemory_data[0] = num; 49 | uint32_t data = num; 50 | volatile uint32_t add = SAMPLE_ROM_START_ADDRESS; //*4 because we write uint32 51 | FLASH_If_Write(&add, (uint32_t*)&data, 1); 52 | } 53 | //--------------------------------------------------------------- 54 | #define BLOCKSIZE 2 55 | void sampleMemory_loadSamples() 56 | { 57 | uint8_t numSamples = sd_getNumSamples(); 58 | 59 | 60 | if(numSamples==0) return; 61 | 62 | //erase user memory flash 63 | FLASH_If_Erase(SAMPLE_ROM_START_ADDRESS); 64 | 65 | sampleMemory_setNumSamples(numSamples); 66 | 67 | //reserve space for sample info header 68 | SampleInfo info[50]; 69 | uint32_t addr = 0; 70 | 71 | uint8_t i; 72 | for(i=0;i 10 | #include 11 | #include "../buttonHandler.h" 12 | 13 | //--------------------------------------------------------------------- 14 | //1 bit for every digital input, so we can store 8 input signals in one uint8_t 15 | uint8_t din_inputData[NUM_INPUTS/8+1]; 16 | //indicates which input was read last. if NUM_INPUTS is reached, a new load has to occur 17 | static uint8_t inputPos = NUM_INPUTS; 18 | //--------------------------------------------------------------------- 19 | void din_init() 20 | { 21 | uint8_t outPins = DIN_LOAD_PIN | DIN_CLK_PIN; 22 | uint8_t inPins = DIN_INPUT_PIN; 23 | 24 | //configure as input 25 | DIN_DDR &= (uint8_t)(~inPins); 26 | 27 | //configure as outputs 28 | DIN_DDR |= outPins; 29 | 30 | // disable internal pull ups 31 | DIN_PORT &= (uint8_t)(~inPins); 32 | 33 | //set outputs to high 34 | DIN_PORT |= outPins; 35 | 36 | //clear the input data array 37 | memset(din_inputData,0,NUM_INPUTS/8+1); 38 | 39 | din_load(); 40 | }; 41 | //--------------------------------------------------------------------- 42 | void din_shift() 43 | { 44 | DIN_PORT &= (uint8_t)~DIN_CLK_PIN; //clock low 45 | DIN_PORT |= DIN_CLK_PIN; //clock high 46 | } 47 | //--------------------------------------------------------------------- 48 | void din_load() 49 | { 50 | //set load pin LOW to get new data 51 | DIN_PORT &= (uint8_t)~DIN_LOAD_PIN; 52 | //set load pin HIGH again to enable clock 53 | DIN_PORT |= DIN_LOAD_PIN; 54 | } 55 | //--------------------------------------------------------------------- 56 | void din_readNextInput() 57 | { 58 | 59 | int i; 60 | for(i=0;i<10;i++) 61 | { 62 | //check if a new load is necessary 63 | if(inputPos>=NUM_INPUTS) 64 | { 65 | //reset inputPos 66 | inputPos = 0; 67 | //load new data into register 68 | din_load(); 69 | } 70 | else 71 | { 72 | //increment position counter 73 | inputPos++; 74 | //shift data 75 | din_shift(); 76 | } 77 | 78 | //store input value in inputData[] 79 | uint8_t arrayPos = inputPos/8; 80 | uint8_t bitPos = inputPos&7; 81 | 82 | //read pin 83 | uint8_t value; 84 | if((DIN_INPUT & DIN_INPUT_PIN) >0) 85 | { 86 | value = 0; 87 | } 88 | else 89 | { 90 | value = 1; 91 | } 92 | 93 | //check if button was pressed 94 | if(!value) 95 | { 96 | if( (din_inputData[arrayPos] & (1<
© COPYRIGHT 2012 STMicroelectronics
12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | 30 | #ifndef __USB_REQUEST_H_ 31 | #define __USB_REQUEST_H_ 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usbd_def.h" 35 | #include "usbd_core.h" 36 | #include "usbd_conf.h" 37 | 38 | 39 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBD_REQ 44 | * @brief header file for the usbd_ioreq.c file 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBD_REQ_Exported_Defines 49 | * @{ 50 | */ 51 | /** 52 | * @} 53 | */ 54 | 55 | 56 | /** @defgroup USBD_REQ_Exported_Types 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | 65 | /** @defgroup USBD_REQ_Exported_Macros 66 | * @{ 67 | */ 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup USBD_REQ_Exported_Variables 73 | * @{ 74 | */ 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype 80 | * @{ 81 | */ 82 | 83 | USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 84 | USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 85 | USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 86 | void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev, 87 | USB_SETUP_REQ *req); 88 | 89 | void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev, 90 | USB_SETUP_REQ *req); 91 | 92 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len); 93 | /** 94 | * @} 95 | */ 96 | 97 | #endif /* __USB_REQUEST_H_ */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | 108 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 109 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/Decay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Decay.h 3 | * 4 | * Created on: 16.04.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef DECAY_H_ 38 | #define DECAY_H_ 39 | 40 | #include "stm32f4xx.h" 41 | 42 | 43 | typedef struct Decay_EG_Struct 44 | { 45 | float decay; 46 | float slope; 47 | float value; 48 | } DecayEg; 49 | 50 | 51 | void DecayEg_init(DecayEg* eg); 52 | void DecayEg_trigger(DecayEg* eg); 53 | void DecayEg_setDecay(DecayEg* eg, uint8_t data2); 54 | float DecayEg_calc(DecayEg* eg); 55 | void DecayEg_setSlope(DecayEg* eg, uint8_t data2); 56 | 57 | #endif /* DECAY_H_ */ 58 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/Hardware/SD_FAT/sd_routines.h: -------------------------------------------------------------------------------- 1 | //************************************************************** 2 | // ****** FUNCTIONS FOR SD RAW DATA TRANSFER ******* 3 | //************************************************************** 4 | //Controller: ATmega32 (Clock: 8 Mhz-internal) 5 | //Compiler : AVR-GCC (winAVR with AVRStudio) 6 | //Project V.: Version - 2.4.1 7 | //Author : CC Dharmani, Chennai (India) 8 | // www.dharmanitech.com 9 | //Date : 24 Apr 2011 10 | // 11 | //modified : Julian Schmidt 12 | //Date : 9.5.2012 13 | //************************************************************** 14 | 15 | //Link to the Post: http://www.dharmanitech.com/2009/01/sd-card-interfacing-with-atmega8-fat32.html 16 | 17 | #ifndef _SD_ROUTINES_H_ 18 | #define _SD_ROUTINES_H_ 19 | #include "config.h" 20 | #if USE_SD_CARD 21 | #include "stm32f4xx.h" 22 | 23 | //Use following macro if you don't want to activate the multiple block access functions 24 | //those functions are not required for FAT32 25 | 26 | #define FAT_TESTING_ONLY 27 | 28 | //use following macros if PB1 pin is used for Chip Select of SD 29 | //#define SD_CS_ASSERT PORTB &= ~0x02 30 | //#define SD_CS_DEASSERT PORTB |= 0x02 31 | 32 | //pin used for Chip Select of SD 33 | #define SD_CS_GPIO_PORT GPIOB 34 | #define SD_CS_GPIO_PIN GPIO_Pin_0 35 | 36 | #define SD_CS_ASSERT GPIO_ResetBits(SD_CS_GPIO_PORT,SD_CS_GPIO_PIN) //SD_CS_GPIO_PORT->ODR &= ~(1<ODR |= (1<
© COPYRIGHT 2012 STMicroelectronics
12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_CORE_H 30 | #define __USBD_CORE_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_dcd.h" 34 | #include "usbd_def.h" 35 | #include "usbd_conf.h" 36 | 37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USBD_CORE 42 | * @brief This file is the Header file for usbd_core.c file 43 | * @{ 44 | */ 45 | 46 | 47 | /** @defgroup USBD_CORE_Exported_Defines 48 | * @{ 49 | */ 50 | 51 | typedef enum { 52 | USBD_OK = 0, 53 | USBD_BUSY, 54 | USBD_FAIL, 55 | }USBD_Status; 56 | /** 57 | * @} 58 | */ 59 | 60 | 61 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 62 | * @{ 63 | */ 64 | 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | 71 | 72 | /** @defgroup USBD_CORE_Exported_Macros 73 | * @{ 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USBD_CORE_Exported_Variables 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype 89 | * @{ 90 | */ 91 | void USBD_Init(USB_OTG_CORE_HANDLE *pdev, 92 | USB_OTG_CORE_ID_TypeDef coreID, 93 | USBD_DEVICE *pDevice, 94 | USBD_Class_cb_TypeDef *class_cb, 95 | USBD_Usr_cb_TypeDef *usr_cb); 96 | 97 | USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev); 98 | 99 | USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 100 | 101 | USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | #endif /* __USBD_CORE_H */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/random.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rnd.c 3 | * 4 | * Created on: 07.04.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #include "random.h" 38 | #include "stm32f4xx.h" 39 | //------------------------------------------------------------- 40 | void initRng() 41 | { 42 | /* Enable RNG clock source */ 43 | RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_RNG, ENABLE); 44 | 45 | /* RNG Peripheral enable */ 46 | RNG_Cmd(ENABLE); 47 | } 48 | //------------------------------------------------------------- 49 | __inline uint32_t GetRngValue() 50 | { 51 | return RNG_GetRandomNumber(); 52 | } 53 | //------------------------------------------------------------- 54 | 55 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/MIDI/frontPanelParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * frontPanelParser.h 3 | * 4 | * Created on: 27.04.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef FRONTPANELPARSER_H_ 38 | #define FRONTPANELPARSER_H_ 39 | 40 | #include "MidiMessages.h" 41 | #include "modulationNode.h" 42 | #include "valueShaper.h" 43 | 44 | extern uint8_t frontParser_activeTrack; 45 | extern uint8_t frontParser_shownPattern; 46 | extern uint8_t frontParser_sysexActive; 47 | 48 | extern uint8_t frontParser_activeFrontTrack; 49 | 50 | void frontParser_parseUartData(unsigned char data); 51 | 52 | void frontParser_updateTrackLeds(const uint8_t trackNr, uint8_t patternNr); 53 | 54 | #endif /* FRONTPANELPARSER_H_ */ 55 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/mixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mixer.h 3 | * 4 | * Created on: 11.04.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef MIXER_H_ 38 | #define MIXER_H_ 39 | 40 | #include "stm32f4xx.h" 41 | 42 | #define USE_SWITCH_ROUTING 1 43 | #define USE_DECIMATOR 1 44 | 45 | #if USE_DECIMATOR 46 | extern float mixer_decimation_rate[7]; /** 37 | #include "datatypes.h" 38 | //------------------------------------------------------------------ 39 | #if DMA_MODE_ACTIVE 40 | volatile int16_t dma_buffer[OUTPUT_DMA_SIZE*4]; 41 | volatile int16_t dma_buffer2[OUTPUT_DMA_SIZE*4]; 42 | #endif 43 | 44 | uint8_t bCurrentSampleValid = 0; 45 | int16_t audioOutBuffer[2]; 46 | //------------------------------------------------------------------ 47 | int CodecInit() 48 | { 49 | dma_buffer[0] = 32756; 50 | codec_initCsCodec((uint32_t)dma_buffer, OUTPUT_DMA_SIZE*2,(uint32_t)dma_buffer2, OUTPUT_DMA_SIZE*2); 51 | return 0; 52 | } 53 | //------------------------------------------------------------------ 54 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/wavetable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wavetable.h 3 | * 4 | * Created on: 01.04.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef WAVETABLES_H_ 38 | #define WAVETABLES_H_ 39 | 40 | #include "stm32f4xx.h" 41 | #include 42 | 43 | #define TABLESIZE 4096 44 | #define TABLES 128 45 | 46 | extern const int16_t sine_table[TABLESIZE+1]; 47 | 48 | /*the midi note numbers for the 11 wavetables are 49 | 0 - 0 - 8.1758Hz 50 | 1 - 12 - 16.3516Hz 51 | 2 - 24 - 32.7032 52 | 3 - 36 - 65.4064 53 | 4 - 48 - 130.813 54 | 5 - 60 - 261.626 55 | 6 - 72 - 523.251 56 | 7 - 84 - 1046.5 57 | 8 - 96 - 2093 58 | 9 - 108 - 4186.01 59 | 10 - 120- 8372.02 60 | */ 61 | 62 | extern const int16_t recTable[11][1024]; 63 | extern const int16_t triTable[11][1024]; 64 | extern const int16_t sawTable[11][1024]; 65 | 66 | #endif /* WAVETABLES_H_ */ 67 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/Sequencer/clockSync.h: -------------------------------------------------------------------------------- 1 | /* 2 | * clockSync.h 3 | * 4 | * Created on: 02.02.2013 5 | * Author: Julian 6 | * 7 | * used to keep track of incoming midi clocks 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * Copyright 2013 Julian Schmidt 10 | * Julian@sonic-potions.com 11 | * ------------------------------------------------------------------------------------------------------------------------ 12 | * This file is part of the Sonic Potions LXR drumsynth firmware. 13 | * ------------------------------------------------------------------------------------------------------------------------ 14 | * Redistribution and use of the LXR code or any derivative works are permitted 15 | * provided that the following conditions are met: 16 | * 17 | * - The code may not be sold, nor may it be used in a commercial product or activity. 18 | * 19 | * - Redistributions that are modified from the original source must include the complete 20 | * source code, including the source code for all components used by a binary built 21 | * from the modified sources. However, as a special exception, the source code distributed 22 | * need not include anything that is normally distributed (in either source or binary form) 23 | * with the major components (compiler, kernel, and so on) of the operating system on which 24 | * the executable runs, unless that component itself accompanies the executable. 25 | * 26 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 27 | * following disclaimer in the documentation and/or other materials provided with the distribution. 28 | * ------------------------------------------------------------------------------------------------------------------------ 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 30 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 31 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 34 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 35 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | * ------------------------------------------------------------------------------------------------------------------------ 37 | */ 38 | 39 | 40 | #ifndef CLOCKSYNC_H_ 41 | #define CLOCKSYNC_H_ 42 | 43 | #include "stm32f4xx.h" 44 | #include "globals.h" 45 | #include "config.h" 46 | #include "sequencer.h" 47 | 48 | #define WINDOW_SIZE 8 49 | #define WINDOW_MASK 0x07 50 | 51 | 52 | /* 53 | we have a midi clock resolution of 24 ppq 54 | our sequencer is running with 32 ppq 55 | 24/32 => 12/16 => 6/8 => 3/4 ratio 56 | 57 | for every 3 midi clocks we have to advance 4 steps 58 | */ 59 | 60 | //called by midi clock 61 | void sync_tick(); 62 | void sync_midiStartStop(uint8_t isStart); 63 | uint8_t sync_getClockCnt(); 64 | 65 | #endif /* CLOCKSYNC_H_ */ 66 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/distortion.c: -------------------------------------------------------------------------------- 1 | /* 2 | * distortion.c 3 | * 4 | * Created on: 14.04.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | #include "distortion.h" 37 | #include "math.h" 38 | //-------------------------------------------------- 39 | __inline void setDistortionShape(Distortion *dist, uint8_t shape) 40 | { 41 | dist->shape = 2*(shape/128.f)/(1-(shape/128.f)); 42 | } 43 | //-------------------------------------------------- 44 | void calcDistBlock(const Distortion *dist, int16_t* buf, const uint8_t size) 45 | { 46 | uint8_t i; 47 | for(i=0;ishape)*x/(1+dist->shape*fabsf(x)); 51 | buf[i] = (x*32767); 52 | } 53 | } 54 | //-------------------------------------------------- 55 | 56 | float distortion_calcSampleFloat(const Distortion *dist, float x) 57 | { 58 | return (1+dist->shape)*x/(1+dist->shape*fabsf(x)); 59 | } 60 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/distortion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * distortion.h 3 | * 4 | * Created on: 11.04.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef DISTORTION_H_ 38 | #define DISTORTION_H_ 39 | //-------------------------------------------------- 40 | #include "stm32f4xx.h" 41 | //-------------------------------------------------- 42 | typedef struct DistStruct 43 | { 44 | float shape; 45 | float inv_shape; 46 | }Distortion; 47 | //-------------------------------------------------- 48 | void setDistortionShape(Distortion *dist, uint8_t shape); 49 | //-------------------------------------------------- 50 | void calcDistBlock(const Distortion *dist, int16_t* buf, const uint8_t size); 51 | //-------------------------------------------------- 52 | float distortion_calcSampleFloat(const Distortion *dist, float x); 53 | //-------------------------------------------------- 54 | #endif /* DISTORTION_H_ */ 55 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/snapEg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * snapEg.c 3 | * 4 | * Created on: 16.06.2013 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | #include "snapEg.h" 37 | 38 | #define SNAP_MAX_VALUE 24.f 39 | #define SNAP_REDUCTION 0.2f 40 | //----------------------------------------------------------------------- 41 | void SnapEg_init(SnapEg* eg) 42 | { 43 | eg->value = 0; 44 | } 45 | //----------------------------------------------------------------------- 46 | void SnapEg_trigger(SnapEg* eg) 47 | { 48 | eg->value = 1; 49 | } 50 | //----------------------------------------------------------------------- 51 | float SnapEg_calc(SnapEg* eg, float time) 52 | { 53 | float ret = 0; 54 | if(eg->value>0) 55 | { 56 | ret = eg->value* eg->value * SNAP_MAX_VALUE; 57 | eg->value -= SNAP_REDUCTION*time; 58 | 59 | } 60 | 61 | return ret; 62 | } 63 | //----------------------------------------------------------------------- 64 | 65 | 66 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/MIDI/Uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MidiUart.h 3 | * ------------------------------------------------------------------------------------------------------------------------ 4 | * Copyright 2013 Julian Schmidt 5 | * Julian@sonic-potions.com 6 | * ------------------------------------------------------------------------------------------------------------------------ 7 | * This file is part of the Sonic Potions LXR drumsynth firmware. 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * Redistribution and use of the LXR code or any derivative works are permitted 10 | * provided that the following conditions are met: 11 | * 12 | * - The code may not be sold, nor may it be used in a commercial product or activity. 13 | * 14 | * - Redistributions that are modified from the original source must include the complete 15 | * source code, including the source code for all components used by a binary built 16 | * from the modified sources. However, as a special exception, the source code distributed 17 | * need not include anything that is normally distributed (in either source or binary form) 18 | * with the major components (compiler, kernel, and so on) of the operating system on which 19 | * the executable runs, unless that component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 22 | * following disclaimer in the documentation and/or other materials provided with the distribution. 23 | * ------------------------------------------------------------------------------------------------------------------------ 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * ------------------------------------------------------------------------------------------------------------------------ 32 | */ 33 | 34 | 35 | #ifndef MIDIUART_H_ 36 | #define MIDIUART_H_ 37 | 38 | #define ACK 1 39 | #define NACK -1 40 | 41 | void initMidiUart(); 42 | 43 | void uart_sendMidi(MidiMsg msg); 44 | 45 | void uart_sendMidiByte(uint8_t data); 46 | //check if there is some received data in the Rx buffer and send it to the midi parser 47 | void uart_processMidi(); 48 | 49 | void initFrontpanelUart(); 50 | //check if there is data in the front panel Rx buffer and send it to the front panel parser 51 | void uart_processFront(); 52 | //sends a byte to the frontpanel 53 | void uart_sendFrontpanelByte(uint8_t data); 54 | //send sysex data to the frontpanel 55 | //unlike the sendFrontPanelByte function, this function is allowed to send data whilke sysex mode is active 56 | void uart_sendFrontpanelSysExByte(uint8_t data); 57 | 58 | void uart_clearFrontFifo(); 59 | #endif /* MIDIUART_H_ */ 60 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/1PoleLp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 1PoleLp.h 3 | * 4 | * Created on: 08.04.2012 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef ONE_POLELP_H_ 38 | #define ONE_POLELP_H_ 39 | //------------------------------------------------------------- 40 | #include "stm32f4xx.h" 41 | //------------------------------------------------------------- 42 | typedef struct OnePoleStruct 43 | { 44 | float r; 45 | float b; 46 | } OnePoleFilter; 47 | //------------------------------------------------------------- 48 | void initOnePole(OnePoleFilter* filter); 49 | float calcOnePole(OnePoleFilter* filter, float input); 50 | void calcOnePoleBlock(OnePoleFilter* filter, int16_t* buf, const uint8_t size); 51 | void calcOnePoleBlockFixedInput(OnePoleFilter* filter, float input,float* output, const uint8_t size); 52 | void setOnePoleCoef(OnePoleFilter* filter,float val); 53 | void setOnePoleValue(OnePoleFilter* filter,float val); 54 | 55 | #endif /* ONE_POLELP_H_ */ 56 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/DSPAudio/dither.c: -------------------------------------------------------------------------------- 1 | /* 2 | * dither.c 3 | * 4 | * Created on: 20.06.2013 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #include "dither.h" 38 | 39 | int16_t dither_process(Dither* dither, float in) 40 | { 41 | 42 | dither->r2 = dither->r1; //can make HP-TRI dither by 43 | dither->r1 = GetRngValue();//rand(); //subtracting previous rand() 44 | 45 | in += DITHER_S * (dither->s1 + dither->s1 - dither->s2); //error feedback 46 | dither->tmp = in + DITHER_O + DITHER_D * (float)(dither->r1 - dither->r2); //dc offset and dither 47 | 48 | dither->out = (int)(DITHER_W * dither->tmp); //truncate downwards 49 | if(dither->tmp<0.0f) dither->out--; //this is faster than floor() 50 | 51 | dither->s2 = dither->s1; 52 | dither->s1 = in - DITHER_WI * (float)dither->out; //error 53 | 54 | return dither->out; 55 | } 56 | -------------------------------------------------------------------------------- /mainboard/LxrStm32/src/MIDI/valueShaper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * valueShaper.h 3 | * 4 | * Created on: 25.01.2013 5 | * ------------------------------------------------------------------------------------------------------------------------ 6 | * Copyright 2013 Julian Schmidt 7 | * Julian@sonic-potions.com 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * This file is part of the Sonic Potions LXR drumsynth firmware. 10 | * ------------------------------------------------------------------------------------------------------------------------ 11 | * Redistribution and use of the LXR code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - The code may not be sold, nor may it be used in a commercial product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the complete 17 | * source code, including the source code for all components used by a binary built 18 | * from the modified sources. However, as a special exception, the source code distributed 19 | * need not include anything that is normally distributed (in either source or binary form) 20 | * with the major components (compiler, kernel, and so on) of the operating system on which 21 | * the executable runs, unless that component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 24 | * following disclaimer in the documentation and/or other materials provided with the distribution. 25 | * ------------------------------------------------------------------------------------------------------------------------ 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * ------------------------------------------------------------------------------------------------------------------------ 34 | */ 35 | 36 | 37 | #ifndef VALUESHAPER_H_ 38 | #define VALUESHAPER_H_ 39 | //------------------------------------------------------------- 40 | #include "stm32f4xx.h" 41 | #include 42 | //------------------------------------------------------------- 43 | //shape is a value between -1 and 1 44 | static inline float valueShaperI2F(uint8_t data2, float shape) 45 | { 46 | 47 | const float k = 2*shape/(1.0001f-shape); 48 | const float val = (data2)/127.f; 49 | return ((1+k)*val/(1+k*fabsf(val))); 50 | } 51 | //------------------------------------------------------------- 52 | static inline float valueShaperF2F(float val, float shape) 53 | { 54 | const float k = 2*shape/(1.0001f-shape); 55 | return ((1+k)*val/(1+k*fabsf(val))); 56 | } 57 | //------------------------------------------------------------- 58 | #endif /* VALUESHAPER_H_ */ 59 | -------------------------------------------------------------------------------- /mainboard/LxrStm32_bootloader/src/uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Uart.h 3 | * 4 | * handles the uart init and communication 5 | * usart3 is front panel communication (PD8 TX, PD9 RX) 6 | * 7 | * Created on: 11.07.2012 8 | * ------------------------------------------------------------------------------------------------------------------------ 9 | * Copyright 2013 Julian Schmidt 10 | * Julian@sonic-potions.com 11 | * ------------------------------------------------------------------------------------------------------------------------ 12 | * This file is part of the Sonic Potions LXR drumsynth firmware. 13 | * ------------------------------------------------------------------------------------------------------------------------ 14 | * Redistribution and use of the LXR code or any derivative works are permitted 15 | * provided that the following conditions are met: 16 | * 17 | * - The code may not be sold, nor may it be used in a commercial product or activity. 18 | * 19 | * - Redistributions that are modified from the original source must include the complete 20 | * source code, including the source code for all components used by a binary built 21 | * from the modified sources. However, as a special exception, the source code distributed 22 | * need not include anything that is normally distributed (in either source or binary form) 23 | * with the major components (compiler, kernel, and so on) of the operating system on which 24 | * the executable runs, unless that component itself accompanies the executable. 25 | * 26 | * - Redistributions must reproduce the above copyright notice, this list of conditions and the 27 | * following disclaimer in the documentation and/or other materials provided with the distribution. 28 | * ------------------------------------------------------------------------------------------------------------------------ 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 30 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 31 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 34 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 35 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | * ------------------------------------------------------------------------------------------------------------------------ 37 | */ 38 | 39 | 40 | #ifndef UART_H_ 41 | #define UART_H_ 42 | 43 | #include "stm32f4xx.h" 44 | #include "globals.h" 45 | #include "Fifo.h" 46 | 47 | 48 | 49 | void uart_init(); 50 | //wait indefinitely until new data is received 51 | uint8_t uart_rx(); 52 | //wait for 'timeout' [ms] if data is received 53 | //return data (uint8_t value) if data is received 54 | //or -1 if a timeout occurs 55 | int16_t uart_rxTimeout(uint16_t timeout); 56 | //sends a byte to the frontpanel 57 | void uart_tx(uint8_t data); 58 | //wait for the front panel to send the INIT_BOOTLOADER message 59 | //returns START_BOOTLOADER if INIT_BOOTLOADER is received 60 | //returns START_PROGRAM if INIT_BOOTLOADER not received after INIT_TIMEOUT ms 61 | uint8_t uart_waitForInitCommand(); 62 | #endif 63 | 64 | --------------------------------------------------------------------------------