Skip to content

Commit

Permalink
format with clang (no functional changes)
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ha committed Aug 8, 2022
1 parent d26ee5a commit 4f1970f
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 68 deletions.
2 changes: 1 addition & 1 deletion TextField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ uint16_t TextField::cBackground; // background color
void TextField::eraseOld() {
// we remember the area to erase from the previous print()
tft.fillRect(xPrev, yPrev, wPrev, hPrev, cBackground); // erase the requested width of old text
//tft.drawRect(xPrev-2, yPrev-2, wPrev+4, hPrev+4, ILI9341_RED); // debug: show what area was erased
// tft.drawRect(xPrev-2, yPrev-2, wPrev+4, hPrev+4, ILI9341_RED); // debug: show what area was erased
}
void TextField::printNew(const char *pText) {
int16_t x1, y1;
Expand Down
4 changes: 2 additions & 2 deletions examples/DAC_grid_names/DAC_grid_names.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Purpose: This sketch speaks grid names, e.g. "CN87" as "Charlie November Eight Seven"
Example data (750 KB) includes Barry's recorded voice sampled at 16 khz mono.
Sample audio is stored and played using the 2MB Flash chip.
WAV files are stored in the chip by temporarily loading CircuitPy and
WAV files are stored in the chip by temporarily loading CircuitPy and
then drag'n drop files from within Windows, then loading our sketch again.
This sketch is used in Griduino at https://github.com/barry-ha/Griduino
Expand All @@ -22,7 +22,7 @@
2. Open a project, e.g. \Documents\Arduino\Griduino\work_in_progress\Spoken Word Originals\Barry
3. Select "Project rate" of 16000 Hz
4. Select an audio fragment, such as "Charlie"
5. Menu bar > Effect > Normalize
5. Menu bar > Effect > Normalize
a. Remove DC offset
b. Normalize peaks -1.0 dB
5. Menu bar > File > Export > Export as WAV
Expand Down
24 changes: 12 additions & 12 deletions examples/DAC_grid_names/audio_qspi.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// Please format this file with clang before check-in to GitHub
/*
File: audio_qspi.h
File: audio_qspi.h
Purpose: Open and play Microsoft WAV files from Quad-SPI memory chip on Feather M4 Express
This project documents everything needed for the whole process from
adjusting audio in Audacity, creating the WAV file, transferring your
WAV file to the QSPI chip on a Feather M4 board, opening the file in FatSd,
and playing the sampled audio on the DAC output.
This project documents everything needed for the whole process from
adjusting audio in Audacity, creating the WAV file, transferring your
WAV file to the QSPI chip on a Feather M4 board, opening the file in FatSd,
and playing the sampled audio on the DAC output.
The SAMD51 on the Feather M4 Express has large program space, but
it's not nearly enough to hold more than a few total seconds of
precompiled audio. Hence, I developed this interface to play audio
The SAMD51 on the Feather M4 Express has large program space, but
it's not nearly enough to hold more than a few total seconds of
precompiled audio. Hence, I developed this interface to play audio
clips from the 2MB Quad-SPI memory chip.
"Express" boards from Adafruit indicate it carries a memory chip alongside
the processor. It is accessed via SPI interface; it is not part of the instruction set
memory space.
"Express" boards from Adafruit indicate it carries a memory chip alongside
the processor. It is accessed via SPI interface; it is not part of the instruction set
memory space.
Relevant background:
http://www.lightlink.com/tjweber/StripWav/WAVE.txt
Expand Down Expand Up @@ -190,7 +190,7 @@ bool AudioQSPI::begin(void) {

// ----- init onboard DAC
#if defined(SAMD_SERIES)
// Only set DAC resolution on devices that have a DAC
// Only set DAC resolution on devices that have a DAC
analogWriteResolution(12); // 1..32, sets DAC output resolution to 12 bit (4096 levels)
// because Feather M4 maximum output resolution is 12 bit
#endif
Expand Down
24 changes: 12 additions & 12 deletions examples/DAC_grid_names/audio_qspi.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
// Please format this file with clang before check-in to GitHub
/*
File: audio_qspi.h
File: audio_qspi.h
Purpose: Open and play Microsoft WAV files from Quad-SPI memory chip on Feather M4 Express
This project documents everything needed for the whole process from
adjusting audio in Audacity, creating the WAV file, transferring your
WAV file to the QSPI chip on a Feather M4 board, opening the file in FatSd,
and playing the sampled audio on the DAC output.
This project documents everything needed for the whole process from
adjusting audio in Audacity, creating the WAV file, transferring your
WAV file to the QSPI chip on a Feather M4 board, opening the file in FatSd,
and playing the sampled audio on the DAC output.
The SAMD51 on the Feather M4 Express has large program space, but
it's not nearly enough to hold more than a few total seconds of
precompiled audio. Hence, I developed this interface to play audio
The SAMD51 on the Feather M4 Express has large program space, but
it's not nearly enough to hold more than a few total seconds of
precompiled audio. Hence, I developed this interface to play audio
clips from the 2MB Quad-SPI memory chip.
"Express" boards from Adafruit indicate it carries a memory chip alongside
the processor. It is accessed via SPI interface; it is not part of the instruction set
memory space.
"Express" boards from Adafruit indicate it carries a memory chip alongside
the processor. It is accessed via SPI interface; it is not part of the instruction set
memory space.
Preparing audio files:
Prepare your WAV file to 16 kHz mono:
1. Open Audacity
2. Open a project, e.g. \Documents\Arduino\Griduino\work_in_progress\Spoken Word Originals\Barry
3. Select "Project rate" of 16000 Hz
4. Select an audio fragment, such as "Charlie"
5. Menu bar > Effect > Normalize
5. Menu bar > Effect > Normalize
a. Remove DC offset
b. Normalize peaks -1.0 dB
5. Menu bar > File > Export > Export as WAV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <Adafruit_ILI9341.h> // TFT color display library
#include <SdFat.h> // for FAT file systems on Flash and Micro SD cards
#include <Adafruit_SPIFlash.h> // for FAT file systems on SPI flash chips
#include "hardware.h" // Griduino pin definitions
#include "hardware.h" // Griduino pin definitions

// ------- Identity for splash screen and console --------
#define EXAMPLE_TITLE "Flash File Directory List"
Expand Down Expand Up @@ -300,13 +300,13 @@ void setup() {
//=========== main work loop ===================================
void loop() {

for (int ii=30; ii--; ii<=0) {
for (int ii = 30; ii--; ii <= 0) {
Serial.print(ii);
Serial.print(" ");
delay(1000);
}
Serial.println(" ");
clearScreen(); // note that "begin()" does not clear screen
clearScreen(); // note that "begin()" does not clear screen
gCurrentY = yRow1;

// ----- Do The Thing
Expand Down
4 changes: 2 additions & 2 deletions examples/GPS_Demo_Loopback/GPS_Demo_Loopback.ino
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ void init_Adafruit_GPS() {

Serial.print("Set GPS 1 Hz update rate: ");
Serial.println(PMTK_SET_NMEA_UPDATE_1HZ);
//GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ); // 5 Hz update rate
// GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ); // 5 Hz update rate
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); // 1 Hz
//GPS.sendCommand(PMTK_SET_NMEA_UPDATE_200_MILLIHERTZ); // Every 5 seconds
// GPS.sendCommand(PMTK_SET_NMEA_UPDATE_200_MILLIHERTZ); // Every 5 seconds
delay(50);

if (0) { // this command is saved in the GPS chip NVR, so always send one of these cmds
Expand Down
34 changes: 17 additions & 17 deletions examples/TFT_Touch_Calibrator/TFT_Touch_Calibrator.ino
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// For touch point precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
#if defined(SAMD_SERIES)
// Adafruit Feather M4 Express pin definitions
#define PIN_XP A3 // Touchscreen X+ can be a digital pin
#define PIN_XM A4 // Touchscreen X- must be an analog pin, use "An" notation
#define PIN_YP A5 // Touchscreen Y+ must be an analog pin, use "An" notation
#define PIN_YM 9 // Touchscreen Y- can be a digital pin
// Adafruit Feather M4 Express pin definitions
#define PIN_XP A3 // Touchscreen X+ can be a digital pin
#define PIN_XM A4 // Touchscreen X- must be an analog pin, use "An" notation
#define PIN_YP A5 // Touchscreen Y+ must be an analog pin, use "An" notation
#define PIN_YM 9 // Touchscreen Y- can be a digital pin
#elif defined(ARDUINO_AVR_MEGA2560)
// Arduino Mega 2560 and others
#define PIN_XP 4 // Touchscreen X+ can be a digital pin
#define PIN_XM A3 // Touchscreen X- must be an analog pin, use "An" notation
#define PIN_YP A2 // Touchscreen Y+ must be an analog pin, use "An" notation
#define PIN_YM 5 // Touchscreen Y- can be a digital pin
// Arduino Mega 2560 and others
#define PIN_XP 4 // Touchscreen X+ can be a digital pin
#define PIN_XM A3 // Touchscreen X- must be an analog pin, use "An" notation
#define PIN_YP A2 // Touchscreen Y+ must be an analog pin, use "An" notation
#define PIN_YM 5 // Touchscreen Y- can be a digital pin
#else
#warning You need to define pins for your hardware
#warning You need to define pins for your hardware
#endif
TouchScreen ts = TouchScreen(PIN_XP, PIN_YP, PIN_XM, PIN_YM, XP_XM_OHMS);

Expand Down Expand Up @@ -230,12 +230,12 @@ void waitForSerial(int howLong) {
// and the operator takes awhile to restart the console (Tools > Serial Monitor)
// so give them a few seconds for this to settle before sending messages to IDE
unsigned long targetTime = millis() + howLong * 1000;
int x = 0;
int y = 0;
int w = gScreenWidth;
int h = gScreenHeight;
bool done = false;

int x = 0;
int y = 0;
int w = gScreenWidth;
int h = gScreenHeight;
bool done = false;

while (millis() < targetTime) {
if (Serial)
Expand Down
26 changes: 12 additions & 14 deletions logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
******************************************************************************
Licensed under the GNU General Public License v3.0
Permissions of this strong copyleft license are conditioned on making available
complete source code of licensed works and modifications, which include larger
works using a licensed work, under the same license. Copyright and license
Permissions of this strong copyleft license are conditioned on making available
complete source code of licensed works and modifications, which include larger
works using a licensed work, under the same license. Copyright and license
notices must be preserved. Contributors provide an express grant of patent rights.
You may obtain a copy of the License at
https://docs.github.com/articles/licensing-a-repository/#disclaimer
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -36,13 +36,13 @@ enum {
}
*/

#include "logger.h" // conditional printing to Serial port
#include "logger.h" // conditional printing to Serial port

class Logger {

public:
bool print_nmea = true; // set TRUE for NmeaTime2 by www.visualgps.net
bool print_gmt = false; // the time reports are frequent (1 per second) so by default it's off
bool print_nmea = true; // set TRUE for NmeaTime2 by www.visualgps.net
bool print_gmt = false; // the time reports are frequent (1 per second) so by default it's off
bool print_fencepost = true;
bool print_debug = true;
bool print_info = false; // set FALSE for NmeaTime2 by www.visualgps.net
Expand All @@ -68,9 +68,7 @@ class Logger {
char needle[7];
strncpy(needle, pText, 6);
needle[6] = 0; // null terminated
//if (strstr(haystack, needle)) {
Serial.print(pText);
//}
Serial.print(pText);
if (strstr("$GPRMC", needle)) {
Serial.println();
}
Expand All @@ -84,7 +82,7 @@ class Logger {
}
}
void fencepost(const char *pModule, const int lineno) {
// example: "Griduino.ino[123] says hi"
// example output: "Griduino.ino[123] says hi"
if (print_fencepost) {
Serial.print(pModule);
Serial.print("[");
Expand All @@ -93,7 +91,7 @@ class Logger {
}
}
void fencepost(const char *pModule, const char *pSubroutine, const int lineno) {
// example: "----- unit_test.cpp[123] verifyMorseCode()"
// example output: "----- unit_test.cpp[123] verifyMorseCode()"
if (print_fencepost) {
Serial.print("----- ");
Serial.print(pModule);
Expand Down
2 changes: 1 addition & 1 deletion model_baro.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class BarometerModel {
Serial.print(pressure, 1); // debug
Serial.println(" )"); // debug
}
saveHistory(); // write stack to NVR
saveHistory(); // write stack to NVR
}

// ========== load/save barometer pressure history =============
Expand Down
4 changes: 2 additions & 2 deletions model_gps.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ class Model {
}
}
// here's the real meat of the potato
nextHistoryItem = indexOldest;
nextHistoryItem = indexOldest;

// report statistics for a visible sanity check to aid debug
char sOldest[24], sNewest[24];
dateToString(sOldest, sizeof(sOldest), oldest);
dateToString(sNewest, sizeof(sNewest), newest);

char msg1[256], msg2[256];
char msg1[256], msg2[256];
snprintf(msg1, sizeof(msg1), ". Oldest date = history[%d] = %s", indexOldest, sOldest);
snprintf(msg2, sizeof(msg2), ". Newest date = history[%d] = %s", indexNewest, sNewest);
logger.info(msg1);
Expand Down
2 changes: 1 addition & 1 deletion save_restore.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SaveRestoreStrings : public SaveRestore {
int readLine(char *pBuffer, int bufflen); // https://cplusplus.com/reference/cstdio/gets/
uint8_t getError() {
return handle.getError();
}
}
void close();

protected:
Expand Down
2 changes: 1 addition & 1 deletion view_date.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class ViewDate : public View {
void nextDateEvent() {
whichEvent = (whichEvent + 1) % (sizeof(eventList) / sizeof(eventList[0]));
target = eventList[whichEvent];
//logger.info(". Changed event to #%d, %d", whichEvent, eventList[whichEvent].line3);
// logger.info(". Changed event to #%d, %d", whichEvent, eventList[whichEvent].line3);
}

// Formatted elapsed time
Expand Down

0 comments on commit 4f1970f

Please sign in to comment.