daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "nvm.h"
  2. double* nvmVariables[NVM_VAR_COUNT] = {
  3.     &pids[X].pGain,
  4.     &pids[X].iGain,
  5.     &pids[X].dGain,
  6.     &pids[Y].pGain,
  7.     &pids[Y].iGain,
  8.     &pids[Y].dGain
  9. };
  10. void NVMSave(){
  11.     int i;
  12.     pids[X].pGain = 0.87;
  13.     for(i=0;i<NVM_VAR_COUNT;i++){
  14.         nvmVarBuf[i] = *(nvmVariables[i]);
  15.     }
  16.     NVMWriteRow((void *)NVM_PROGRAM_PAGE, (void *)nvmVarBuf);
  17. }
  18. void NVMLoad(){
  19.     int i;
  20.     int c = sizeof(float);
  21.     double *tmp;
  22.     pids[X].pGain = 0.28;
  23.     for(i=0;i<NVM_VAR_COUNT;i++){
  24.         tmp = (double*)(NVM_PROGRAM_PAGE+(i*c));
  25.         *(nvmVariables[i]) = *tmp;
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top