Permalink
Browse files

mega update

holy hell. Lots of things to check in. no idea, sorry. :-\ Just trying
to get back into development after a 2 year hiatus.
  • Loading branch information...
stevecooley committed Sep 21, 2013
1 parent a9f478b commit 3e7434f5d6b4394a73a8e5abb3138710207c00c1
Showing with 100,985 additions and 546 deletions.
  1. +285 −112 arduino_code/beatseqr_arduino_firmware/Button.cpp
  2. +69 −61 arduino_code/beatseqr_arduino_firmware/Button.h
  3. +84 −84 arduino_code/beatseqr_arduino_firmware/LED.cpp
  4. +51 −51 arduino_code/beatseqr_arduino_firmware/LED.h
  5. +13 −2 arduino_code/beatseqr_arduino_firmware/PString.cpp
  6. +9 −2 arduino_code/beatseqr_arduino_firmware/PString.h
  7. +36 −36 arduino_code/beatseqr_arduino_firmware/Potentiometer.cpp
  8. +26 −25 arduino_code/beatseqr_arduino_firmware/Potentiometer.h
  9. +51 −33 arduino_code/beatseqr_arduino_firmware/config.h
  10. 0 arduino_code/beatseqr_arduino_firmware/eeprom.pde
  11. +236 −63 arduino_code/beatseqr_arduino_firmware_4/Button.cpp
  12. +46 −38 arduino_code/beatseqr_arduino_firmware_4/Button.h
  13. +1 −1 arduino_code/beatseqr_arduino_firmware_4/LED.h
  14. +13 −2 arduino_code/beatseqr_arduino_firmware_4/PString.cpp
  15. +10 −3 arduino_code/beatseqr_arduino_firmware_4/PString.h
  16. +2 −1 arduino_code/beatseqr_arduino_firmware_4/Potentiometer.h
  17. +16 −5 ...e/beatseqr_arduino_firmware_4/{beatseqr_arduino_firmware_4.pde → beatseqr_arduino_firmware_4.ino}
  18. +20 −15 arduino_code/beatseqr_arduino_firmware_4/config.h
  19. +197 −0 arduino_code/beatseqr_arduino_firmware_4/diagnostics.ino
  20. +10 −0 arduino_code/beatseqr_arduino_firmware_4/eeprom.ino
  21. +0 −1 arduino_code/beatseqr_arduino_firmware_4/eeprom.pde
  22. 0 arduino_code/beatseqr_arduino_firmware_4/{knob_routine.pde → knob_routine.ino}
  23. 0 arduino_code/beatseqr_arduino_firmware_4/{pattern_select_routine.pde → pattern_select_routine.ino}
  24. 0 arduino_code/beatseqr_arduino_firmware_4/{serial_utilities.pde → serial_utilities.ino}
  25. 0 arduino_code/beatseqr_arduino_firmware_4/{step_button_routine.pde → step_button_routine.ino}
  26. +145 −0 arduino_code/beatseqr_arduino_firmware_4/transport_button_routine.ino
  27. +320 −0 arduino_code/beatseqr_arduino_firmware_4/voice_select_button_routine.ino
  28. 0 arduino_code/beatseqr_arduino_firmware_4/{voice_slider_routine.pde → voice_slider_routine.ino}
  29. +6 −3 arduino_code/beatseqr_arduino_firmware_4_experimental/config.h
  30. +99 −5 arduino_code/beatseqr_arduino_firmware_4_experimental/step_button_routine.ino
  31. +67 −0 arduino_code/synthseqr_software/synthseqr_AnalogInput_test/synthseqr_AnalogInput_test.pde
  32. +311 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/Button.cpp
  33. +78 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/Button.h
  34. +84 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/LED.cpp
  35. +51 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/LED.h
  36. +36 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/Potentiometer.cpp
  37. +25 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/Potentiometer.h
  38. +307 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/config.h
  39. +197 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/diagnostics.pde
  40. +10 −0 arduino_code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/eeprom.pde
  41. +265 −0 ...de/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/pattern_select_routine.pde
  42. +204 −0 ..._code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/step_button_routine.pde
  43. +137 −0 ...hseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/synthtseqr_arduino_firmware_1.pde
  44. +13 −0 ...synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1}/transport_button_routine.pde
  45. +3 −0 ...thseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1}/voice_select_button_routine.pde
  46. +422 −0 ...code/synthseqr_software/synthseqr_firmware/synthtseqr_arduino_firmware_1/voice_slider_routine.pde
  47. +314 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/Button.cpp
  48. +78 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/Button.h
  49. +84 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/LED.cpp
  50. +51 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/LED.h
  51. +458 −0 ...ode/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/MenuBackend/LICENSE.txt
  52. +264 −0 ...e/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/MenuBackend/MenuBackend.h
  53. +114 −0 ...e/synthseqr_firmware_experimental/synthseqr_firmware/MenuBackend/examples/HelloMenu/HelloMenu.pde
  54. +24 −0 ...synthseqr_firmware_experimental/synthseqr_firmware/MenuBackend/examples/HelloMenu/printresult.txt
  55. +46 −0 ...de/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/MenuBackend/keywords.txt
  56. +60 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/PString.cpp
  57. +87 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/PString.h
  58. +36 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/Potentiometer.cpp
  59. +25 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/Potentiometer.h
  60. +193 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/config.h
  61. +130 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/diagnostics.ino
  62. +264 −0 .../synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/pattern_select_routine.ino
  63. +127 −0 ...ino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/serial_routine.ino
  64. +204 −0 ...ode/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/step_button_routine.ino
  65. +83 −0 ...code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/synthseqr_firmware.ino
  66. +146 −0 arduino_code/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/transport.ino
  67. +526 −0 ...de/synthseqr_software/synthseqr_firmware_experimental/synthseqr_firmware/voice_slider_routine.ino
  68. +311 −0 arduino_code/synthseqr_software/synthseqr_test_suite/Button.cpp
  69. +78 −0 arduino_code/synthseqr_software/synthseqr_test_suite/Button.h
  70. +84 −0 arduino_code/synthseqr_software/synthseqr_test_suite/LED.cpp
  71. +51 −0 arduino_code/synthseqr_software/synthseqr_test_suite/LED.h
  72. +36 −0 arduino_code/synthseqr_software/synthseqr_test_suite/Potentiometer.cpp
  73. +25 −0 arduino_code/synthseqr_software/synthseqr_test_suite/Potentiometer.h
  74. +171 −0 arduino_code/synthseqr_software/synthseqr_test_suite/synthseqr_test_suite.pde
  75. +186 −0 peggy2/peggy2_beatseqr_visualizer_01/peggy2_beatseqr_visualizer_01.pde
  76. +169 −0 peggy2/peggy2_beatseqr_visualizer_02/peggy2_beatseqr_visualizer_02.pde
  77. +17 −3 processing_code/roxor_2/roxor_2.pde
  78. +145 −0 processing_code/synthseqr_communicator/cc_from_interface.pde
  79. BIN processing_code/synthseqr_communicator/data/netlabel-square-ends-20.vlw
  80. BIN processing_code/synthseqr_communicator/data/netlabel-square-ends-32.vlw
  81. +145 −0 processing_code/synthseqr_communicator/notenumberfunctions_from_interface.pde
  82. +789 −0 processing_code/synthseqr_communicator/synthseqr_communicator.pde
  83. +145 −0 processing_code/synthseqr_communicator/vl_from_interface.pde
  84. BIN steppa/steppa062/steppa.zip
  85. BIN steppa/steppa062/steppa061_win.zip
  86. BIN steppa/steppa064/Archive.zip
  87. +2,304 −0 steppa/steppa064/cc_row.maxpat
  88. +62,747 −0 steppa/steppa064/ccrecord.maxpat
  89. +741 −0 steppa/steppa064/ccreseeva.maxpat
  90. +81 −0 steppa/steppa064/debug.maxpat
  91. +3,370 −0 steppa/steppa064/dieroxor.maxpat
  92. +3,432 −0 steppa/steppa064/dieroxor2.maxpat
  93. +48 −0 steppa/steppa064/read_me.txt
  94. +6,031 −0 steppa/steppa064/roxor_row.maxpat
  95. +14 −0 steppa/steppa064/stepdataformatter.js
  96. +12,596 −0 steppa/steppa064/steppa.maxpat
  97. BIN steppa/steppa064/steppa064.app.zip
  98. BIN steppa/steppa064/steppa_for_synthseqr_b2.zip
  99. BIN steppa/steppa064/steppa_logo.jpg
  100. BIN steppa/steppa24/steppa024.zip
  101. BIN steppa/steppa_061.app.zip
  102. BIN steppa/steppa_062.app.zip
