-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
56 lines (42 loc) · 1.21 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
/*
* TestProgram.c
*
* Created: 31.08.2021 11:23:23
* Author : idamand
*/
// should maybe have a define of F_CPU
#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
#include "sram.h"
#include "usart.h"
#include "adc_driver.h"
#include "oled_driver.h"
#define FOSC 4915200 //1843200 //Clock speed
#define BAUD 9600
#define MYUBRR FOSC/16/BAUD-1
int main(void){
//initialize uart and check that communication works
USART_Init(MYUBRR);
fdevopen(USART_TRANSMIT,USART_Receive);
printf("program started\r\n");
// do setup for the external adress interface
DDRC |= (1<<PC3); //force the MSB of the adress bus to be a write pin
MCUCR |= (1<<SRE); // enable external adress memory interface
SFIOR |= (1<<XMM2); // release top ports of adress space for jtag (pc4-pc7)
SFIOR &= ~(1<<XMM1); // release top ports of adress space for jtag (pc4-pc7)
SFIOR &= ~(1<<XMM0); // release top ports of adress space for jtag (pc4-pc7)
//adc_setup();
oled_init();
SRAM_test();
for (int i = 0; i<30; i++)
{
printf("in for loop\r\n");
//print_joystick_pos();
//print_joystick_dir();
// print_all_adc_channels();
//button_read();
}
printf("program finished\r\n");
return 0;
}