embkernel
 All Classes Functions Variables Typedefs Groups Pages
main.cpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
5 
6 #include "RtosInclude.hpp"
7 #include "UsbInclude.hpp"
8 #include "UsbInclude.hpp"
9 #include "Hw.hpp"
10 #include "Comm.hpp"
11 #include "LibDebug.hpp"
12 
13 UsbHw usbHw;
14 
15 UsbTxStream usbLibLogStream(2, 128);
16 
17 #if RTOS_CFG_TRACE_BUFFER_SIZE
18 #include "LibRtosTraceUsb.hpp"
19 LibRtosTraceUsb trace(1, 1024, 5, 6);
20 #endif
21 
22 static void demoTaskRun(RtosTask* task);
23 
24 RtosTask demoTask(0, "DemoTask", 1000, demoTaskRun);
25 
26 Comm comm(1, 1000, 3, 4);
27 
28 int main() {
29  Hw::init();
30  UsbDevice::init(1, 1024, &usbHw);
31  usbLibLogStream.setMaxTimeout(0);
32  LibLog::setStream(&usbLibLogStream);
33  LibLog::setLevel(LibLog::LEVEL_VERBOSE);
34  //testInit();
35  Rtos::start();
36  return 0;
37 }
38 
39 void setLeds(uint16_t value) {
40  Hw::sLed3 = value & (1 << 0);
41  Hw::sLed5 = value & (1 << 1);
42  Hw::sLed7 = value & (1 << 2);
43  Hw::sLed9 = value & (1 << 3);
44  Hw::sLed10 = value & (1 << 4);
45  Hw::sLed8 = value & (1 << 5);
46  Hw::sLed6 = value & (1 << 6);
47  Hw::sLed4 = value & (1 << 7);
48 }
49 
50 void demoTaskRun(RtosTask* task) {
51  unsigned int counter = 1;
52  while (true) {
54  USER_DEBUG(LibLog::LEVEL_VERBOSE, "Demo task cycle #%u", counter++);
55  }
56 }
57