summaryrefslogtreecommitdiff
path: root/bsp/raspberry-pi/raspi3-64/applications/main.c
blob: bd7c917e6433d23701085f70abb04555edb047d4 (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
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2017-5-30     bernard       the first version
 */

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "mbox.h"

void set_led(int state) //set state LED nyala atau mati
{
    if (state==1)                       //LED nyala
    {
        mbox[0] = 8*4;                  // length of the message
        mbox[1] = MBOX_REQUEST;         // this is a request message

        mbox[2] = 0x00038041;   // get serial number command
        mbox[3] = 8;                    // buffer size
        mbox[4] = 0;
        mbox[5] = 130;                    // clear output buffer
        mbox[6] = 1;
        mbox[7] = MBOX_TAG_LAST;
        mbox_call(8, MMU_DISABLE);
    }
    else if (state==0)                  //LED mati
    {
        mbox[0] = 8*4;                  // length of the message
        mbox[1] = MBOX_REQUEST;         // this is a request message

        mbox[2] = 0x00038041;   // get serial number command
        mbox[3] = 8;                    // buffer size
        mbox[4] = 0;
        mbox[5] = 130;                    // clear output buffer
        mbox[6] = 0;
        mbox[7] = MBOX_TAG_LAST;
        mbox_call(8, MMU_DISABLE);
    }
}

int main(int argc, char** argv)
{
    int count = 1;

    rt_kprintf("Hi, this is RT-Thread!!\n");

    while (count++)
    {
        set_led(1);
        rt_thread_mdelay(500);
        set_led(0);
        rt_thread_mdelay(500);
    }

    return RT_EOK;
}