2007-10-16 19:20:11 -04:00
|
|
|
#include "config.h"
|
2007-11-05 19:57:07 -05:00
|
|
|
#include "adc.h"
|
2008-02-12 00:24:34 -05:00
|
|
|
#include "adcext.h"
|
2007-11-06 19:06:28 -05:00
|
|
|
#include "dac.h"
|
2007-10-16 19:31:48 -04:00
|
|
|
#include "uart.h"
|
2008-01-22 23:29:07 -05:00
|
|
|
#include "timer.h"
|
2009-01-13 00:45:45 -05:00
|
|
|
#include "util.h"
|
2009-07-01 15:26:39 -04:00
|
|
|
#include "led.h"
|
2009-07-08 18:15:24 -04:00
|
|
|
#include "mode.h"
|
2009-07-21 16:31:09 -04:00
|
|
|
#include "calibrate.h"
|
2008-12-04 21:04:04 -05:00
|
|
|
|
2007-10-16 19:20:11 -04:00
|
|
|
int main(void)
|
|
|
|
{
|
2009-07-08 17:21:25 -04:00
|
|
|
int jumper;
|
|
|
|
|
2007-10-16 19:20:11 -04:00
|
|
|
config_init();
|
2009-07-01 15:26:39 -04:00
|
|
|
led_init();
|
2013-06-12 18:43:35 -04:00
|
|
|
led_on();
|
2009-07-21 16:31:09 -04:00
|
|
|
calibrate_init();
|
2008-10-06 17:37:48 -04:00
|
|
|
|
2009-07-08 17:21:25 -04:00
|
|
|
/* debug output */
|
2009-07-01 17:11:34 -04:00
|
|
|
TRISAbits.TRISA9 = 0;
|
2009-01-13 00:11:00 -05:00
|
|
|
|
2008-02-11 21:58:54 -05:00
|
|
|
adcext_init();
|
2007-11-06 19:06:28 -05:00
|
|
|
dac_init();
|
2009-11-03 19:19:44 -05:00
|
|
|
dac_write(DAC_MID);
|
2008-02-12 00:24:34 -05:00
|
|
|
adc_init();
|
2008-02-11 21:58:54 -05:00
|
|
|
|
2009-07-08 17:21:25 -04:00
|
|
|
/* Detect jumper from B8 to GND */
|
|
|
|
TRISBbits.TRISB8 = 0;
|
|
|
|
LATBbits.LATB8 = 1;
|
|
|
|
nop(); nop(); nop();
|
|
|
|
jumper = (PORTBbits.RB8 == 0);
|
|
|
|
TRISBbits.TRISB8 = 1;
|
|
|
|
|
|
|
|
/* If jumper present, use MODE_1 */
|
|
|
|
if (jumper)
|
|
|
|
run_debug();
|
|
|
|
else
|
|
|
|
run_normal();
|
2008-06-13 15:43:33 -04:00
|
|
|
|
2008-09-23 19:27:40 -04:00
|
|
|
for (;;)
|
|
|
|
continue;
|
2007-10-16 19:20:11 -04:00
|
|
|
}
|