Jon Freeman / Mbed 2 deprecated Alternator2020_06

Dependencies:   mbed BufferedSerial Servo2 PCT2075 I2CEeprom FastPWM

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Alternator.h Source File

Alternator.h

00001 /*******************************************************************************
00002         DON'T FORGET TO REMOVE SOLDER LINKS SB16 AND SB18 ON L432KC BOARD
00003 *******************************************************************************/
00004 
00005 //#define GPS_  //  Not the crap one I tried!
00006 
00007 const   double      ALTERNATOR_DESIGN_VOLTAGE = 14.0;   //  Used to scale down max field pwm when available voltage higher than this
00008 const   double      DRIVER_NEUTRAL      = 0.18;  //  Proportion of driver's pot travel deemed to be zero power request
00009 const   uint32_t    eeprom_page         = 17;   //  Determines where in eeprom 'settings' reside
00010 const   int         eeprom_page_size    = 32;
00011 const   int         PWM_PERIOD_US       = 1800    ;   //  Was 2400, May want to reduce this, note would require change of resistor value on board
00012 
00013 enum    {TABL0, TABL1, TABL2, TABL3, TABL4, TABL5, TABL6, TABL7, TABL8, TABL9, TABL10,
00014         TABL11, TABL12, TABL13, TABL14, TABL15, TABL16, TABL17, TABL18, TABL19, TABL20,   
00015         WARM_UP_DELAY, WARMUP_SERVO_POS, OP_MODE, SPEED_CTRL_P, SERVO_DIR, FUT27, FUT28, FUT29, FUT30, FUT31 }  ;
00016 
00017 struct  sldandt  {
00018     const uint32_t    min, max, de_fault;  //  min, max, default
00019     const char * txt;     //  description
00020     char    val;
00021 }   ;
00022 
00023 
00024 class   ee_settings_2020    {
00025     char    new_settings[eeprom_page_size + 2];
00026   public:
00027     ee_settings_2020    ()  ;   //  Constructor
00028     int load    ()  ;
00029     int save    ()  ;
00030     char    rd  (uint32_t   i)  ;
00031     bool    wr  (char c, uint32_t i)  ;           //  Write one setup char value to private buffer 'settings'
00032     sldandt *    inform (uint32_t which)   ;
00033 }   ;
00034 
00035 const   int MAX_PARAMS = 12;    //  Up from 10 May 2020
00036 struct  parameters  {   //  Used in Command Line Interpreter, stores user input values
00037     int32_t position_in_list, numof_dbls;
00038     double  dbl[MAX_PARAMS];
00039 }   ;
00040 
00041 
00042 /*
00043 - Position the Cursor:
00044   \033[<L>;<C>H
00045      Or
00046   \033[<L>;<C>f
00047   puts the cursor at line L and column C.
00048 - Move the cursor up N lines:
00049   \033[<N>A
00050 - Move the cursor down N lines:
00051   \033[<N>B
00052 - Move the cursor forward N columns:
00053   \033[<N>C
00054 - Move the cursor backward N columns:
00055   \033[<N>D
00056 
00057 - Clear the screen, move to (0,0):
00058   \033[2J
00059 - Erase to end of line:
00060   \033[K
00061 
00062 - Save cursor position:
00063   \033[s    might not work
00064 - Restore cursor position:
00065   \033[u    might not work
00066 */
00067