summaryrefslogtreecommitdiff
path: root/fw/fe310/phone/main.c
blob: fd4d672ef43d0286143dc4b67a256cc4f49402d6 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#include <encoding.h>
#include <platform.h>
#include <prci_driver.h>

#include <eos.h>
#include <soc/pwr.h>
#include <dev/flash.h>
#include <dev/gt911.h>
#include <dev/eve.h>

#include <eve/eve.h>
#include <eve/eve_kbd.h>
#include <eve/eve_font.h>

#include <eve/screen/window.h>
#include <eve/screen/page.h>
#include <eve/screen/form.h>

#include "app/app.h"

#include "wifi.h"
#include "cell.h"
#include "sms.h"
#include "phone.h"
#include "modem.h"
#include "timer.h"
#include "flash.h"
#include "test.h"

static const uint32_t touch_matrix[6] = {0xf7ac,0x440,0x3e704,0xfffff718,0x108a3,0xfff76d42};

static int home_page(EVEWindow *window, EVEViewStack *stack) {
    EVEFormSpec spec[] = {
        {
            .widget.type = EVE_WIDGET_TYPE_PAGE,
            .widget.g.w = APP_SCREEN_W,
            .widget.tspec.page.title = "WiFi",
            .widget.tspec.page.constructor = wifi_app,
        },
        {
            .widget.type = EVE_WIDGET_TYPE_PAGE,
            .widget.g.w = APP_SCREEN_W,
            .widget.tspec.page.title = "Modem",
            .widget.tspec.page.constructor = modem_app,
        },
        {
            .widget.type = EVE_WIDGET_TYPE_PAGE,
            .widget.g.w = APP_SCREEN_W,
            .widget.tspec.page.title = "SMS",
            .widget.tspec.page.constructor = sms_app,
        },
        {
            .widget.type = EVE_WIDGET_TYPE_PAGE,
            .widget.g.w = APP_SCREEN_W,
            .widget.tspec.page.title = "Phone",
            .widget.tspec.page.constructor = phone_app,
        },
        {
            .widget.type = EVE_WIDGET_TYPE_PAGE,
            .widget.g.w = APP_SCREEN_W,
            .widget.tspec.page.title = "Timer",
            .widget.tspec.page.constructor = timer_app,
        },
        {
            .widget.type = EVE_WIDGET_TYPE_PAGE,
            .widget.g.w = APP_SCREEN_W,
            .widget.tspec.page.title = "Flash",
            .widget.tspec.page.constructor = flash_app,
        },
        {
            .widget.type = EVE_WIDGET_TYPE_PAGE,
            .widget.g.w = APP_SCREEN_W,
            .widget.tspec.page.title = "Test",
            .widget.tspec.page.constructor = test_app,
        },
    };

    EVEPage *page = eve_form_create(window, stack, spec, APP_SPEC_SIZE(spec), NULL, NULL);
    if (page == NULL) return EVE_ERR_NOMEM;

    return EVE_OK;
}

void mem_print(void);

int main() {
    int i;
    uint8_t wakeup_cause;

    wakeup_cause = eos_init();
    // eos_run_once();
    eos_eve_set_tmatrix(touch_matrix);

    printf("FREQ:%lu\n", PRCI_get_cpu_freq());
    printf("\nREADY.\n");

    mem_print();
    eos_gt911_cfg_print();

    // eos_flash_fast();

    wifi_init();
    cell_init();
    sms_init();
    phone_init();
    app_init(home_page, 0x20);

    eos_run(wakeup_cause);

    eos_evtq_loop();
}