diff options
author | Vasil Zlatanov <v@skozl.com> | 2017-05-10 16:53:12 +0100 |
---|---|---|
committer | Vasil Zlatanov <v@skozl.com> | 2017-05-10 16:53:12 +0100 |
commit | 5d2c5d37ca292a5bfe962a4bccc64f1108b18076 (patch) | |
tree | 50989b966933ce1829c40a170f1d2e2905b90fc3 /src | |
parent | 9c702d83445b0563071676d13033ae4498408f32 (diff) | |
download | e2-switch-5d2c5d37ca292a5bfe962a4bccc64f1108b18076.tar.gz e2-switch-5d2c5d37ca292a5bfe962a4bccc64f1108b18076.tar.bz2 e2-switch-5d2c5d37ca292a5bfe962a4bccc64f1108b18076.zip |
Fix bug rads redeclared as int
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index c36024c..3f5ae40 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,6 @@ volatile uint16_t amp = 0; const double pi = 3.141592653589793238462; const double offset = 65535 / 2; // Offset is 1/2 the total bits -double rads = 0.0; uint16_t sample = 0; uint16_t sineArray[ARRAY_SIZE]; @@ -43,9 +42,8 @@ Adafruit_SSD1306_Spi oled(gSpi, D_DC_PIN, D_RST_PIN, D_CS_PIN, 64, 128); int main(void) { for (int i = 0; i < ARRAY_SIZE; i++) { - int rads = (pi * i) / (ARRAY_SIZE / 2.0f); - sineArray[i] = - (uint16_t)(0.5f * (offset * (cos(rads + pi))) + offset); + rads = (pi * i) / (ARRAY_SIZE / 2.0f); + sineArray[i] = (uint16_t)(0.5f * (offset * (cos(rads + pi))) + offset); } uint16_t frequency = 0; |