From ae77622c84de56d1183a98b85b60ac9411b4bebf Mon Sep 17 00:00:00 2001 From: Waleed El-Geresy Date: Mon, 8 May 2017 12:06:25 +0100 Subject: Add lookup table --- src/main.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1406b74..9cc47fb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ #define SW_PINS p24, p23, p22, p21 #define SW_PERIOD 20000 // 20ms +#define ARRAY_SIZE 360 void tout(void); void square(void); @@ -30,16 +31,24 @@ volatile uint16_t update = 0; volatile uint16_t amp = 0; const double pi = 3.141592653589793238462; -const double offset = 65535/2; +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]; + // Initialise display SPInit gSpi(D_MOSI_PIN, NC, D_CLK_PIN); Adafruit_SSD1306_Spi oled(gSpi, D_DC_PIN, D_RST_PIN, D_CS_PIN, 64, 128); int main(void) { + for(int i=0; i