Skip to content

Commit

Permalink
third commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Mar 15, 2021
1 parent e4a36ad commit 15ea1a3
Show file tree
Hide file tree
Showing 14 changed files with 156 additions and 11,990 deletions.
1 change: 1 addition & 0 deletions bleepbloopmachine/.gitignore
@@ -0,0 +1 @@
build/
5 changes: 3 additions & 2 deletions bleepbloopmachine/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.0.0)
cmake_minimum_required(VERSION 3.19.0)
project(bleepbloopmachine CXX)
add_executable(bleepbloopmachine main.cc)
add_executable(bleepbloopmachine src/main.cc)
target_link_arduino_libraries(bleepbloopmachine AUTO_PUBLIC)
target_enable_arduino_upload(bleepbloopmachine)
19 changes: 15 additions & 4 deletions bleepbloopmachine/README.md
Expand Up @@ -5,9 +5,8 @@
```sh
mkdir build
cd build
cmake -D CMAKE_TOOLCHAIN_FILE=/home/chee/projects/Arduino-CMake-Toolchain/Arduino-toolchain.cmake
-D CMAKE_EXPORT_COMPILE_COMMANDS=1 ..
ln build/compile_commands.json ..
cmake -D CMAKE_TOOLCHAIN_FILE=/home/chee/projects/Arduino-CMake-Toolchain/Arduino-toolchain.cmake -D CMAKE_EXPORT_COMPILE_COMMANDS=1 ..
ln -s build/compile_commands.json ..
```

then uncomment the pygamer lines in the generated `BoardOptions.cmake`, then run
Expand All @@ -18,5 +17,17 @@ the cmake command again and run `make` to build it.
if you keep this running, emacs will know about the new includes when you do an lsp-workspace-restart

```sh
watchexec -e cc,h -w .. 'cmake -D CMAKE_TOOLCHAIN_FILE=/home/chee/projects/Arduino-CMake-Toolchain/Arduino-toolchain.cmake -D CMAKE_EXPORT_COMPILE_COMMANDS=1 ..'
watchexec -e cpp,h -w .. 'cmake -D CMAKE_TOOLCHAIN_FILE=/home/chee/projects/Arduino-CMake-Toolchain/Arduino-toolchain.cmake -D CMAKE_EXPORT_COMPILE_COMMANDS=1 ..'
```

## uh ignore all that
i'm using arduino-builder now

## disregard that previous message
you can fix the problems with not being able to find libraries by symlinking the folder in ~/Arduino/libraries to whatever the header file is that can't be found

por exomp:

```sh
ln -s Adafruit_BusIO Adafruit_I2CDevice
```
11,902 changes: 0 additions & 11,902 deletions bleepbloopmachine/TAGS

This file was deleted.

9 changes: 0 additions & 9 deletions bleepbloopmachine/bleepbloopmachine.ino

This file was deleted.

1 change: 0 additions & 1 deletion bleepbloopmachine/compile_commands.json

This file was deleted.

46 changes: 46 additions & 0 deletions bleepbloopmachine/lib/README
@@ -0,0 +1,46 @@

This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.

The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").

For example, see a structure of the following two libraries `Foo` and `Bar`:

|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c

and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>

int main (void)
{
...
}

```

PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
57 changes: 0 additions & 57 deletions bleepbloopmachine/main.cc

This file was deleted.

8 changes: 0 additions & 8 deletions bleepbloopmachine/main.cpp

This file was deleted.

Empty file removed bleepbloopmachine/main.h
Empty file.
7 changes: 0 additions & 7 deletions bleepbloopmachine/sketch.json

This file was deleted.

79 changes: 79 additions & 0 deletions bleepbloopmachine/src/main.cc
@@ -0,0 +1,79 @@
#include "main.h"
#include <Arduino.h>

#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>
#define TFT_CS 44
#define TFT_RST 46
#define TFT_DC 45
#define TFT_BACKLIGHT 47

//#include "Adafruit_SPIFlash.h"
#include "Adafruit_TinyUSB.h"
#include "AudioStream.h"
#include "output_dacs.h"

#include <Adafruit_NeoPixel.h>
#include <Audio.h>

Adafruit_ST7735 display = Adafruit_ST7735(&SPI1, TFT_CS, TFT_DC, TFT_RST);

class Wave {};

class BleepBloopMachine {
menu_mode mode = menu_mode::live;
float bpm = 120.0;
int current_tick = 0;
int bar_of_ticks = 255;
int selected_sound_index = 0;
int selected_menu1_control = 0;
int selected_menu2_control = 0;
int selected_wave_index = 0;
// Wave[] & waves[4];
// TODO this needs to be whatever
int last_keys;
};

// pygamer specific
Adafruit_NeoPixel neopixels(5, 8, NEO_GRB);

/* there are only monophonic noises on this one so far :)
* but this will need updated for:
* - chords
* - panning
* - each instrument should perhaps have its own mixer?
AudioMixer4 q_mixer;
AudioMixer4 p_mixer;
AudioMixer4 s_mixer;
AudioMixer4 n_mixer;
*/
AudioMixer4 mixer;
AudioOutputAnalogStereo headphones;
AudioConnection left_ear_patch(mixer, 0, headphones, 0);
AudioConnection right_ear_patch(mixer, 0, headphones, 1);

void setup() {
display.initR(INITR_BLACKTAB);
display.setRotation(1);
pinMode(TFT_BACKLIGHT, OUTPUT);
digitalWrite(TFT_BACKLIGHT, HIGH);
display.fillScreen(ST77XX_BLACK);
display.fillScreen(ST77XX_YELLOW);
display.drawCircle(0, 10, 20, ST77XX_BLACK);
// arcada.arcadaBegin();
// arcada.filesysBeginMSD();
// arcada.displayBegin();
// arcada.setBacklight(255);
// arcada.drawBMP((char *)"icon.bmp", 0, 0);
neopixels.begin();
neopixels.setBrightness(180);
}

void loop() {
// arcada.readButtons();
// uint8_t buttons = arcada.pressed();
// int16_t joyX = arcada.readJoystickX();
// int16_t joyY = arcada.readJoystickY();
}
1 change: 1 addition & 0 deletions bleepbloopmachine/src/main.h
@@ -0,0 +1 @@
enum class menu_mode { live, menu1, menu2 };
11 changes: 11 additions & 0 deletions bleepbloopmachine/test/README
@@ -0,0 +1,11 @@

This directory is intended for PlatformIO Unit Testing and project tests.

Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.

More information about PlatformIO Unit Testing:
- https://docs.platformio.org/page/plus/unit-testing.html

0 comments on commit 15ea1a3

Please sign in to comment.