-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
executable file
·83 lines (74 loc) · 1.25 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Firmware for fdio controller V1
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <util/atomic.h>
#include <math.h>
#include "usart.h"
#include "util.h"
#include "iocontrol.h"
#include "spi.h"
#include "rtc.h"
#include "softtimer.h"
#include "9p.h"
#include "9p_pgm.h"
static void hardware_init()
{
DDRA = 0;
DDRB = 0;
DDRC = 0xC0;
DDRD = 0;
PORTA = 0;
PORTB = 0;
PORTC = 0xC0;
PORTD = 0;
io_init();
spi_init();
soft_timer_init();
config_Init();
USART_Init();
RTC_Init();
}
uint8_t testtimerslot;
void test()
{
DSEND(0, "whats up\n");
reset_timer(time() + 5, &test, testtimerslot);
}
int main(void)
{
uint8_t mcusr;
uint8_t retval;
cli();
hardware_init();
p9_init();
mcusr = MCUSR;
MCUSR = 0;
sei();
printf("Arctic Precision Horticulture\n");
printf("Model: APC5 Firmware: 5.15\n");
printf("mcusr %x\n", mcusr);
testtimerslot = set_timer(time() + 5, &test);
while (1)
{
/*retval = nvmfile_init();
printf("retval: %d\n", retval);
if (retval)
{
vm_init();
nvmfile_call_main();
}
_delay_ms(1);*/
//write_spi_mem();
}
// Never reached.
return(0);
}
ISR(BADISR_vect)
{
DDRC |= (1U<<5);
}