View
@@ -1,112 +1,285 @@
/*
||
|| @file Button.cpp
|| @version 1.6
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Provide an easy way of making buttons
|| #
||
|| @license
|| | Copyright (c) 2009 Alexander Brevig. All rights reserved.
|| | This code is subject to AlphaLicence.txt
|| | alphabeta.alexanderbrevig.com/AlphaLicense.txt
|| #
||
*/
//include the class definition
#include "Button.h"
/*
|| <<constructor>>
|| @parameter buttonPin sets the pin that this switch is connected to
|| @parameter buttonMode indicates PULLUP or PULLDOWN resistor
*/
Button::Button(uint8_t buttonPin, uint8_t buttonMode){
this->pin=buttonPin;
pinMode(pin,INPUT);
buttonMode==PULLDOWN ? pulldown() : pullup();
state = 0;
bitWrite(state,CURRENT,!mode);
}
/*
|| Set pin HIGH as default
*/
void Button::pullup(void){
mode=PULLUP;
digitalWrite(pin,HIGH);
}
/*
|| Set pin LOW as default
*/
void Button::pulldown(void){
mode=PULLDOWN;
//digitalWrite(pin,LOW);
}
/*
|| Return the bitWrite(state,CURRENT, of the switch
*/
bool Button::isPressed(void){
bitWrite(state,PREVIOUS,bitRead(state,CURRENT));
if (digitalRead(pin) == mode){
bitWrite(state,CURRENT,false);
} else {
bitWrite(state,CURRENT,true);
}
if (bitRead(state,CURRENT) != bitRead(state,PREVIOUS)){
bitWrite(state,CHANGED,true);
}else{
bitWrite(state,CHANGED,false);
}
return bitRead(state,CURRENT);
}
/*
|| Return true if the button has been pressed
*/
bool Button::wasPressed(void){
if (bitRead(state,CURRENT)){
return true;
} else {
return false;
}
}
/*
|| Return true if state has been changed
*/
bool Button::stateChanged(void){
return bitRead(state,CHANGED);
}
/*
|| Return true if the button is pressed, and was not pressed before
*/
bool Button::uniquePress(void){
return (isPressed() && stateChanged());
}
/*
|| @changelog
|| | 2009-05-05 - Alexander Brevig : Added uniquePress()
|| | 2009-04-24 - Alexander Brevig : Added wasPressed()
|| | 2009-04-12 - Alexander Brevig : Added constructor
|| | Shortened logic
|| | 2009-04-10 - Alexander Brevig : Namechange from Switch
|| | 2009-04-07 - Alexander Brevig : Altered API
|| | 2008-10-23 - Alexander Brevig : Initial Release
|| | 2008-10-22 - Alexander Brevig : Class implemented
|| #
*/
/* $Id$
||
|| @file Button.cpp
|| @author Alexander Brevig <alexanderbrevig@gmail.com>
|| @url http://alexanderbrevig.com
||
|| @description
|| | This is a Hardware Abstraction Library for Buttons
|| | It provides an easy way of handling buttons
|| #
||
|| @license LICENSE_REPLACE
||
*/
#include <Arduino.h>
#include "Button.h"
#define CURRENT 0
#define PREVIOUS 1
#define CHANGED 2
/*
|| @constructor
|| | Set the initial state of this button
|| #
||
|| @parameter buttonPin sets the pin that this switch is connected to
|| @parameter buttonMode indicates BUTTON_PULLUP or BUTTON_PULLDOWN resistor
*/
Button::Button(uint8_t buttonPin, uint8_t buttonMode){
pin=buttonPin;
pinMode(pin,INPUT);
buttonMode==BUTTON_PULLDOWN ? pulldown() : pullup(buttonMode);
state = 0;
bitWrite(state,CURRENT,!mode);
cb_onPress = 0;
cb_onRelease = 0;
cb_onClick = 0;
cb_onHold = 0;
numberOfPresses = 0;
triggeredHoldEvent = true;
}
/*
|| @description
|| | Prepare logic for a pullup button.
|| | If mode is internal set pin HIGH as default
|| #
*/
void Button::pullup(uint8_t buttonMode)
{
mode=BUTTON_PULLUP;
if (buttonMode == BUTTON_PULLUP_INTERNAL)
{
digitalWrite(pin,HIGH);
}
}
/*
|| @description
|| | Set pin LOW as default
|| #
*/
void Button::pulldown(void)
{
mode=BUTTON_PULLDOWN;
}
/*
|| @description
|| | Return the bitRead(state,CURRENT) of the switch
|| #
||
|| @return true if button is pressed
*/
bool Button::isPressed(void)
{
//save the previous value
bitWrite(state,PREVIOUS,bitRead(state,CURRENT));
//get the current status of the pin
if (digitalRead(pin) == mode)
{
//currently the button is not pressed
bitWrite(state,CURRENT,false);
}
else
{
//currently the button is pressed
bitWrite(state,CURRENT,true);
}
//handle state changes
if (bitRead(state,CURRENT) != bitRead(state,PREVIOUS))
{
//the state changed to PRESSED
if (bitRead(state,CURRENT) == true)
{
numberOfPresses++;
if (cb_onPress) { cb_onPress(*this); } //fire the onPress event
pressedStartTime = millis(); //start timing
triggeredHoldEvent = false;
}
else //the state changed to RELEASED
{
if (cb_onRelease) { cb_onRelease(*this); } //fire the onRelease event
if (cb_onClick) { cb_onClick(*this); } //fire the onClick event AFTER the onRelease
//reset states (for timing and for event triggering)
pressedStartTime = -1;
}
//note that the state changed
bitWrite(state,CHANGED,true);
}
else
{
//note that the state did not change
bitWrite(state,CHANGED,false);
//should we trigger a onHold event?
if (pressedStartTime!=-1 && !triggeredHoldEvent)
{
if (millis()-pressedStartTime > holdEventThreshold)
{
if (cb_onHold)
{
cb_onHold(*this);
triggeredHoldEvent = true;
}
}
}
}
return bitRead(state,CURRENT);
}
/*
|| @description
|| | Return true if the button has been pressed
|| #
*/
bool Button::wasPressed(void)
{
return bitRead(state,CURRENT);
}
/*
|| @description
|| | Return true if state has been changed
|| #
*/
bool Button::stateChanged(void)
{
return bitRead(state,CHANGED);
}
/*
|| @description
|| | Return true if the button is pressed, and was not pressed before
|| #
*/
bool Button::uniquePress(void)
{
return (isPressed() && stateChanged());
}
/*
|| @description
|| | onHold polling model
|| | Check to see if the button has been pressed for time ms
|| | This will clear the counter for next iteration and thus return true once
|| #
*/
bool Button::held(unsigned int time /*=0*/)
{
unsigned int threshold = time ? time : holdEventThreshold; //use holdEventThreshold if time == 0
//should we trigger a onHold event?
if (pressedStartTime!=-1 && !triggeredHoldEvent)
{
if (millis()-pressedStartTime > threshold)
{
triggeredHoldEvent = true;
return true;
}
}
return false;
}
/*
|| @description
|| | Polling model for holding, this is true every check after hold time
|| | Check to see if the button has been pressed for time ms
|| #
*/
bool Button::heldFor(unsigned int time)
{
if (isPressed())
{
if (millis()-pressedStartTime > time) { return true; }
}
return false;
}
/*
|| @description
|| | Set the hold event time threshold
|| #
*/
void Button::setHoldThreshold(unsigned int holdTime)
{
holdEventThreshold = holdTime;
}
/*
|| @description
|| | Register a handler for presses on this button
|| #
||
|| @parameter handler The function to call when this button is pressed
*/
void Button::pressHandler(buttonEventHandler handler)
{
cb_onPress = handler;
}
/*
|| @description
|| | Register a handler for releases on this button
|| #
||
|| @parameter handler The function to call when this button is released
*/
void Button::releaseHandler(buttonEventHandler handler)
{
cb_onRelease = handler;
}
/*
|| @description
|| | Register a handler for clicks on this button
|| #
||
|| @parameter handler The function to call when this button is clicked
*/
void Button::clickHandler(buttonEventHandler handler)
{
cb_onClick = handler;
}
/*
|| @description
|| | Register a handler for when this button is held
|| #
||
|| @parameter handler The function to call when this button is held
*/
void Button::holdHandler(buttonEventHandler handler, unsigned int holdTime /*=0*/)
{
if (holdTime>0) { setHoldThreshold(holdTime); }
cb_onHold = handler;
}
/*
|| @description
|| | Get the time this button has been held
|| #
||
|| @return The time this button has been held
*/
unsigned int Button::holdTime() const { if (pressedStartTime!=-1) { return millis()-pressedStartTime; } else return 0; }
/*
|| @description
|| | Compare a button object against this
|| #
||
|| @parameter rhs the Button to compare against this Button
||
|| @return true if they are the same
*/
bool Button::operator==(Button &rhs)
{
return (this==&rhs);
}
Oops, something went wrong.

0 comments on commit 3e7434f

Please sign in to comment.