main.c 2.06 KB
Newer Older
1
/*******************************************************************************
2
 * License: TBD
3
4
5
 ******************************************************************************/

/***** Includes *****/
6
#include "pmic.h"
schneider's avatar
schneider committed
7
#include "leds.h"
8
9
#include "card10.h"

10
11
#include "gfx.h"
#include "display.h"
schneider's avatar
schneider committed
12

13
14
#include "tmr_utils.h"

15
16
#include <stdio.h>
#include <stdint.h>
schneider's avatar
schneider committed
17
#include <string.h>
schneider's avatar
schneider committed
18
#include <Heart.h>
19
20
21
22

/***** Definitions *****/

/***** Globals *****/
Rahix's avatar
Rahix committed
23
24
static __attribute__((unused))
const gpio_cfg_t motor_pin = { PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE };
25
26
27

int main(void)
{
Rahix's avatar
Rahix committed
28
	int count = 0;
29

Rahix's avatar
Rahix committed
30
31
	card10_init();
	card10_diag();
schneider's avatar
schneider committed
32

33
34
35
36
37
38
39
40
41
	gfx_copy_region(
		&display_screen,
		0,
		0,
		160,
		80,
		GFX_RAW,
		sizeof(Heart),
		(const void *)(Heart)
42
43
	);
	gfx_update(&display_screen);
schneider's avatar
schneider committed
44

Rahix's avatar
Rahix committed
45
	for (int i = 0; i < 11; i++) {
fleur's avatar
fleur committed
46
		//        leds_set_dim(i, 1);
Rahix's avatar
Rahix committed
47
	}
48

Rahix's avatar
Rahix committed
49
50
	int __attribute__((unused)) h = 0;
	while (1) {
schneider's avatar
schneider committed
51
#if 0
52

Rahix's avatar
Rahix committed
53
#define NUM 15
54
55
56
57
58
59
60
61
        for(int i=0; i<NUM; i++) {
            if(i < 12) {
                leds_set_hsv(i, (h + 360/NUM * i) % 360, 1., 1./8);
            } else {
                leds_set_hsv(i, (h + 360/NUM * i) % 360, 1., 1.);
            }
        }

schneider's avatar
schneider committed
62
63
64
65
        leds_update();
        TMR_Delay(MXC_TMR0, MSEC(10), 0);
        h++;
#endif
66
#if 1
Rahix's avatar
Rahix committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
		pmic_set_led(0, 31);
		pmic_set_led(1, 0);
		pmic_set_led(2, 0);
		TMR_Delay(MXC_TMR0, MSEC(200), 0);

		pmic_set_led(0, 0);
		pmic_set_led(1, 31);
		pmic_set_led(2, 0);
		TMR_Delay(MXC_TMR0, MSEC(200), 0);

		pmic_set_led(0, 0);
		pmic_set_led(1, 0);
		pmic_set_led(2, 31);
		TMR_Delay(MXC_TMR0, MSEC(200), 0);

		pmic_set_led(0, 0);
		pmic_set_led(1, 0);
		pmic_set_led(2, 0);
		//TMR_Delay(MXC_TMR0, MSEC(200), 0);
86
87
88
#endif
#if 0
        //TMR_Delay(MXC_TMR0, MSEC(600), 0);
schneider's avatar
schneider committed
89
        GPIO_OutSet(&motor_pin);
90
        TMR_Delay(MXC_TMR0, MSEC(30), 0);
schneider's avatar
schneider committed
91
        GPIO_OutClr(&motor_pin);
92
93
94
95
96
97
98
99
        TMR_Delay(MXC_TMR0, MSEC(200), 0);
#endif
#if 0
        LED_Off(0);
        TMR_Delay(MXC_TMR0, MSEC(500), 0);
        LED_On(0);
        TMR_Delay(MXC_TMR0, MSEC(500), 0);
#endif
schneider's avatar
schneider committed
100
#if 1
Rahix's avatar
Rahix committed
101
102
		TMR_Delay(MXC_TMR0, MSEC(1000), 0);
		printf("count = %d\n", count++);
schneider's avatar
schneider committed
103
#endif
Rahix's avatar
Rahix committed
104
	}
105
}