Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #69 from jeff-winn/develop
Browse files Browse the repository at this point in the history
Merging develop into master
  • Loading branch information
jeff-winn authored Sep 14, 2020
2 parents d1524df + 20a51e0 commit 28a9c6b
Show file tree
Hide file tree
Showing 86 changed files with 2,328 additions and 1,364 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Visual Studio Code configuration files
**/.vscode/**
!**/.vscode/c_cpp_properties.json
!**/.vscode/extensions.json

# Build configuration outputs
**/build/*
Expand All @@ -16,9 +17,10 @@ libraries
docs/*.~*

# KiCad files
docs/schematics/*.bak
docs/schematics/*.bck
docs/schematics/*-cache.lib
docs/kicad/*.*-bak
docs/kicad/*.bck
docs/kicad/*-cache.lib
docs/kicad/*-rescue.*

# MacOS files
**/.DS_Store
67 changes: 37 additions & 30 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,60 @@
{
"env": {
"librariesPath": "${workspaceFolder}/libraries",
"arduinoDataPath": "${workspaceFolder}/tools/arduino/packages"
"librariesPath": "${env:USERPROFILE}/Documents/Arduino/libraries",
"arduinoDataPath": "${env:LOCALAPPDATA}/Arduino15/packages"
},
"configurations": [
{
"name": "ARM",
"intelliSenseMode": "gcc-x64",
"defines": [
"F_CPU=48000000L",
"ARDUINO=10808",
"ARDUINO_ARCH_SAMD",
"ARDUINO_SAMD_ZERO",
"ARM_MATH_CM0PLUS",
"ADAFRUIT_FEATHER_M0",
"__arm__",
"__SAMD21G18A__"
"F_CPU=64000000",
"ARDUINO=10813",
"ARDUINO_NRF52832_FEATHER",
"ARDUINO_ARCH_NRF52",
"ARDUINO_BSP_VERSION=\"0.20.5\"",
"NRF52832_XXAA",
"NRF52",
"SOFTDEVICE_PRESENT",
"ARDUINO_NRF52_ADAFRUIT",
"NRF52_SERIES",
"LFS_NAME_MAX=64",
"__ENABLE_LOGGING__"
],
"includePath": [
"${workspaceFolder}/Nemesis-Mod/**",
"${librariesPath}/Adafruit_BluefruitLE_nRF51",
"${librariesPath}/Adafruit_FRAM_I2C",
"${librariesPath}/DualG2HighPowerMotorShield",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/cores/arduino",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/variants/feather_m0",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/libraries/Adafruit_ZeroDMA",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/libraries/SPI",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/libraries/Wire",
"${arduinoDataPath}/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL",
"${arduinoDataPath}/arduino/tools/CMSIS/4.5.0/CMSIS/Include"
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/avr/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/cmsis/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/freertos/config/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/freertos/portable/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/freertos/source/include/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/nordic",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/nordic/nrfx",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/nordic/nrfx/drivers/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/nordic/nrfx/hal/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/nordic/nrfx/helpers",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/nordic/nrfx/mdk/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/nordic/nrfx/soc",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/nordic/softdevice/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/TinyUSB",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/cores/nRF5/TinyUSB/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/libraries/**",
"${arduinoDataPath}/adafruit/hardware/nrf52/0.20.5/variants/**",
"${arduinoDataPath}/adafruit/tools/arm-none-eabi-gcc/9-2019q4/arm-none-eabi/include/**"
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${workspaceFolder}/.vscode/temp/cache",
"path": [
"${workspaceFolder}/Nemesis-Mod/*",
"${librariesPath}/Adafruit_BluefruitLE_nRF51/*",
"${librariesPath}/Adafruit_FRAM_I2C/*",
"${librariesPath}/DualG2HighPowerMotorShield/*",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/cores/arduino/*",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/variants/feather_m0/*",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/libraries/Adafruit_ZeroDMA/*",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/libraries/SPI/*",
"${arduinoDataPath}/adafruit/hardware/samd/1.5.4/libraries/Wire/*",
"${arduinoDataPath}/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/*",
"${arduinoDataPath}/arduino/tools/CMSIS/4.5.0/CMSIS/Include/*"
"${workspaceFolder}/**",
"${librariesPath}/**",
"${arduinoDataPath}/**"
]
},
"compilerPath": "${arduinoDataPath}/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-gcc.exe",
"compilerPath": "${arduinoDataPath}/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-g++.exe",
"cStandard": "c11",
"cppStandard": "c++11"
}
Expand Down
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"vsciot-vscode.vscode-arduino",
"ms-vscode.cpptools"
]
}

5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ else
endif

# Arduino CLI Board type
BOARD_TYPE = adafruit:samd
FQBN = $(BOARD_TYPE):adafruit_feather_m0
BOARD_TYPE = adafruit:nrf52
FQBN = $(BOARD_TYPE):feather52832

# Default port to upload to
SERIAL_PORT ?=
Expand All @@ -35,7 +35,6 @@ install_boards:
"$(ARDUINO_CLI)" core install $(BOARD_TYPE)

install_libraries:
"$(ARDUINO_CLI)" lib install "Adafruit BluefruitLE nRF51"
"$(ARDUINO_CLI)" lib install "Adafruit FRAM I2C"
"$(ARDUINO_CLI)" lib install "DualG2HighPowerMotorShield"

Expand Down
18 changes: 17 additions & 1 deletion Nemesis-Mod.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
}
],
"settings": {
"arduino.defaultBaudRate": 115200,
"arduino.logLevel": "info",
"arduino.additionalUrls": [
"https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"
],
"C_Cpp.intelliSenseEngine": "Default",
"editor.tabSize": 4,
"files.exclude": {
".vscode/ipch": true,
".vscode/temp": true,
Expand All @@ -29,7 +35,17 @@
"xloctime": "cpp",
"ios": "cpp",
"cstdbool": "cpp",
"cstdint": "cpp"
"cstdint": "cpp",
"random": "cpp",
"type_traits": "cpp",
"optional": "cpp",
"istream": "cpp",
"ostream": "cpp",
"system_error": "cpp",
"array": "cpp",
"functional": "cpp",
"tuple": "cpp",
"utility": "cpp"
}
}
}
68 changes: 34 additions & 34 deletions Nemesis-Mod/Nemesis-Mod.ino
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
#include <Arduino.h>
#include "src/App.h"
#include "src/Button.h"
#include "src/Log.h"
#include "src/Mainboard.h"

// Defines the driver which controls the flywheel motors.
DualG2HighPowerMotorShield18v18 flywheelDriver(9, -1, 5, -1, A0, 10, -1, 6, -1, A1);
const uint16_t CLEAR_HOLD_IN_MSECS = 30000; // 30 seconds
const uint16_t RESET_HOLD_IN_MSECS = 5000; // 5 seconds
const uint32_t RESET_BUTTON_PIN = 28;

// Defines the driver which controls the belt feed motor.
G2HighPowerMotorShield18v17 beltDriver(17, -1, 11, -1, A2);

// Defines the driver for the onboard bluetooth module.
Adafruit_BluefruitLE_SPI bluetoothDriver(8, 7, 4);

// Defines the FRAM module for persistent data storage.
Adafruit_FRAM_I2C fram;

ConfigurationSettings config(&fram);
Mainboard mainboard;

App* app;
Button ResetButton = Button(RESET_BUTTON_PIN, true);

void setup() {
app = new App(
new FlywheelController(
&mainboard, &flywheelDriver, &config),
new FeedController(
&mainboard, &beltDriver, &config),
new Button(
new DigitalPin(13, &mainboard)),
new Button(
new DigitalPin(12, &mainboard)),
new Button(
new DigitalPin(18, &mainboard), true),
new BluetoothManager(
&bluetoothDriver),
&config,
&mainboard
);

app->init();
Log.waitForUsbConnection();

ResetButton.init();
Application.init();
}

void loop() {
app->run();
if (ResetButton.isPressed()) {
handleResetAttempt();
}
else {
Application.run();
}
}

void handleResetAttempt() {
auto started = millis();
while (ResetButton.isPressed()) {
MCU.delaySafe(50);
}

auto successful = false;
auto diff = millis() - started;

if (diff >= CLEAR_HOLD_IN_MSECS) {
Application.clear();
}
else if (diff >= RESET_HOLD_IN_MSECS) {
Application.reset();
}
}
9 changes: 0 additions & 9 deletions Nemesis-Mod/src/AnalogPin.cpp

This file was deleted.

18 changes: 0 additions & 18 deletions Nemesis-Mod/src/AnalogPin.h

This file was deleted.

Loading

0 comments on commit 28a9c6b

Please sign in to comment.