You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

45 lines
657 B

  1. #include "config.h"
  2. #include "adc.h"
  3. #include "adcext.h"
  4. #include "dac.h"
  5. #include "uart.h"
  6. #include "timer.h"
  7. #include "util.h"
  8. #include "led.h"
  9. #include "mode.h"
  10. #include "calibrate.h"
  11. int main(void)
  12. {
  13. int jumper;
  14. config_init();
  15. led_init();
  16. led_on();
  17. calibrate_init();
  18. /* debug output */
  19. TRISAbits.TRISA9 = 0;
  20. adcext_init();
  21. dac_init();
  22. dac_write(DAC_MID);
  23. adc_init();
  24. /* Detect jumper from B8 to GND */
  25. TRISBbits.TRISB8 = 0;
  26. LATBbits.LATB8 = 1;
  27. nop(); nop(); nop();
  28. jumper = (PORTBbits.RB8 == 0);
  29. TRISBbits.TRISB8 = 1;
  30. /* If jumper present, use MODE_1 */
  31. if (jumper)
  32. run_debug();
  33. else
  34. run_normal();
  35. for (;;)
  36. continue;
  37. }