Skip to content

Commit

Permalink
#6 Added FakeArduino to native env
Browse files Browse the repository at this point in the history
but now regular builds won't upload which is super annoying
  • Loading branch information
wraybowling committed Sep 18, 2020
1 parent e7a1dd8 commit 7173268
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 58 deletions.
108 changes: 58 additions & 50 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -1,65 +1,73 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env]
platform = atmelavr
board = ATmega328
framework = arduino
upload_flags =
-C
$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p
m328
-b
115200
-c
usbtiny
-C $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p m328
-b 115200
-c usbtiny
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
test_ignore =
examples
test_desktop
examples
test_desktop

; [env:native]
; platform = native
; test_ignore = examples ;enables test_desktop folder
[env:native]
platform = native
build_flags = -std=gnu++11
test_ignore = examples
lib_deps =
ArduinoFake

[env:USBtiny ISP]
; build_flags=-std=c++11
; board = ATmega328
; framework = arduino
upload_protocol = usbtiny
upload_flags =
-c usbtiny

; [env:AVRISP mkII]
; upload_protocol = stk500v2
; upload_flags =
; -Pusb

; [env:Arduino ISP]
; upload_protocol = arduinoisp
[env:AVRISP mkII]
upload_protocol = stk500v2
upload_flags =
-P usb

; [env:Arduino as ISP]
; upload_protocol = stk500v1
; upload_flags =
; -P$UPLOAD_PORT
; -b$UPLOAD_SPEED
[env:Arduino ISP]
upload_protocol = arduinoisp

; ; edit these lines
; upload_port = SERIAL_PORT_HERE
; upload_speed = 19200
[env:Arduino as ISP]
upload_protocol = stk500v1
upload_flags =
-P$UPLOAD_PORT
-b$UPLOAD_SPEED
upload_port = SERIAL_PORT_HERE
upload_speed = 19200

; [env:USBasp]
; upload_protocol = usbasp
; upload_flags =
; -Pusb

; [env:Parallel Programmer]
; upload_protocol = dapa
; upload_flags =
; -F
[env:USBasp]
board = ATmega328
framework = arduino
upload_protocol = usbasp
upload_flags =
-C $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p m328
-b 115200
-P usb
-c usbasp

; [env:BusPirate as ISP]
; upload_protocol = buspirate
; upload_flags =
; -P$UPLOAD_PORT
; -b$UPLOAD_SPEED
[env:Parallel Programmer]
upload_protocol = dapa
upload_flags =
-F

; ; edit these lines
; upload_port = SERIAL_PORT_HERE
; upload_speed = 115200
[env:BusPirate as ISP]
upload_protocol = buspirate
upload_flags =
-P $UPLOAD_PORT
-b $UPLOAD_SPEED
upload_port = SERIAL_PORT_HERE
upload_speed = 115200
9 changes: 7 additions & 2 deletions src/Debounce.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
*/

#pragma once
#include <Arduino.h>
#ifdef UNIT_TEST
#include "ArduinoFake.h"
#else
#include "Arduino.h"
#endif

class DebouncedBoolean {
public:
Expand All @@ -24,7 +28,8 @@ class DebouncedBoolean {
return state[0] == false && state[1] == true;
}
void reset() {
state[2] = {false};
state[0] = false;
state[1] = false;
}
};

Expand Down
10 changes: 7 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
* https://github.com/MicroWrave/tri-plus-ger/wiki
*/

#include <Arduino.h>
#ifdef UNIT_TEST
#include "ArduinoFake.h"
#else
#include "Arduino.h"
#endif
// #include <EEPROM.h>
#define DEBUG true

Expand All @@ -23,7 +27,7 @@
//// global state

// clock out
Clock clock;
Clock masterclock;
unsigned long clock_until = 0;

// arcade buttons
Expand Down Expand Up @@ -109,7 +113,7 @@ void loop() {
prev_clock_div_knob__val = clock_div_knob__val;

// clock advancement
if( clock.isHigh(tempo_value, clock_input_multiplier, time) ) {
if( masterclock.isHigh(tempo_value, clock_input_multiplier, time) ) {

// write state for previous step
if(isRecording) {
Expand Down
7 changes: 6 additions & 1 deletion src/peaks_pattern_predictor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
#ifndef PATTERN_PREDICTOR_H
#define PATTERN_PREDICTOR_H

#include <Arduino.h>
#ifdef UNIT_TEST
#include "ArduinoFake.h"
// #include <stdint.h>
#else
#include "Arduino.h"
#endif
// #include <cstdint>
// #include <stddef.h>
// #include <stdint.h>
Expand Down
4 changes: 2 additions & 2 deletions test/test_desktop/clock-test.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <unity.h>
#include "../src/clock.h"

Clock clock;
Clock masterclock;

const int example = 1;
const int example = 2;

void test_equality(void) {
TEST_ASSERT_EQUAL_INT(2, example);
Expand Down

0 comments on commit 7173268

Please sign in to comment.