ELEC2645 (2019/20) / Mbed 2 deprecated el18loc_final

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LUTs.h Source File

LUTs.h

00001 #ifndef LUTs_H
00002 #define LUTs_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 
00008 /** LUTs class
00009  * @author Luke Cartwright, University of Leeds
00010  * @brief generates LUTs
00011  * @date May 2020
00012 */
00013 
00014 class LUTs
00015 {
00016 public:
00017     /** Constructor */
00018     LUTs();
00019     /** Destructior */
00020     ~LUTs();
00021 
00022     //Methods
00023     /** Generates all wavetables using preset central values
00024     * @genrates preset wavetables
00025     * @Outputs as global variables
00026     * @1024 Points per table (0->(2^16)-1)
00027     */ 
00028     void initial_wavetables();
00029     
00030     /**Generatres Sin Wavetable
00031     * @outputs Sin Wavetable as Global Variable
00032     */
00033     void sin_wavetable();
00034     
00035     /**Generatres Tri Wavetable
00036     * @outputs Tri Wavetable as Global Variable
00037     * @with defined PulseWidth
00038     */
00039     void tri_wavetable(int pulsewidth);
00040     
00041     /**Generatres Pulse Wavetable
00042     * @outputs Pulse Wavetable as Global Variable
00043     * @with defined PulseWidth
00044     */
00045     void pulse_wavetable(int pulsewidth);
00046 
00047 private:
00048     //variables
00049     double rem; //Remainder (used for rounding)
00050     float sin_d; //Sin Double var
00051     uint16_t sin_u; //Sin Unsigned var
00052     float dif; //Difference required in Tri wav
00053     uint16_t dif_u; //Unsigned version of dif
00054     int i; //Itterator
00055     float rise_t; //Rise time for tri wav
00056     uint16_t rise_tu; //Unsigned version of rise_t
00057     uint16_t fall_tu; //unsigned measure of fall time for tri wav
00058     float up_t; //Time At max for square
00059     int up_tu; //Unsigned version of up_t
00060     
00061     //Methods
00062     /**Prints Certain Tri wavetable results for checking
00063     * @Multiples of 64 for tri_wav values for debug
00064     */
00065     void tri_wav_results();
00066 };
00067 #endif