Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(1) // in main()
- {
- Stabby->GereLeMode(); // This is where the cpu determines what to do
- // (if it should move or not, according to the data received by rs232)
- // Some non-related stuff
- if(semaphoreAffiche == MAIN_REQUETE_ACTIVE) // If it should update the screen (at around every seconds or so)
- {
- semaphoreAffiche = MAIN_REQUETE_TRAITEE; // Don't enter again
- Stabby->UpdateTension(); // Updates the battery's voltage
- // Updates other stuff and refresh the LCD display, not causing any problem
- }
- }
- void Vehicule::UpdateTension(void) // Method that updates the variables containing the status of the battery
- {
- Vehicule::TensionVolt = (iLectureChanel1236(BATTERIE)/1000) * 3; // Gets the voltage in a 0-12V range
- Vehicule::TensionPourcentage = (unsigned char)(Vehicule::TensionVolt * 100 / 12); // Convert the float into a pourcentage of
- //remaining life of the battery (sorry if that
- //comment makes no sense)
- }
- void Vehicule::UpdateDac(void) // Method that sends the data to the 4 channels of the DAC
- {
- vI2CEcrireInt6574(CONFIGURE0DAC6574, Moteur_ARG);
- vI2CEcrireInt6574(CONFIGURE1DAC6574, Moteur_ARD);
- vI2CEcrireInt6574(CONFIGURE2DAC6574, Moteur_AVG);
- vI2CEcrireInt6574(CONFIGURE3DAC6574, Moteur_AVD);
- }
Advertisement
Add Comment
Please, Sign In to add comment