1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2017-5-30 bernard the first version 9 */ 10 11 #include <rtthread.h> 12 #include <rtdevice.h> 13 #include <board.h> 14 #include "mbox.h" 15 set_led(int state)16void set_led(int state) //set state LED nyala atau mati 17 { 18 if (state==1) //LED nyala 19 { 20 mbox[0] = 8*4; // length of the message 21 mbox[1] = MBOX_REQUEST; // this is a request message 22 23 mbox[2] = 0x00038041; // get serial number command 24 mbox[3] = 8; // buffer size 25 mbox[4] = 0; 26 mbox[5] = 130; // clear output buffer 27 mbox[6] = 1; 28 mbox[7] = MBOX_TAG_LAST; 29 mbox_call(8, MMU_DISABLE); 30 } 31 else if (state==0) //LED mati 32 { 33 mbox[0] = 8*4; // length of the message 34 mbox[1] = MBOX_REQUEST; // this is a request message 35 36 mbox[2] = 0x00038041; // get serial number command 37 mbox[3] = 8; // buffer size 38 mbox[4] = 0; 39 mbox[5] = 130; // clear output buffer 40 mbox[6] = 0; 41 mbox[7] = MBOX_TAG_LAST; 42 mbox_call(8, MMU_DISABLE); 43 } 44 } 45 main(int argc,char ** argv)46int main(int argc, char** argv) 47 { 48 int count = 1; 49 50 rt_kprintf("Hi, this is RT-Thread!!\n"); 51 52 while (count++) 53 { 54 set_led(1); 55 rt_thread_mdelay(500); 56 set_led(0); 57 rt_thread_mdelay(500); 58 } 59 60 return RT_EOK; 61 } 62