-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_main.c
51 lines (41 loc) · 1.11 KB
/
test_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
#include <avr/interrupt.h>
#include <avr/io.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdbool.h>
#include "avr_i2c.h"
#include "common/i2c_common.h"
int main(void){
// Enable global interrupts
sei();
I2C_init(0x50);
volatile uint16_t x = 0;
volatile uint16_t y = 0;
uint16_t in_names[16];
uint16_t in_data[16];
uint16_t out_names[16];
uint16_t out_data[16];
I2C_pack_one(0xfff3, 0x8);
while (true) {
x++;
if (x % 1000) {
y++;
}
if (y % 10000) {
I2C_pack_one(0xfffa, y);
}
I2C_pack_one(0xfffb, 0x7777);
//if (i2c_new_data) {
//int len = I2C_unpack(in_names, in_data);
//for (int i=0; i<len; ++i) {
//volatile int16_t val = restore_signed(in_data[i]);
//printf(in_names[i], val);
//}
//}
//out_names[0] = 0xfff0;
//out_data[0] = 0x4321;
//out_names[1] = 0xfff1;
//out_data[1] = 0x8765;
//I2C_pack(out_names, out_data, 2);
}
}