forked from connectal-examples/leds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testleds.cpp
36 lines (30 loc) · 869 Bytes
/
testleds.cpp
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
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include "LedControllerRequestProxy.h"
#include "GeneratedTypes.h"
int main(int argc, const char **argv)
{
LedControllerRequestProxy *device = new LedControllerRequestProxy(IfcNames_LedControllerRequestPortal);
printf("Starting LED test");
portalExec_start();
#ifdef BSIM
// BSIM does not run very many cycles per second
int blinkinterval = 10;
#else
int blinkinterval = 100000000; // 100MHz cycles
#endif
int blinkon = 10; // 1010
int blinkoff = 5; // 0101
int sleepinterval = 1; // seconds
for (int i = 0; i < 20; i++) {
printf("blink %d", blinkon);
device->setLeds(blinkon, blinkinterval);
sleep(sleepinterval);
printf("blink off %d", blinkoff);
device->setLeds(blinkoff, blinkinterval);
sleep(sleepinterval);
}
printf("Done.\n");
}