Tab.c 627 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Tab.c
  3. *
  4. * Created on: 15 janv. 2019
  5. * Author: e_rcluze
  6. */
  7. #include "Tab.h"
  8. void initTab(Sortie *S) {
  9. S[0].OUT = 0b0000000000000100;
  10. S[1].OUT = 0b0000000000001000;
  11. S[2].OUT = 0b0000000000000011;
  12. S[3].OUT = 0b0000000000010000;
  13. //S[1].OUT = 0b0000000000000010;
  14. //S[2].OUT = 0b0000000000000100;
  15. //S[3].OUT = 0b0000000000001000;
  16. }
  17. uint8_t newStatus(Sortie *s, uint16_t heure) {
  18. if (heure >= s->Demmarage & heure < s->Extinxtion) {
  19. if (heure < s->Demmarage + s->Pente)
  20. return ENALLUME;
  21. else if(heure > s->Extinxtion - s->Pente)
  22. return ENETEIN;
  23. else
  24. return ALLUME;
  25. } else
  26. return ETEIN;
  27. }