Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refactoring
revamped entire board dir
faster pad readout
get rid of dim led state (replace with blinking)
various other tweaks
  • Loading branch information
paradajz committed Apr 15, 2018
1 parent 576fa0a commit d772788
Show file tree
Hide file tree
Showing 62 changed files with 1,552 additions and 1,251 deletions.
12 changes: 9 additions & 3 deletions doxyfile
Expand Up @@ -859,8 +859,8 @@ FILE_PATTERNS = *.c \
*.vhdl \
*.ucf \
*.qsf \
*.txt \
*.dox
*.txt \
*.dox

# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
Expand All @@ -874,10 +874,16 @@ RECURSIVE = YES
#
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE += ./Documentation
EXCLUDE += ./src/Build
EXCLUDE += ./src/modules
EXCLUDE += ./src/application/board/avr/usb/midi/Descriptors.c
EXCLUDE += ./src/application/board/avr/usb/midi/Descriptors.h
EXCLUDE += ./src/application/board/avr/usb/vserial/VSerial.c
EXCLUDE += ./src/application/board/avr/usb/vserial/VSerial.h
EXCLUDE += ./src/application/board/avr/usb/vserial/Descriptors.c
EXCLUDE += ./src/application/board/avr/usb/vserial/Descriptors.h

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
10 changes: 9 additions & 1 deletion src/.vscode/settings.json
Expand Up @@ -13,6 +13,14 @@
"xmemory0": "cpp",
"xtr1common": "cpp",
"xutility": "cpp",
"iosfwd": "cpp"
"iosfwd": "cpp",
"*.ipp": "cpp",
"array": "cpp",
"chrono": "cpp",
"limits": "cpp",
"atomic": "cpp",
"slist": "cpp",
"ratio": "cpp",
"system_error": "cpp"
},
}
6 changes: 4 additions & 2 deletions src/Defines.mk
Expand Up @@ -29,15 +29,17 @@ else
USE_FLASH_DESCRIPTORS \
INTERRUPT_CONTROL_ENDPOINT \
MIDI_SYSEX_ARRAY_SIZE=45 \
RING_BUFFER_SIZE=50
RING_BUFFER_SIZE=50 \
LED_INVERT
endif

ifeq ($(findstring debug,$(MAKECMDGOALS)), debug)
DEFINES += \
DEBUG
else
DEFINES += \
NDEBUG
NDEBUG \
START_UP_ANIMATION
endif

#board specific
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Expand Up @@ -30,7 +30,7 @@ LDFLAGS := -Wl,--gc-sections -mrelax -Wl,--start-group -Wl,-lm -Wl,--end-group
#optimisation level
ifneq ($(filter fw_%, $(MAKECMDGOALS)), )
#firmware
OPT := -O2
OPT := -O3
else
#optimize for size for bootloader
OPT := -Os
Expand Down
17 changes: 12 additions & 5 deletions src/application/Version.h
@@ -1,19 +1,26 @@
/*
OpenDeck MIDI platform firmware
Copyright (C) 2015-2018 Igor Petrovic
Zvuk9 MIDI controller
Copyright (C) 2014-2017 Ad Bit LLC
Author: Igor Petrović
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You may ONLY use this file:
1) if you have a valid commercial Ad Bit LLC license and then in accordance with
the terms contained in the written license agreement between you and Ad Bit LLC,
or alternatively
2) if you follow the terms found in GNU General Public License version 3 as
published by the Free Software Foundation here
<https://www.gnu.org/licenses/gpl-3.0.txt>
*/

#pragma once
Expand Down
12 changes: 3 additions & 9 deletions src/application/Zvuk9.cpp
Expand Up @@ -35,9 +35,6 @@ MIDI midi;

void startUpAnimation()
{
//slow down fading for effect
leds.setFadeSpeed(3);

ledState_t tempLedStateArray[MAX_NUMBER_OF_LEDS];

for (int i=0; i<MAX_NUMBER_OF_LEDS; i++)
Expand All @@ -62,9 +59,6 @@ void startUpAnimation()
leds.setLEDstate(i, tempLedStateArray[i]);

wait_ms(1000);

//restore normal fade speed
leds.setFadeSpeed(DEFAULT_FADE_SPEED);
}

int main()
Expand Down Expand Up @@ -102,8 +96,6 @@ int main()
pads.init();
encoders.init();

pads.setActiveNoteLEDs(false, 0);

#ifdef START_UP_ANIMATION
startUpAnimation();
#else
Expand All @@ -119,13 +111,15 @@ int main()
display.displayFirmwareUpdated();
#endif

startADCconversion();

while (1)
{
#ifdef DEBUG
CDC_Update();
#endif

// pads.update();
pads.update();
digitalInput.update();
display.update();
leds.update();
Expand Down
60 changes: 7 additions & 53 deletions src/application/board/Board.h
Expand Up @@ -25,59 +25,13 @@

#pragma once

#include "Variables.h"
#include "map/Map.h"
#include "display/u8g2_wrapper.h"
#include "pins/Pins.h"
#include "DataTypes.h"
#include "../interface/digital/output/leds/Variables.h"
#ifdef DEBUG
#include "avr/usb/vserial/VSerial.h"
#endif

///
/// \brief Hardcoded board revision.
/// @{
/// \brief Low-level hardware handling.
/// \defgroup board Board
///

#define HARDWARE_VERSION_MAJOR 3
#define HARDWARE_VERSION_MINOR 0
#define HARDWARE_VERSION_REVISION 0

/// @}

class Board
{
public:
Board();
void init();
void updateVSerial();
bool encoderEnabled(uint8_t encoderNumber);
uint16_t getPadPressure(uint8_t pad);
int16_t getPadX(uint8_t pad);
int16_t getPadY(uint8_t pad);
void reboot(rebootType_t type);
static bool checkNewRevision();

//digital in
static bool digitalInputDataAvailable();
static void continueDigitalInReadout();

//buttons
static bool getButtonState(uint8_t buttonIndex);

//encoders
static int8_t getEncoderState(uint8_t encoderID);

private:
static void initPins();
static void initAnalog();
static void initEncoders();
static void initUSB_MIDI();
static void initUART_MIDI(uint32_t baudRate, bool reInit);
static void initTimers();
static void initPads();
static int8_t readEncoder(uint8_t encoderID, uint8_t pairState);
};

extern Board board;
#ifdef __AVR__
#include "avr/Board.h"
#elif defined STM32
#include "stm32/Board.h"
#endif

0 comments on commit d772788

Please sign in to comment.