Skip to content

Commit

Permalink
Updated the component libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEGrayson committed Oct 12, 2016
1 parent 627619b commit 86aa2b7
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 39 deletions.
5 changes: 1 addition & 4 deletions LSM303.h
Expand Up @@ -243,7 +243,7 @@ template <typename T> float LSM303::heading(vector<T> from)
vector_normalize(&N);

// compute heading
float heading = atan2(vector_dot(&E, &from), vector_dot(&N, &from)) * 180 / M_PI;
float heading = atan2(vector_dot(&E, &from), vector_dot(&N, &from)) * 180 / PI;
if (heading < 0) heading += 360;
return heading;
}
Expand All @@ -261,6 +261,3 @@ template <typename Ta, typename Tb> float LSM303::vector_dot(const vector<Ta> *a
}

#endif



28 changes: 13 additions & 15 deletions PololuBuzzer.cpp
Expand Up @@ -31,32 +31,31 @@ static const unsigned int cs2_divider[] = {0, 1, 8, 32, 64, 128, 256, 1024};

unsigned char buzzerInitialized = 0;
volatile unsigned char buzzerFinished = 1; // flag: 0 while playing
const char *buzzerSequence = 0;
const char * volatile buzzerSequence = 0;

// declaring these globals as static means they won't conflict
// with globals in other .cpp files that share the same name
static volatile unsigned int buzzerTimeout = 0; // tracks buzzer time limit
static char play_mode_setting = PLAY_AUTOMATIC;
static volatile char play_mode_setting = PLAY_AUTOMATIC;

extern volatile unsigned char buzzerFinished; // flag: 0 while playing
extern const char *buzzerSequence;
extern const char * volatile buzzerSequence;


static unsigned char use_program_space; // boolean: true if we should
static volatile unsigned char use_program_space; // boolean: true if we should
// use program space

// music settings and defaults
static unsigned char octave = 4; // the current octave
static unsigned int whole_note_duration = 2000; // the duration of a whole note
static unsigned int note_type = 4; // 4 for quarter, etc
static unsigned int duration = 500; // the duration of a note in ms
static unsigned int volume = 15; // the note volume
static unsigned char staccato = 0; // true if playing staccato
static volatile unsigned char octave = 4; // the current octave
static volatile unsigned int whole_note_duration = 2000; // the duration of a whole note
static volatile unsigned int note_type = 4; // 4 for quarter, etc
static volatile unsigned int duration = 500; // the duration of a note in ms
static volatile unsigned int volume = 15; // the note volume
static volatile unsigned char staccato = 0; // true if playing staccato

// staccato handling
static unsigned char staccato_rest_duration; // duration of a staccato
// rest, or zero if it is time
// to play a note
static volatile unsigned char staccato_rest_duration; // duration of a staccato rest,
// or zero if it is time to play a note

static void nextNote();

Expand Down Expand Up @@ -615,8 +614,7 @@ static void nextNote()
goto parse_character;
case 'o':
// set the octave permanently
octave = getNumber();
tmp_octave = octave;
octave = tmp_octave = getNumber();
goto parse_character;
case 'r':
// Rest - the note value doesn't matter.
Expand Down
9 changes: 5 additions & 4 deletions QTRSensors.cpp
Expand Up @@ -46,6 +46,8 @@ void QTRSensors::init(unsigned char *pins, unsigned char numSensors,
calibratedMinimumOff=0;
calibratedMaximumOff=0;

_lastValue=0; // assume initially that the line is left.

if (numSensors > QTR_MAX_SENSORS)
_numSensors = QTR_MAX_SENSORS;
else
Expand Down Expand Up @@ -317,7 +319,6 @@ int QTRSensors::readLine(unsigned int *sensor_values,
unsigned long avg; // this is for the weighted total, which is long
// before division
unsigned int sum; // this is for the denominator which is <= 64000
static int last_value=0; // assume initially that the line is left.

readCalibrated(sensor_values, readMode);

Expand All @@ -344,7 +345,7 @@ int QTRSensors::readLine(unsigned int *sensor_values,
if(!on_line)
{
// If it last read to the left of center, return 0.
if(last_value < (_numSensors-1)*1000/2)
if(_lastValue < (_numSensors-1)*1000/2)
return 0;

// If it last read to the right of center, return the max.
Expand All @@ -353,9 +354,9 @@ int QTRSensors::readLine(unsigned int *sensor_values,

}

last_value = avg/sum;
_lastValue = avg/sum;

return last_value;
return _lastValue;
}


Expand Down
1 change: 1 addition & 0 deletions QTRSensors.h
Expand Up @@ -141,6 +141,7 @@ class QTRSensors
unsigned char _numSensors;
unsigned char _emitterPin;
unsigned int _maxValue; // the maximum value returned by this function
int _lastValue;

private:

Expand Down
2 changes: 1 addition & 1 deletion USBPause.h
@@ -1,4 +1,4 @@
// Copyright Pololu Corporation. For more information, see http://www.pololu.com/
// Copyright Pololu Corporation. For more information, see https://www.pololu.com/

/*! \file USBPause.h
*
Expand Down
16 changes: 8 additions & 8 deletions components.txt
@@ -1,9 +1,9 @@

https://github.com/pololu/fastgpio-arduino 1.0.2-1-ga80ffb9
https://github.com/pololu/usb-pause-arduino 1.0.0-1-gdc0010e
https://github.com/pololu/pushbutton-arduino 1.1.1
https://github.com/pololu/pololu-buzzer-arduino 1.0.0
https://github.com/pololu/pololu-hd44780-arduino 1.0.0-1-g0edb20e
https://github.com/pololu/lsm303-arduino 2.1.0-1-g0139b82
https://github.com/pololu/l3g-arduino 2.0.0-1-g71cd3d6
https://github.com/pololu/qtr-sensors-arduino 2.1.1
https://github.com/pololu/fastgpio-arduino 2.0.0
https://github.com/pololu/usb-pause-arduino 2.0.0
https://github.com/pololu/pushbutton-arduino 2.0.0
https://github.com/pololu/pololu-buzzer-arduino 1.0.1
https://github.com/pololu/pololu-hd44780-arduino 2.0.0-1-gc2ceb6f
https://github.com/pololu/lsm303-arduino 3.0.1
https://github.com/pololu/l3g-arduino 3.0.0
https://github.com/pololu/qtr-sensors-arduino 3.0.0
14 changes: 7 additions & 7 deletions update_components.sh
Expand Up @@ -42,14 +42,14 @@ copylib()
}

library .
copylib https://github.com/pololu/fastgpio-arduino ../fastgpio-arduino/FastGPIO FastGPIO.h
copylib https://github.com/pololu/usb-pause-arduino ../usb-pause-arduino/USBPause USBPause.h
copylib https://github.com/pololu/pushbutton-arduino ../pushbutton-arduino/Pushbutton Pushbutton{.cpp,.h}
copylib https://github.com/pololu/fastgpio-arduino ../fastgpio-arduino FastGPIO.h
copylib https://github.com/pololu/usb-pause-arduino ../usb-pause-arduino USBPause.h
copylib https://github.com/pololu/pushbutton-arduino ../pushbutton-arduino Pushbutton{.cpp,.h}
copylib https://github.com/pololu/pololu-buzzer-arduino ../pololu-buzzer-arduino/PololuBuzzer PololuBuzzer{.cpp,.h}
copylib https://github.com/pololu/pololu-hd44780-arduino ../pololu-hd44780-arduino/PololuHD44780 PololuHD44780{.cpp,.h}
copylib https://github.com/pololu/lsm303-arduino ../lsm303-arduino/LSM303 LSM303{.cpp,.h}
copylib https://github.com/pololu/l3g-arduino ../l3g-arduino/L3G L3G{.cpp,.h}
copylib https://github.com/pololu/qtr-sensors-arduino ../qtr-sensors-arduino/QTRSensors QTRSensors{.cpp,.h}
copylib https://github.com/pololu/pololu-hd44780-arduino ../pololu-hd44780-arduino PololuHD44780{.cpp,.h}
copylib https://github.com/pololu/lsm303-arduino ../lsm303-arduino LSM303{.cpp,.h}
copylib https://github.com/pololu/l3g-arduino ../l3g-arduino L3G{.cpp,.h}
copylib https://github.com/pololu/qtr-sensors-arduino ../qtr-sensors-arduino QTRSensors{.cpp,.h}

# The Zumo32U4 library has some files that are reused between examples, and we
# would like those to stay synchronized.
Expand Down

0 comments on commit 86aa2b7

Please sign in to comment.