36 Commits
V2 ... master

Author SHA1 Message Date
Simon Wörner
5c5e1df435 added documentation, updated realzeitnachweis 2017-07-10 16:44:39 +02:00
Simon Wörner
fe8806a4d5 added rust documentation comments 2017-07-10 15:20:14 +02:00
Simon Wörner
088867352c added rust doc output 2017-07-10 14:55:44 +02:00
8d2b664149 Abgabe 2017-06-28 20:40:01 +02:00
Simon Wörner
76dd61f48b fixed rustdoc tests 2017-05-02 22:30:24 +02:00
Simon Wörner
733068dc8d fixed rustfmt warnings 2017-05-02 22:30:24 +02:00
Simon Wörner
cef96956a4 fixed ci 2017-05-02 22:30:24 +02:00
Michael Mächtel
6b08efc581 Merge pull request #1 from sikienzl/master
V1 + V2: Abgabe
2017-04-06 15:21:35 +02:00
Simon Wörner
f6327fc45d Merge pull request #10 from SWW13/travis-ci
Travis CI
2017-04-06 14:07:51 +02:00
Simon Wörner
54937c0b0b Merge pull request #9 from sikienzl/v2-delay-auswertung
V2: added Auswertung.md
2017-04-06 13:58:22 +02:00
Simon Wörner
d11fbff4ac added empty travis ci 2017-04-06 13:54:40 +02:00
Simon Wörner
e1aa450d6c added Auswertung.md 2017-04-06 13:10:05 +02:00
Simon Wörner
c61a74947f added render script and output png 2017-04-05 11:26:53 +02:00
kawaii
c796ca9d43 fixed led5 release build 2017-04-05 11:26:53 +02:00
Simon Wörner
beb8b2a987 Merge pull request #7 from SWW13/readme
modified README.md
2017-04-03 20:00:04 +02:00
Siegfried Kienzle
7aa17ef2eb modified README.md 2017-04-03 19:58:49 +02:00
Simon Wörner
2a086990df Merge pull request #6 from SWW13/v2-loop-rust
V2: loop (rust) + delay
2017-04-03 19:56:53 +02:00
Simon Wörner
e791c4fb6c fixed realtime arg help 2017-04-03 19:55:44 +02:00
Simon Wörner
20f4698db7 use CLOCK_MONOTONIC from libc, added os x support 2017-04-03 19:46:55 +02:00
Simon Wörner
bb066d5ba8 added documentation 2017-04-03 19:15:43 +02:00
Simon Wörner
c112baa562 rustfmt 2017-04-03 19:15:43 +02:00
Simon Wörner
64558495b1 added plot script and measured delays 2017-04-03 19:15:43 +02:00
Simon Wörner
b49df99659 added realtime parameter 2017-04-03 19:15:43 +02:00
Simon Wörner
c8914f364c moved sleep function to lib.rs 2017-04-03 19:15:42 +02:00
Simon Wörner
5f61004406 replace broken shuteye with libc 2017-04-03 19:15:33 +02:00
Simon Wörner
d4491f7dc1 fixed relativ delay with seconds 2017-04-03 19:10:51 +02:00
Simon Wörner
325ec5710f fixed cargo test 2017-04-03 19:10:50 +02:00
Simon Wörner
2fc9c4874f added argparser, multiple measurements and output 2017-04-03 19:10:34 +02:00
28b4e62767 Remove unnecessary nanosleep 2017-04-03 17:49:25 +02:00
22398b03aa V1 switch.c: Move duplicate code into function 2017-04-03 17:49:25 +02:00
ae5d5b638f V1: switch.c 2017-04-03 17:49:25 +02:00
Simon Wörner
37d89632a7 Revert "V1: switch.c" 2017-04-03 17:48:55 +02:00
Simon Wörner
d63bd4f35b measure sleep delay in loop 2017-04-02 11:04:51 +02:00
Siegfried Kienzle
1a7e62f5e2 Merge pull request #3 from sikienzl/v1-switch
V1: switch.c
2017-04-02 09:01:35 +02:00
Siegfried Kienzle
2289644aec Merge pull request #2 from SWW13/v1-led5
V1: led5
2017-04-01 15:38:10 +02:00
Siegfried Kienzle
fbbb82740a Merge pull request #1 from SWW13/v1-led-sh
V1: led.sh
2017-04-01 14:53:24 +02:00
175 changed files with 15864 additions and 141 deletions

View File

@@ -1,4 +1,4 @@
image: scorpil/rust:stable
image: scorpil/rust:nightly
stages:
- test
@@ -10,6 +10,9 @@ cargo:test:
rustfmt:
stage: test
before_script:
- cargo install rustfmt
- export PATH="/root/.cargo/bin:$PATH"
script:
- ci/run-rustfmt.sh

7
.travis.yml Normal file
View File

@@ -0,0 +1,7 @@
language: rust
rust:
- nightly
script:
- cargo install rustfmt
- ci/run-rustfmt.sh
- ci/run-cargo-test.sh

View File

@@ -24,8 +24,8 @@ static GPIO_LED_ON: &'static str = "0";
static GPIO_LED_OFF: &'static str = "1";
fn write(path: &str, value: &str) {
let mut file = File::create(Path::new(path))
.expect(format!("Open file '{}' failed", path).as_str());
let mut file = File::create(Path::new(path)).expect(format!("Open file '{}' failed", path)
.as_str());
file.write_all(value.as_bytes())
.expect(format!("Write value '{}' to '{}' file failed", value, path).as_str());
@@ -34,8 +34,8 @@ fn write(path: &str, value: &str) {
println!("Wrote value '{}' to '{}'.", value, path);
}
fn read(path: &str) -> String {
let mut file = File::open(Path::new(path))
.expect(format!("Open file '{}' failed", path).as_str());
let mut file = File::open(Path::new(path)).expect(format!("Open file '{}' failed", path)
.as_str());
let mut contents = String::new();
file.read_to_string(&mut contents)
@@ -55,11 +55,13 @@ fn unexport(port: &str) {
}
fn set_direction(port: &str, direction: &str) {
write(format!("/sys/class/gpio/gpio{}/direction", port).as_str(), direction);
write(format!("/sys/class/gpio/gpio{}/direction", port).as_str(),
direction);
}
fn set_value(port: &str, value: &str) {
write(format!("/sys/class/gpio/gpio{}/value", port).as_str(), value);
write(format!("/sys/class/gpio/gpio{}/value", port).as_str(),
value);
}
fn get_value(port: &str) -> String {
String::from(read(format!("/sys/class/gpio/gpio{}/value", port).as_str()).trim())
@@ -81,9 +83,7 @@ fn main() {
chan_select! {
rpanic.recv() => { },
signal.recv() -> signal => {
#[cfg(debug_assertions)]
println!("received signal: {:?}", signal);
sdone.send(());
}
}

View File

@@ -1,120 +1,102 @@
/*
* switch.c
* How to register an button and count this
* author: Simon Wörner, Manuel Vögele,
* Siegfried Kienzle
* 24-March-2017
*
* */
#define BUTTON "17"
#define IN "in\n"
#define OUT "out\n"
#define HIGH "1\n"
#define LOW "0\n"
#define MAXBYTES 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
int writeIntoFile(char* value, char* path)
#define BASEPATH "/sys/class/gpio/"
#define GPIO_FOLDER "gpio%s/"
#define PIN_BUTTON "17"
#define PIN_LED "18"
#define LED_ON 0
#define LED_OFF 1
#define BUTTON_PRESSED 0
#define BUTTON_RELEASED 1
void writeFile(char *filename, char *buffer, size_t count)
{
int fd;
char buffer[3];
strcpy(buffer, value);
if((fd=open(path, O_RDWR | O_CREAT | O_TRUNC)) == -1) {
perror(NULL);
return EXIT_FAILURE;
}
if((write(fd, &buffer, sizeof(buffer))) == -1) {
perror("Cannot write into file");
return EXIT_FAILURE;
}
printf("Success");
close(fd);
return EXIT_SUCCESS;
int fd = open(filename, O_WRONLY);
write(fd, buffer, count);
close(fd);
}
int reserve(char* gpioPort)
void registerPin(char *pin)
{
char str[3];
strcpy(str, gpioPort);
strcat(str, "\n");
return writeIntoFile(str,"/sys/class/gpio/export");
writeFile(BASEPATH "export", pin, strlen(pin));
}
int setDirection(char* gpioPort, char* inOut)
void freePin(char *pin)
{
char *direc = "/direction";
char *gpioPath = "/sys/class/gpio/gpio";
char path[32];
strcpy(path, gpioPath);
strcat(path, gpioPort);
strcat(path, direc);
return writeIntoFile(inOut, path);
writeFile(BASEPATH "unexport", pin, strlen(pin));
}
int setOutput(char* gpioPort, char* volt)
void setDirection(char *pin, char *direction, int dirlen)
{
char *val = "/value";
char *gpioPath = "/sys/class/gpio/gpio";
char path[28];
strcpy(path, gpioPath);
strcat(path, gpioPort);
strcat(path, val);
return writeIntoFile(volt, path);
char path[50];
sprintf(path, BASEPATH GPIO_FOLDER "direction", pin);
writeFile(path, direction, dirlen);
}
int mainLoop(char* gpioPort)
void registerInput(char *pin)
{
int fid, portValue, count, countButton;
char *val = "/value";
char *gpioPath = "/sys/class/gpio/gpio";
char path[28];
strcpy(path, gpioPath);
strcat(path, gpioPort);
strcat(path, val);
while(true)
{
if( (fid=open(path, O_RDONLY)) == -1)
perror("Fehler ");
if(readInput(fid) == 1)
{
countButton++;
printf("%d", countButton);
}
close(fid);
}
registerPin(pin);
setDirection(pin, "in", 2);
}
char[] readInput(int fid)
void registerOutput(char *pin)
{
char buffer[MAXBYTES];
read(fid, &buffer, MAXBYTES);
return buffer;
registerPin(pin);
setDirection(pin, "out", 3);
}
int unexport(char* gpioport)
int readInput(char *pin)
{
char str[3];
strcpy(str, gpioPort);
strcat(str, "\n");
return writeIntoFile(str,"/sys/class/gpio/unexport");
char path[50];
int state;
sprintf(path, BASEPATH GPIO_FOLDER "value", pin);
FILE *fd = fopen(path, "r");
fscanf(fd, "%i", &state);
fclose(fd);
return state;
}
void writeOutput(char *pin, int state)
{
char path[50];
sprintf(path, BASEPATH GPIO_FOLDER "value", pin);
FILE *fd = fopen(path, "w");
fprintf(fd, "%i", state);
fclose(fd);
}
int main()
{
reserve(BUTTON);
setDirection(BUTTON, IN);
mainLoop(BUTTON);
unexport(BUTTON);
return 0;
{
struct timespec sleeptime, sleepremain;
int oldstate = BUTTON_PRESSED;
int state;
int count = 0;
registerInput(PIN_BUTTON);
registerOutput(PIN_LED);
sleeptime.tv_sec = 0;
sleeptime.tv_nsec = 1000000;
while (1)
{
nanosleep(&sleeptime, &sleepremain);
state = readInput(PIN_BUTTON);
if (state == BUTTON_PRESSED && oldstate == BUTTON_RELEASED)
{
count++;
printf("Number of button pushes: %i\n", count);
}
if (state == BUTTON_PRESSED)
writeOutput(PIN_LED, LED_ON);
else
writeOutput(PIN_LED, LED_OFF);
oldstate = state;
}
}

1
V2/delay/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.eps

41
V2/delay/Auswerung.md Normal file
View File

@@ -0,0 +1,41 @@
# Auswertung
## No Load
### No Realtime
Läuft der Prozess ohne Load und Realtime so liegt das Delay im Mean bei etwa **100µs**.
Der Ausreiser bei *11.000µs* Sleep Periode lässt sich durch eine kurze zeitigte Last durch einen Hintergrundprozess erklären, da bei jeder Messung (100 Durchläufe) immer der Worst Case betrachtet wird.
![delay_idle](delay_idle.png)
### Realtime
Im Vergleich dazu sinkt bei aktiver Realtime Priorität das Mean Delay auf etwa **25µs**.
Hier gibt es dafür mehr Ausreiser welche aber nicht über **190µs** hinaus gehen, auch hier lassen sich diese durch eine kurze zeitigte Last von einen Hintergrundprozess erklären.
![delay_idle_rt](delay_idle_rt.png)
## Load
### No Realtime
Bei Load ohne Realtime gibt es zu Begin einen großen Ausreiser mit über **10.000 µs**.
![delay_load](delay_load.png)
### Realtime
Durch die Realtime Priorität können solche Ausreiser vermieden werden, hier liegt der Mean etwas über dem ohne Last (etwa **27,5µs**) und die Ausreiser gehen bis knapp **55µs**.
Dies liegt immer weit unter den Werten ohne Load ohne Realtime Priorität.
![delay_load_rt](delay_load_rt.png)

BIN
V2/delay/delay_idle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

100
V2/delay/delay_idle.txt Normal file
View File

@@ -0,0 +1,100 @@
1000000 74885
2000000 70188
3000000 100960
4000000 96993
5000000 97920
6000000 95671
7000000 95193
8000000 96590
9000000 93091
10000000 99800
11000000 97447
12000000 604203
13000000 104094
14000000 95803
15000000 95638
16000000 102138
17000000 102025
18000000 91546
19000000 96641
20000000 99028
21000000 120893
22000000 100362
23000000 96186
24000000 97427
25000000 136011
26000000 97303
27000000 106304
28000000 101138
29000000 107326
30000000 98307
31000000 102672
32000000 126308
33000000 96300
34000000 98373
35000000 95499
36000000 96948
37000000 100012
38000000 145522
39000000 103847
40000000 99775
41000000 97942
42000000 100953
43000000 145006
44000000 100518
45000000 97123
46000000 97738
47000000 163093
48000000 96574
49000000 99272
50000000 102283
51000000 141284
52000000 110285
53000000 98504
54000000 99068
55000000 105413
56000000 116444
57000000 94664
58000000 106010
59000000 96990
60000000 116771
61000000 105616
62000000 101075
63000000 108201
64000000 100692
65000000 97401
66000000 96037
67000000 156027
68000000 101695
69000000 100123
70000000 96780
71000000 97292
72000000 98376
73000000 101387
74000000 95961
75000000 98504
76000000 100942
77000000 97391
78000000 100610
79000000 95913
80000000 96685
81000000 96468
82000000 162291
83000000 138063
84000000 97220
85000000 96690
86000000 103070
87000000 96431
88000000 102827
89000000 132035
90000000 97650
91000000 101599
92000000 96850
93000000 105641
94000000 100006
95000000 96558
96000000 96290
97000000 99299
98000000 97207
99000000 96728
100000000 99478

BIN
V2/delay/delay_idle_rt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

100
V2/delay/delay_idle_rt.txt Normal file
View File

@@ -0,0 +1,100 @@
1000000 16656
2000000 25916
3000000 21532
4000000 21365
5000000 28073
6000000 61812
7000000 25969
8000000 22677
9000000 28709
10000000 44480
11000000 47542
12000000 44199
13000000 26011
14000000 50844
15000000 24220
16000000 47490
17000000 30084
18000000 22418
19000000 24543
20000000 130157
21000000 87386
22000000 28783
23000000 41480
24000000 34803
25000000 51356
26000000 115667
27000000 57116
28000000 25699
29000000 27147
30000000 25419
31000000 25408
32000000 25971
33000000 25752
34000000 27513
35000000 22138
36000000 25356
37000000 24461
38000000 24919
39000000 26107
40000000 27034
41000000 27025
42000000 48784
43000000 188304
44000000 65535
45000000 72815
46000000 81399
47000000 89305
48000000 72733
49000000 27411
50000000 27557
51000000 101504
52000000 26026
53000000 25078
54000000 25693
55000000 22349
56000000 26401
57000000 27381
58000000 27996
59000000 23610
60000000 28079
61000000 22913
62000000 23371
63000000 28777
64000000 26476
65000000 27091
66000000 24528
67000000 23684
68000000 23675
69000000 22883
70000000 24904
71000000 26925
72000000 22332
73000000 24405
74000000 26530
75000000 23811
76000000 26094
77000000 22854
78000000 24511
79000000 22833
80000000 31417
81000000 21719
82000000 23324
83000000 26803
84000000 26585
85000000 26437
86000000 29864
87000000 26000
88000000 28438
89000000 28689
90000000 22794
91000000 23148
92000000 22096
93000000 26096
94000000 27233
95000000 25661
96000000 24244
97000000 25797
98000000 22609
99000000 25673
100000000 26861

BIN
V2/delay/delay_load.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

100
V2/delay/delay_load.txt Normal file
View File

@@ -0,0 +1,100 @@
1000000 10251030
2000000 81073
3000000 75124
4000000 74646
5000000 63594
6000000 74833
7000000 72323
8000000 75230
9000000 75063
10000000 73386
11000000 78688
12000000 76335
13000000 74814
14000000 76106
15000000 79221
16000000 72074
17000000 77377
18000000 113772
19000000 86679
20000000 81460
21000000 78170
22000000 85867
23000000 78670
24000000 78711
25000000 73493
26000000 73848
27000000 85347
28000000 77889
29000000 83868
30000000 71202
31000000 79993
32000000 72849
33000000 84765
34000000 95432
35000000 86151
36000000 82703
37000000 85662
38000000 82266
39000000 87048
40000000 76569
41000000 137860
42000000 74517
43000000 75653
44000000 77154
45000000 80841
46000000 74633
47000000 85665
48000000 297163
49000000 78457
50000000 86051
51000000 68436
52000000 75406
53000000 387268
54000000 84187
55000000 83396
56000000 76563
57000000 82334
58000000 83886
59000000 283875
60000000 73294
61000000 76200
62000000 78482
63000000 88784
64000000 77055
65000000 79389
66000000 115212
67000000 87911
68000000 79776
69000000 83620
70000000 91839
71000000 84277
72000000 74006
73000000 78058
74000000 81886
75000000 85627
76000000 79419
77000000 87691
78000000 85806
79000000 78192
80000000 74693
81000000 79631
82000000 94621
83000000 76486
84000000 72257
85000000 78811
86000000 88280
87000000 78009
88000000 104926
89000000 78459
90000000 83397
91000000 78648
92000000 67649
93000000 79722
94000000 78514
95000000 79025
96000000 67974
97000000 78225
98000000 78944
99000000 78830
100000000 67622

BIN
V2/delay/delay_load_rt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

100
V2/delay/delay_load_rt.txt Normal file
View File

@@ -0,0 +1,100 @@
1000000 22281
2000000 15345
3000000 14709
4000000 13867
5000000 14377
6000000 28221
7000000 37482
8000000 12732
9000000 21993
10000000 15681
11000000 27859
12000000 23578
13000000 23828
14000000 23871
15000000 22037
16000000 20413
17000000 23163
18000000 18153
19000000 23404
20000000 18447
21000000 24166
22000000 22385
23000000 28885
24000000 23510
25000000 21313
26000000 27656
27000000 18063
28000000 26386
29000000 18044
30000000 19023
31000000 19222
32000000 18534
33000000 23941
34000000 35909
35000000 18869
36000000 18025
37000000 36505
38000000 23891
39000000 19246
40000000 18246
41000000 24433
42000000 17966
43000000 27591
44000000 18935
45000000 20436
46000000 22770
47000000 19061
48000000 19833
49000000 24197
50000000 23719
51000000 19751
52000000 24636
53000000 19470
54000000 24147
55000000 27940
56000000 27722
57000000 18962
58000000 24368
59000000 19932
60000000 20911
61000000 19859
62000000 19745
63000000 24214
64000000 19048
65000000 25497
66000000 18716
67000000 27456
68000000 20415
69000000 23582
70000000 26332
71000000 20177
72000000 25270
73000000 19532
74000000 25042
75000000 24668
76000000 25543
77000000 33971
78000000 35887
79000000 46503
80000000 45504
81000000 52368
82000000 23348
83000000 36568
84000000 16037
85000000 16548
86000000 16017
87000000 37882
88000000 14955
89000000 22341
90000000 23477
91000000 14197
92000000 15749
93000000 22822
94000000 15521
95000000 45511
96000000 34095
97000000 49033
98000000 53501
99000000 36409
100000000 37909

11
V2/delay/render.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -o xtrace
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
cd "${SCRIPT_DIR}" && gnuplot -c sleep_delay.gp
while IFS= read -r -d '' f; do
output=$(echo "$f" | sed -E 's/\.eps$/.png/')
convert -density 300 "eps2:${f}" "$output"
done < <(find "${SCRIPT_DIR}" -name '*.eps' -print0)

20
V2/delay/sleep_delay.gp Normal file
View File

@@ -0,0 +1,20 @@
set title "{/=20 nanosleep delays}"
set terminal postscript eps enhanced
set xlabel "{/=20Period to sleep [nanoseconds]}"
set ylabel "{/=20Measured delay [nanoseconds]}"
set grid
set autoscale
set style data lines
show style data
set output 'delay_idle.eps'
plot 'delay_idle.txt' using ($1):($2) title "{/=17 Load: no, RT: no}" lw 6
set output 'delay_load.eps'
plot 'delay_load.txt' using ($1):($2) title "{/=17 Load: yes, RT: no}" lw 6
set output 'delay_idle_rt.eps'
plot 'delay_idle_rt.txt' using ($1):($2) title "{/=17 Load: no, RT: yes}" lw 6
set output 'delay_load_rt.eps'
plot 'delay_load_rt.txt' using ($1):($2) title "{/=17 Load: yes, RT: yes}" lw 6

View File

@@ -1,31 +0,0 @@
#include<stdio.h>
#include<time.h>
#include<pthread.h>
int main(int argc, char *argv[])
{
struct timespec time1, start, ende;
time1.tv_sec = 5;
time1.tv_nsec = 0;
clock_gettime(CLOCK_MONOTONIC, &start);
clock_nanosleep(CLOCK_MONOTONIC, 0, &time1, NULL);
clock_gettime(CLOCK_MONOTONIC, &ende);
int nsec_difference = (int) ((ende.tv_nsec - start.tv_nsec)/1000);
//microseconds
int sec_difference = (int) (ende.tv_sec - start.tv_sec)*1000*1000;
int real_time_slept = sec_difference + nsec_difference;
int difference_real_set = real_time_slept - time1.tv_sec * 1000 * 1000;
printf("Real time slept: %d\n", real_time_slept);
printf("Difference Real time slept and actually sleep time: %d usec\n", difference_real_set);
return 0;
}

62
V2/sleep/Cargo.lock generated Normal file
View File

@@ -0,0 +1,62 @@
[root]
name = "sleep"
version = "0.1.0"
dependencies = [
"argparse 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "argparse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "redox_syscall"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "time"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum argparse 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37bb99f5e39ee8b23b6e227f5b8f024207e8616f44aa4b8c76ecd828011667ef"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135"
"checksum redox_syscall 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "29dbdfd4b9df8ab31dec47c6087b7b13cbf4a776f335e4de8efba8288dda075b"
"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"

9
V2/sleep/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "sleep"
version = "0.1.0"
authors = ["Simon Wörner <git@simon-woerner.de>"]
[dependencies]
argparse = ">=0.2.1"
libc = ">=0.2"
time = ">=0.1.36"

95
V2/sleep/src/lib.rs Normal file
View File

@@ -0,0 +1,95 @@
extern crate libc;
use std::time::Duration;
#[cfg(target_os = "linux")]
fn clock_nanosleep(clk_id: libc::clockid_t,
flags: libc::c_int,
rqtp: *const libc::timespec,
rmtp: *mut libc::timespec)
-> libc::c_int {
unsafe { libc::clock_nanosleep(clk_id, flags, rqtp as *const _, rmtp as *mut _) }
}
#[cfg(target_os = "macos")]
fn nanosleep(rqtp: *const libc::timespec, rmtp: *mut libc::timespec) -> libc::c_int {
unsafe { libc::nanosleep(rqtp as *const _, rmtp as *mut _) }
}
/// Sleeps for the given duration.
///
/// Examples:
///
/// ```rust
/// extern crate sleep;
/// use std::time::Duration;
///
/// // sleep 10 ms
/// sleep::sleep(Duration::from_millis(10));
/// ```
///
/// Uses `clock_nanosleep` on linux and `nanosleep` on darwin.
pub fn sleep(duration: Duration) -> Result<Duration, libc::c_int> {
let ts = duration_to_timespec(duration);
let mut remain = libc::timespec {
tv_sec: 0,
tv_nsec: 0,
};
#[cfg(target_os = "linux")]
let ret = clock_nanosleep(libc::CLOCK_MONOTONIC, 0, &ts, &mut remain);
#[cfg(target_os = "macos")]
let ret = nanosleep(&ts, &mut remain);
if ret == 0 {
Ok(timespec_to_duration(remain))
} else {
Err(ret)
}
}
fn duration_to_timespec(duration: Duration) -> libc::timespec {
libc::timespec {
tv_sec: duration.as_secs() as libc::time_t,
tv_nsec: duration.subsec_nanos() as libc::c_long,
}
}
fn timespec_to_duration(timespec: libc::timespec) -> Duration {
Duration::new(timespec.tv_sec as u64, timespec.tv_nsec as u32)
}
/// Set scheduler policy and priority for process with given pid.
///
/// If `pid` equals zero, the policy of the calling process will be set.
///
/// # Examples
///
/// ```rust
/// extern crate libc;
/// extern crate sleep;
///
/// // set *round-robin* policy (default) and priority 99 (realtime) for own process
/// sleep::set_scheduler(0, libc::SCHED_RR, 99);
/// ```
#[cfg(target_os = "linux")]
pub fn set_scheduler(pid: libc::pid_t, policy: libc::c_int, priority: libc::c_int) -> libc::c_int {
let param = libc::sched_param { sched_priority: priority };
unsafe { libc::sched_setscheduler(pid, policy, &param) }
}
/// Set scheduler *round-robin* policy (default) and priority for own process.
///
/// # Examples
///
/// ```rust
/// extern crate sleep;
///
/// // set *round-robin* policy (default) and priority 99 (realtime)
/// sleep::set_priority(99);
/// ```
#[cfg(target_os = "linux")]
pub fn set_priority(priority: i32) -> libc::c_int {
set_scheduler(0, libc::SCHED_RR, priority)
}

157
V2/sleep/src/main.rs Normal file
View File

@@ -0,0 +1,157 @@
#![feature(step_by)]
extern crate argparse;
extern crate sleep;
extern crate time;
use std::io::prelude::*;
use std::fs::File;
use std::path::Path;
use std::time::Duration;
use argparse::{ArgumentParser, Print, Store};
use sleep::sleep;
use time::precise_time_ns;
#[cfg(target_os = "linux")]
use argparse::StoreTrue;
#[cfg(target_os = "linux")]
use sleep::set_priority;
fn duration_from_ns(duration_ns: u64) -> Duration {
Duration::new(duration_ns / 1_000_000_000,
(duration_ns % 1_000_000_000) as u32)
}
fn duration_to_ns(duration: Duration) -> u64 {
duration.as_secs() * 1_000_000_000u64 + duration.subsec_nanos() as u64
}
fn measure_duration(sleep_duration: Duration) -> Duration {
let start = precise_time_ns();
let _remain = sleep(sleep_duration);
let end = precise_time_ns();
#[cfg(debug_assertions)]
println!("remain = {:?}", _remain);
let duration = end - start;
let duration = duration_from_ns(duration);
#[cfg(debug_assertions)]
println!("duration = {:?}", duration);
duration
}
fn measure_delay(sleep_duration: Duration) -> (Duration, Duration) {
let duration = measure_duration(sleep_duration);
let delay = duration - sleep_duration;
#[cfg(debug_assertions)]
println!("delay = {:?}", delay);
(duration, delay)
}
fn measure_delay_loop(sleep_duration: Duration, count: u64) -> Vec<(Duration, Duration)> {
println!("Starting measurment with period {}s {}ns for {} loops",
sleep_duration.as_secs(),
sleep_duration.subsec_nanos(),
count);
let mut data: Vec<(Duration, Duration)> = Vec::with_capacity(count as usize);
for _ in 0..count {
let (duration, delay) = measure_delay(sleep_duration);
data.push((duration, delay));
#[cfg(debug_assertions)]
print_delay(duration, delay);
}
data
}
fn print_delay(duration: Duration, delay: Duration) {
println!("value: {} s {} ns\tdelay: {} s {} ns\trelativ delay = {:.2}%\traw_data: {:?}",
duration.as_secs(),
duration.subsec_nanos(),
delay.as_secs(),
delay.subsec_nanos(),
(duration_to_ns(delay) * 100) as f64 / duration_to_ns(duration) as f64,
delay);
}
fn main() {
let mut min: u64 = 1_000_000;
let mut max: u64 = 100_000_000;
let mut step: u64 = 1_000_000;
let mut count: u64 = 100;
let mut output: String = "".to_string();
let mut file: Option<File> = None;
#[cfg(target_os = "linux")]
let mut realtime: bool = false;
#[cfg(target_os = "macos")]
let realtime: bool = false;
{
let mut ap = ArgumentParser::new();
ap.set_description(env!("CARGO_PKG_DESCRIPTION"));
ap.refer(&mut min)
.add_option(&["--min"], Store, "Sleep period start");
ap.refer(&mut max)
.add_option(&["--max"], Store, "Sleep period end");
ap.refer(&mut step)
.add_option(&["--step"], Store, "Sleep period step size");
ap.refer(&mut count)
.add_option(&["--loop"], Store, "Count of measurements per period");
#[cfg(target_os = "linux")]
ap.refer(&mut realtime)
.add_option(&["--rt"], StoreTrue, "Set realtime priority");
ap.refer(&mut output)
.add_option(&["-o", "--out"], Store, "Output file");
ap.add_option(&["-V", "--version"],
Print(env!("CARGO_PKG_VERSION").to_string()),
"Show version");
ap.parse_args_or_exit();
}
if realtime {
#[cfg(target_os = "linux")]
let ret = set_priority(99);
#[cfg(target_os = "macos")]
let ret = 0;
if ret != 0 {
panic!("Set realtime priority failed.");
}
}
if output != "" {
file = Some(File::create(Path::new(output.as_str())).expect(format!("Open file '{}' failed",
output)
.as_str()));
}
for duration in (min..max + 1).step_by(step) {
let data = measure_delay_loop(duration_from_ns(duration), count);
let max_delay = data.iter().max().expect("Max delay not found");
#[cfg(debug_assertions)]
println!("max_delay = {:?}", max_delay);
print_delay(max_delay.0, max_delay.1);
match file.as_ref() {
Some(mut f) => {
let value = format!("{: >9} {}\n", duration, duration_to_ns(max_delay.1));
f.write_all(value.as_bytes())
.expect(format!("Write value '{}' to '{}' file failed", value, output)
.as_str());
}
None => {}
}
}
}

View File

@@ -3,10 +3,8 @@
ERROR=0
while IFS= read -r -d '' f; do
dir="$(dirname "${f}")"
echo "run 'cargo test' in ${dir}"
cd "${dir}" && cargo test
echo "run 'cargo test' with ${f}"
cargo test --manifest-path="${f}"
if [[ $? -ne 0 ]]; then
ERROR=1

View File

@@ -4,10 +4,7 @@ ERROR=0
while IFS= read -r -d '' f; do
echo "${f}"
if [ "$(rustfmt --write-mode=diff "$f")" != $'' ] ; then
ERROR=1
fi
rustfmt --write-mode=diff "$f" || ERROR=1
done < <(find . -type f -name '*.rs' -print0)
exit ${ERROR}

36
kawaii/CMakeLists.txt Normal file
View File

@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 3.7)
project(kawaii-engine)
add_subdirectory(kawaii-rs)
set(CMAKE_CXX_STANDARD 14)
set(SOURCE_FILES gpio.cpp engine.cpp measure.cpp)
if (MEASURE)
add_definitions("-DMEASURE")
endif (MEASURE)
#add_executable(engine ${SOURCE_FILES} test.cpp ultrasound_sensor.cpp)
#add_executable(remote ${SOURCE_FILES} remote.cpp)
add_executable(kawaii ${SOURCE_FILES} main.cpp ultrasound_sensor.cpp rfid_reader.cpp MFRC522.cpp rfid_reader.cpp emergency_stop.cpp)
#add_dependencies(engine kawaii-rs)
#add_dependencies(remote kawaii-rs)
add_dependencies(kawaii kawaii-rs)
#target_link_libraries(engine
# debug "${CMAKE_SOURCE_DIR}/kawaii-rs/target/debug/libkawaii.a"
# optimized "${CMAKE_SOURCE_DIR}/kawaii-rs/target/release/libkawaii.a"
# util dl rt pthread gcc_s c m rt pthread util
# pthread)
#target_link_libraries(remote
# debug "${CMAKE_SOURCE_DIR}/kawaii-rs/target/debug/libkawaii.a"
# optimized "${CMAKE_SOURCE_DIR}/kawaii-rs/target/release/libkawaii.a"
# util dl rt pthread gcc_s c m rt pthread util
# boost_system pthread)
target_link_libraries(kawaii
debug "${CMAKE_SOURCE_DIR}/kawaii-rs/target/debug/libkawaii.a"
optimized "${CMAKE_SOURCE_DIR}/kawaii-rs/target/release/libkawaii.a"
util dl rt pthread gcc_s c m rt pthread util
pthread bcm2835)

1755
kawaii/MFRC522.cpp Normal file

File diff suppressed because it is too large Load Diff

323
kawaii/MFRC522.h Normal file
View File

@@ -0,0 +1,323 @@
/**
* MFRC522.h - Library to use ARDUINO RFID MODULE KIT 13.56 MHZ WITH TAGS SPI W AND R BY COOQROBOT.
* Based on code Dr.Leong ( WWW.B2CQSHOP.COM )
* Created by Miguel Balboa (circuitito.com), Jan, 2012.
* Rewritten by Søren Thing Andersen (access.thing.dk), fall of 2013 (Translation to English, refactored, comments, anti collision, cascade levels.)
* Extended by Tom Clement with functionality to write to sector 0 of UID changeable Mifare cards.
* Released into the public domain.
*
-- Repurposed to fit Raspberry Pi ---
*/
#ifndef MFRC522_h
#define MFRC522_h
#include <stdint.h>
#include <stdio.h>
#include <string>
using namespace std;
typedef uint8_t byte;
typedef uint16_t word;
// Firmware data for self-test
// Reference values based on firmware version; taken from 16.1.1 in spec.
// Version 1.0
const byte MFRC522_firmware_referenceV1_0[] = {
0x00, 0xC6, 0x37, 0xD5, 0x32, 0xB7, 0x57, 0x5C,
0xC2, 0xD8, 0x7C, 0x4D, 0xD9, 0x70, 0xC7, 0x73,
0x10, 0xE6, 0xD2, 0xAA, 0x5E, 0xA1, 0x3E, 0x5A,
0x14, 0xAF, 0x30, 0x61, 0xC9, 0x70, 0xDB, 0x2E,
0x64, 0x22, 0x72, 0xB5, 0xBD, 0x65, 0xF4, 0xEC,
0x22, 0xBC, 0xD3, 0x72, 0x35, 0xCD, 0xAA, 0x41,
0x1F, 0xA7, 0xF3, 0x53, 0x14, 0xDE, 0x7E, 0x02,
0xD9, 0x0F, 0xB5, 0x5E, 0x25, 0x1D, 0x29, 0x79
};
// Version 2.0
const byte MFRC522_firmware_referenceV2_0[] = {
0x00, 0xEB, 0x66, 0xBA, 0x57, 0xBF, 0x23, 0x95,
0xD0, 0xE3, 0x0D, 0x3D, 0x27, 0x89, 0x5C, 0xDE,
0x9D, 0x3B, 0xA7, 0x00, 0x21, 0x5B, 0x89, 0x82,
0x51, 0x3A, 0xEB, 0x02, 0x0C, 0xA5, 0x00, 0x49,
0x7C, 0x84, 0x4D, 0xB3, 0xCC, 0xD2, 0x1B, 0x81,
0x5D, 0x48, 0x76, 0xD5, 0x71, 0x61, 0x21, 0xA9,
0x86, 0x96, 0x83, 0x38, 0xCF, 0x9D, 0x5B, 0x6D,
0xDC, 0x15, 0xBA, 0x3E, 0x7D, 0x95, 0x3B, 0x2F
};
class MFRC522 {
public:
// MFRC522 registers. Described in chapter 9 of the datasheet.
// When using SPI all addresses are shifted one bit left in the "SPI address byte" (section 8.1.2.3)
enum PCD_Register {
// Page 0: Command and status
// 0x00 // reserved for future use
CommandReg = 0x01 << 1, // starts and stops command execution
ComIEnReg = 0x02 << 1, // enable and disable interrupt request control bits
DivIEnReg = 0x03 << 1, // enable and disable interrupt request control bits
ComIrqReg = 0x04 << 1, // interrupt request bits
DivIrqReg = 0x05 << 1, // interrupt request bits
ErrorReg = 0x06 << 1, // error bits showing the error status of the last command executed
Status1Reg = 0x07 << 1, // communication status bits
Status2Reg = 0x08 << 1, // receiver and transmitter status bits
FIFODataReg = 0x09 << 1, // input and output of 64 byte FIFO buffer
FIFOLevelReg = 0x0A << 1, // number of bytes stored in the FIFO buffer
WaterLevelReg = 0x0B << 1, // level for FIFO underflow and overflow warning
ControlReg = 0x0C << 1, // miscellaneous control registers
BitFramingReg = 0x0D << 1, // adjustments for bit-oriented frames
CollReg = 0x0E << 1, // bit position of the first bit-collision detected on the RF interface
// 0x0F // reserved for future use
// Page 1: Command
// 0x10 // reserved for future use
ModeReg = 0x11 << 1, // defines general modes for transmitting and receiving
TxModeReg = 0x12 << 1, // defines transmission data rate and framing
RxModeReg = 0x13 << 1, // defines reception data rate and framing
TxControlReg = 0x14 << 1, // controls the logical behavior of the antenna driver pins TX1 and TX2
TxASKReg = 0x15 << 1, // controls the setting of the transmission modulation
TxSelReg = 0x16 << 1, // selects the internal sources for the antenna driver
RxSelReg = 0x17 << 1, // selects internal receiver settings
RxThresholdReg = 0x18 << 1, // selects thresholds for the bit decoder
DemodReg = 0x19 << 1, // defines demodulator settings
// 0x1A // reserved for future use
// 0x1B // reserved for future use
MfTxReg = 0x1C << 1, // controls some MIFARE communication transmit parameters
MfRxReg = 0x1D << 1, // controls some MIFARE communication receive parameters
// 0x1E // reserved for future use
SerialSpeedReg = 0x1F << 1, // selects the speed of the serial UART interface
// Page 2: Configuration
// 0x20 // reserved for future use
CRCResultRegH = 0x21 << 1, // shows the MSB and LSB values of the CRC calculation
CRCResultRegL = 0x22 << 1,
// 0x23 // reserved for future use
ModWidthReg = 0x24 << 1, // controls the ModWidth setting?
// 0x25 // reserved for future use
RFCfgReg = 0x26 << 1, // configures the receiver gain
GsNReg = 0x27 << 1, // selects the conductance of the antenna driver pins TX1 and TX2 for modulation
CWGsPReg = 0x28 << 1, // defines the conductance of the p-driver output during periods of no modulation
ModGsPReg = 0x29 << 1, // defines the conductance of the p-driver output during periods of modulation
TModeReg = 0x2A << 1, // defines settings for the internal timer
TPrescalerReg = 0x2B << 1, // the lower 8 bits of the TPrescaler value. The 4 high bits are in TModeReg.
TReloadRegH = 0x2C << 1, // defines the 16-bit timer reload value
TReloadRegL = 0x2D << 1,
TCounterValueRegH = 0x2E << 1, // shows the 16-bit timer value
TCounterValueRegL = 0x2F << 1,
// Page 3: Test Registers
// 0x30 // reserved for future use
TestSel1Reg = 0x31 << 1, // general test signal configuration
TestSel2Reg = 0x32 << 1, // general test signal configuration
TestPinEnReg = 0x33 << 1, // enables pin output driver on pins D1 to D7
TestPinValueReg = 0x34 << 1, // defines the values for D1 to D7 when it is used as an I/O bus
TestBusReg = 0x35 << 1, // shows the status of the internal test bus
AutoTestReg = 0x36 << 1, // controls the digital self test
VersionReg = 0x37 << 1, // shows the software version
AnalogTestReg = 0x38 << 1, // controls the pins AUX1 and AUX2
TestDAC1Reg = 0x39 << 1, // defines the test value for TestDAC1
TestDAC2Reg = 0x3A << 1, // defines the test value for TestDAC2
TestADCReg = 0x3B << 1 // shows the value of ADC I and Q channels
// 0x3C // reserved for production tests
// 0x3D // reserved for production tests
// 0x3E // reserved for production tests
// 0x3F // reserved for production tests
};
// MFRC522 commands. Described in chapter 10 of the datasheet.
enum PCD_Command {
PCD_Idle = 0x00, // no action, cancels current command execution
PCD_Mem = 0x01, // stores 25 bytes into the internal buffer
PCD_GenerateRandomID = 0x02, // generates a 10-byte random ID number
PCD_CalcCRC = 0x03, // activates the CRC coprocessor or performs a self test
PCD_Transmit = 0x04, // transmits data from the FIFO buffer
PCD_NoCmdChange = 0x07, // no command change, can be used to modify the CommandReg register bits without affecting the command, for example, the PowerDown bit
PCD_Receive = 0x08, // activates the receiver circuits
PCD_Transceive = 0x0C, // transmits data from FIFO buffer to antenna and automatically activates the receiver after transmission
PCD_MFAuthent = 0x0E, // performs the MIFARE standard authentication as a reader
PCD_SoftReset = 0x0F // resets the MFRC522
};
// MFRC522 RxGain[2:0] masks, defines the receiver's signal voltage gain factor (on the PCD).
// Described in 9.3.3.6 / table 98 of the datasheet at http://www.nxp.com/documents/data_sheet/MFRC522.pdf
enum PCD_RxGain {
RxGain_18dB = 0x00 << 4, // 000b - 18 dB, minimum
RxGain_23dB = 0x01 << 4, // 001b - 23 dB
RxGain_18dB_2 = 0x02 << 4, // 010b - 18 dB, it seems 010b is a duplicate for 000b
RxGain_23dB_2 = 0x03 << 4, // 011b - 23 dB, it seems 011b is a duplicate for 001b
RxGain_33dB = 0x04 << 4, // 100b - 33 dB, average, and typical default
RxGain_38dB = 0x05 << 4, // 101b - 38 dB
RxGain_43dB = 0x06 << 4, // 110b - 43 dB
RxGain_48dB = 0x07 << 4, // 111b - 48 dB, maximum
RxGain_min = 0x00 << 4, // 000b - 18 dB, minimum, convenience for RxGain_18dB
RxGain_avg = 0x04 << 4, // 100b - 33 dB, average, convenience for RxGain_33dB
RxGain_max = 0x07 << 4 // 111b - 48 dB, maximum, convenience for RxGain_48dB
};
// Commands sent to the PICC.
enum PICC_Command {
// The commands used by the PCD to manage communication with several PICCs (ISO 14443-3, Type A, section 6.4)
PICC_CMD_REQA = 0x26, // REQuest command, Type A. Invites PICCs in state IDLE to go to READY and prepare for anticollision or selection. 7 bit frame.
PICC_CMD_WUPA = 0x52, // Wake-UP command, Type A. Invites PICCs in state IDLE and HALT to go to READY(*) and prepare for anticollision or selection. 7 bit frame.
PICC_CMD_CT = 0x88, // Cascade Tag. Not really a command, but used during anti collision.
PICC_CMD_SEL_CL1 = 0x93, // Anti collision/Select, Cascade Level 1
PICC_CMD_SEL_CL2 = 0x95, // Anti collision/Select, Cascade Level 2
PICC_CMD_SEL_CL3 = 0x97, // Anti collision/Select, Cascade Level 3
PICC_CMD_HLTA = 0x50, // HaLT command, Type A. Instructs an ACTIVE PICC to go to state HALT.
// The commands used for MIFARE Classic (from http://www.nxp.com/documents/data_sheet/MF1S503x.pdf, Section 9)
// Use PCD_MFAuthent to authenticate access to a sector, then use these commands to read/write/modify the blocks on the sector.
// The read/write commands can also be used for MIFARE Ultralight.
PICC_CMD_MF_AUTH_KEY_A = 0x60, // Perform authentication with Key A
PICC_CMD_MF_AUTH_KEY_B = 0x61, // Perform authentication with Key B
PICC_CMD_MF_READ = 0x30, // Reads one 16 byte block from the authenticated sector of the PICC. Also used for MIFARE Ultralight.
PICC_CMD_MF_WRITE = 0xA0, // Writes one 16 byte block to the authenticated sector of the PICC. Called "COMPATIBILITY WRITE" for MIFARE Ultralight.
PICC_CMD_MF_DECREMENT = 0xC0, // Decrements the contents of a block and stores the result in the internal data register.
PICC_CMD_MF_INCREMENT = 0xC1, // Increments the contents of a block and stores the result in the internal data register.
PICC_CMD_MF_RESTORE = 0xC2, // Reads the contents of a block into the internal data register.
PICC_CMD_MF_TRANSFER = 0xB0, // Writes the contents of the internal data register to a block.
// The commands used for MIFARE Ultralight (from http://www.nxp.com/documents/data_sheet/MF0ICU1.pdf, Section 8.6)
// The PICC_CMD_MF_READ and PICC_CMD_MF_WRITE can also be used for MIFARE Ultralight.
PICC_CMD_UL_WRITE = 0xA2 // Writes one 4 byte page to the PICC.
};
// MIFARE constants that does not fit anywhere else
enum MIFARE_Misc {
MF_ACK = 0xA, // The MIFARE Classic uses a 4 bit ACK/NAK. Any other value than 0xA is NAK.
MF_KEY_SIZE = 6 // A Mifare Crypto1 key is 6 bytes.
};
// PICC types we can detect. Remember to update PICC_GetTypeName() if you add more.
enum PICC_Type {
PICC_TYPE_UNKNOWN = 0,
PICC_TYPE_ISO_14443_4 = 1, // PICC compliant with ISO/IEC 14443-4
PICC_TYPE_ISO_18092 = 2, // PICC compliant with ISO/IEC 18092 (NFC)
PICC_TYPE_MIFARE_MINI = 3, // MIFARE Classic protocol, 320 bytes
PICC_TYPE_MIFARE_1K = 4, // MIFARE Classic protocol, 1KB
PICC_TYPE_MIFARE_4K = 5, // MIFARE Classic protocol, 4KB
PICC_TYPE_MIFARE_UL = 6, // MIFARE Ultralight or Ultralight C
PICC_TYPE_MIFARE_PLUS = 7, // MIFARE Plus
PICC_TYPE_TNP3XXX = 8, // Only mentioned in NXP AN 10833 MIFARE Type Identification Procedure
PICC_TYPE_NOT_COMPLETE = 255 // SAK indicates UID is not complete.
};
// Return codes from the functions in this class. Remember to update GetStatusCodeName() if you add more.
enum StatusCode {
STATUS_OK = 1, // Success
STATUS_ERROR = 2, // Error in communication
STATUS_COLLISION = 3, // Collission detected
STATUS_TIMEOUT = 4, // Timeout in communication.
STATUS_NO_ROOM = 5, // A buffer is not big enough.
STATUS_INTERNAL_ERROR = 6, // Internal error in the code. Should not happen ;-)
STATUS_INVALID = 7, // Invalid argument.
STATUS_CRC_WRONG = 8, // The CRC_A does not match
STATUS_MIFARE_NACK = 9 // A MIFARE PICC responded with NAK.
};
// A struct used for passing the UID of a PICC.
typedef struct {
byte size; // Number of bytes in the UID. 4, 7 or 10.
byte uidByte[10];
byte sak; // The SAK (Select acknowledge) byte returned from the PICC after successful selection.
} Uid;
// A struct used for passing a MIFARE Crypto1 key
typedef struct {
byte keyByte[MF_KEY_SIZE];
} MIFARE_Key;
// Member variables
Uid uid; // Used by PICC_ReadCardSerial().
// Size of the MFRC522 FIFO
static const byte FIFO_SIZE = 64; // The FIFO is 64 bytes.
/////////////////////////////////////////////////////////////////////////////////////
// Functions for setting up the Raspberry Pi
/////////////////////////////////////////////////////////////////////////////////////
MFRC522();
void setSPIConfig();
/////////////////////////////////////////////////////////////////////////////////////
// Basic interface functions for communicating with the MFRC522
/////////////////////////////////////////////////////////////////////////////////////
void PCD_WriteRegister(byte reg, byte value);
void PCD_WriteRegister(byte reg, byte count, byte *values);
byte PCD_ReadRegister(byte reg);
void PCD_ReadRegister(byte reg, byte count, byte *values, byte rxAlign = 0);
void setBitMask(unsigned char reg, unsigned char mask);
void PCD_SetRegisterBitMask(byte reg, byte mask);
void PCD_ClearRegisterBitMask(byte reg, byte mask);
byte PCD_CalculateCRC(byte *data, byte length, byte *result);
/////////////////////////////////////////////////////////////////////////////////////
// Functions for manipulating the MFRC522
/////////////////////////////////////////////////////////////////////////////////////
void PCD_Init();
void PCD_Reset();
void PCD_AntennaOn();
void PCD_AntennaOff();
byte PCD_GetAntennaGain();
void PCD_SetAntennaGain(byte mask);
bool PCD_PerformSelfTest();
/////////////////////////////////////////////////////////////////////////////////////
// Functions for communicating with PICCs
/////////////////////////////////////////////////////////////////////////////////////
byte PCD_TransceiveData(byte *sendData, byte sendLen, byte *backData, byte *backLen, byte *validBits = NULL, byte rxAlign = 0, bool checkCRC = false);
byte PCD_CommunicateWithPICC(byte command, byte waitIRq, byte *sendData, byte sendLen, byte *backData = NULL, byte *backLen = NULL, byte *validBits = NULL, byte rxAlign = 0, bool checkCRC = false);
byte PICC_RequestA(byte *bufferATQA, byte *bufferSize);
byte PICC_WakeupA(byte *bufferATQA, byte *bufferSize);
byte PICC_REQA_or_WUPA(byte command, byte *bufferATQA, byte *bufferSize);
byte PICC_Select(Uid *uid, byte validBits = 0);
byte PICC_HaltA();
/////////////////////////////////////////////////////////////////////////////////////
// Functions for communicating with MIFARE PICCs
/////////////////////////////////////////////////////////////////////////////////////
byte PCD_Authenticate(byte command, byte blockAddr, MIFARE_Key *key, Uid *uid);
void PCD_StopCrypto1();
byte MIFARE_Read(byte blockAddr, byte *buffer, byte *bufferSize);
byte MIFARE_Write(byte blockAddr, byte *buffer, byte bufferSize);
byte MIFARE_Decrement(byte blockAddr, long delta);
byte MIFARE_Increment(byte blockAddr, long delta);
byte MIFARE_Restore(byte blockAddr);
byte MIFARE_Transfer(byte blockAddr);
byte MIFARE_Ultralight_Write(byte page, byte *buffer, byte bufferSize);
byte MIFARE_GetValue(byte blockAddr, long *value);
byte MIFARE_SetValue(byte blockAddr, long value);
/////////////////////////////////////////////////////////////////////////////////////
// Support functions
/////////////////////////////////////////////////////////////////////////////////////
byte PCD_MIFARE_Transceive(byte *sendData, byte sendLen, bool acceptTimeout = false);
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
//const char *GetStatusCodeName(byte code);
const string GetStatusCodeName(byte code);
byte PICC_GetType(byte sak);
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
//const char *PICC_GetTypeName(byte type);
const string PICC_GetTypeName(byte type);
void PICC_DumpToSerial(Uid *uid);
void PICC_DumpMifareClassicToSerial(Uid *uid, byte piccType, MIFARE_Key *key);
void PICC_DumpMifareClassicSectorToSerial(Uid *uid, MIFARE_Key *key, byte sector);
void PICC_DumpMifareUltralightToSerial();
void MIFARE_SetAccessBits(byte *accessBitBuffer, byte g0, byte g1, byte g2, byte g3);
bool MIFARE_OpenUidBackdoor(bool logErrors);
bool MIFARE_SetUid(byte *newUid, byte uidSize, bool logErrors);
bool MIFARE_UnbrickUidSector(bool logErrors);
/////////////////////////////////////////////////////////////////////////////////////
// Convenience functions - does not add extra functionality
/////////////////////////////////////////////////////////////////////////////////////
bool PICC_IsNewCardPresent();
bool PICC_ReadCardSerial();
private:
byte MIFARE_TwoStepHelper(byte command, byte blockAddr, long data);
};
#endif

1129
kawaii/bcm2835.h Normal file

File diff suppressed because it is too large Load Diff

29
kawaii/emergency_stop.cpp Normal file
View File

@@ -0,0 +1,29 @@
//
// Created by Simon Wörner on 16.06.17.
//
#include "emergency_stop.h"
#include <cstddef>
extern "C" {
void *emergency_stop_init(uint8_t port);
void emergency_stop_clean(void *emergency_stop);
bool emergency_stop_get_state(void *emergency_stop);
}
emergency_stop::emergency_stop(uint8_t port)
{
rust_emergency_stop = emergency_stop_init(port);
}
emergency_stop::~emergency_stop()
{
emergency_stop_clean(rust_emergency_stop);
rust_emergency_stop = NULL;
}
bool emergency_stop::get_state() const
{
return emergency_stop_get_state(rust_emergency_stop);
}

24
kawaii/emergency_stop.h Normal file
View File

@@ -0,0 +1,24 @@
//
// Created by Simon Wörner on 16.06.17.
//
#ifndef KAWAII_ENGINE_EMERGENCY_STOP_H
#define KAWAII_ENGINE_EMERGENCY_STOP_H
#include <cstdint>
class emergency_stop
{
private:
void *rust_emergency_stop;
public:
emergency_stop(uint8_t port);
emergency_stop(const emergency_stop &) = delete;
emergency_stop(const emergency_stop &&) = delete;
bool get_state() const;
~emergency_stop();
};
#endif //KAWAII_ENGINE_EMERGENCY_STOP_H

79
kawaii/engine.cpp Normal file
View File

@@ -0,0 +1,79 @@
#include "engine.hpp"
#include <chrono>
#include <utility>
using namespace std;
using namespace std::chrono;
engine::engine(gpio&& pin_forward, gpio&& pin_reverse)
: speed(0),
pin_forward(move(pin_forward)),
pin_reverse(move(pin_reverse)),
stop_thread(false),
measurement(string("engine") + to_string(this->pin_forward.get_pin()))
{
this->pin_forward.set_value(false);
this->pin_reverse.set_value(false);
pwm_thread = thread(&engine::pwm_loop, this);
}
engine::~engine()
{
stop_thread = true;
pwm_thread.join();
}
void engine::set_speed(int speed)
{
this->speed.store(speed, memory_order_relaxed);
}
void engine::pwm_loop()
{
this_thread::sleep_for(milliseconds(100));
const int sleep_msec = 1;
int counter = 0;
high_resolution_clock::time_point next_sleep_target = high_resolution_clock::now();
while (!stop_thread)
{
measurement.start();
direction target_direction;
int speed_val = speed.load(memory_order_relaxed);
if (speed_val < 0)
{
target_direction = direction::REVERSE;
speed_val *= -1;
}
else
{
target_direction = direction::FORWARD;
}
counter += sleep_msec;
if (counter >= 100)
counter = 0;
if (counter < speed_val)
{
if (target_direction == direction::FORWARD)
{
pin_reverse.set_value(false);
pin_forward.set_value(true);
}
else
{
pin_forward.set_value(false);
pin_reverse.set_value(true);
}
}
else
{
pin_forward.set_value(false);
pin_reverse.set_value(false);
}
measurement.stop();
next_sleep_target += 500us;
this_thread::sleep_until(next_sleep_target);
}
pin_forward.set_value(false);
pin_reverse.set_value(false);
}

31
kawaii/engine.hpp Normal file
View File

@@ -0,0 +1,31 @@
#ifndef ENGINE_HPP_
#define ENGINE_HPP_
#include <atomic>
#include <thread>
#include "gpio.hpp"
#include "measure.hpp"
class engine
{
public:
enum class direction
{
FORWARD,
REVERSE
};
private:
std::atomic<int> speed;
gpio pin_forward;
gpio pin_reverse;
std::atomic<bool> stop_thread;
std::thread pwm_thread;
measure measurement;
void pwm_loop();
public:
engine(gpio&& pin_forward, gpio&& pin_reverse);
~engine();
void set_speed(int speed);
};
#endif

109
kawaii/gpio.cpp Normal file
View File

@@ -0,0 +1,109 @@
#include "gpio.hpp"
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <string>
using namespace std;
static string construct_filename(const string &prefix, int pin, const string &suffix)
{
stringstream filename;
filename << prefix << pin << suffix;
return filename.str();
}
gpio::gpio(int pin, pin_direction direction, pin_type type, bool default_state)
: pin(pin),
direction(direction),
type(type),
current_state(false)
{
ofstream export_file("/sys/class/gpio/export");
export_file << pin;
export_file.close();
ofstream direction_file(construct_filename("/sys/class/gpio/gpio", pin, "/direction").c_str());
if (direction == pin_direction::INPUT)
{
direction_file << "in";
}
else
{
direction_file << "out";
}
direction_file.close();
if (direction == pin_direction::OUTPUT)
{
set_value(default_state, false);
}
}
gpio::gpio(gpio&& old)
: pin(old.pin),
direction(old.direction),
type(old.type),
current_state(old.current_state)
{
old.pin = -1;
}
gpio::~gpio()
{
if (pin != -1)
{
ofstream unexport_file("/sys/class/gpio/unexport");
unexport_file << pin;
}
}
void gpio::set_value(bool on, bool use_cache)
{
if (pin == -1)
throw logic_error("Usage of moved gpio");
if (direction == pin_direction::INPUT)
{
stringstream errormsg;
errormsg << "Cannot write to input pin " << pin;
throw logic_error(errormsg.str());
}
if (!use_cache || current_state != on)
{
bool value;
if (type == pin_type::HIGH_ON)
value = on;
else
value = !on;
ofstream value_file(construct_filename("/sys/class/gpio/gpio", pin, "/value"));
value_file << value;
}
current_state = on;
}
void gpio::set_value(bool on)
{
set_value(on, true);
}
bool gpio::get_value()
{
if (pin == -1)
throw logic_error("Usage of moved gpio");
if (direction == pin_direction::OUTPUT)
return current_state;
ifstream value_file(construct_filename("/sys/class/gpio/gpio", pin, "/value"));
bool value;
value_file >> value;
bool on;
if (type == pin_type::HIGH_ON)
on = value;
else
on = !value;
return on;
}
int gpio::get_pin() const
{
return pin;
}

34
kawaii/gpio.hpp Normal file
View File

@@ -0,0 +1,34 @@
#ifndef GPIO_HPP_
#define GPIO_HPP_
class gpio
{
public:
enum class pin_direction
{
INPUT,
OUTPUT
};
enum class pin_type
{
HIGH_ON,
LOW_ON
};
private:
int pin;
pin_direction direction;
pin_type type;
bool current_state;
void set_value(bool on, bool use_cache);
public:
gpio(int pin, pin_direction, pin_type=pin_type::HIGH_ON, bool default_state=false);
gpio(const gpio&) = delete;
gpio(gpio&&);
~gpio();
void set_value(bool on);
bool get_value();
int get_pin() const;
};
#endif

4
kawaii/kawaii-rs/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
Cargo.lock
target/
**/*.rs.bk
*.iml

View File

@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.0)
project(kawaii-rs)
include(ExternalProject)
if (MEASURE)
set(CARGO_FEATURES "${CARGO_FEATURES} measure")
endif (MEASURE)
if (CARGO_FEATURES)
set(CARGO_ARGUMENTS --features "${CARGO_FEATURES}")
endif(CARGO_FEATURES)
file(GLOB RUST_SOURCE_FILES "${PROJECT_SOURCE_DIR}/src" *.rs)
add_custom_target(${PROJECT_NAME}
COMMAND cargo build --color=never ${CARGO_ARGUMENTS}
COMMAND cargo build --color=never ${CARGO_ARGUMENTS} --release
DEPENDS ${RUST_SOURCE_FILES}
BYPRODUCTS target/debug/libkawaii.a target/release/libkawaii.a
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
SOURCES ${RUST_SOURCE_FILES})

View File

@@ -0,0 +1,19 @@
[package]
name = "kawaii-rs-api"
version = "0.1.0"
authors = ["Simon Wörner <git@simon-woerner.de>"]
[lib]
name = "kawaii_api"
crate-type = ["staticlib"]
[features]
measure = [
"kawaii/measure",
"emergency_stop/measure",
"ultrasonic_irq/measure" ]
[dependencies]
emergency_stop = { git = "https://git.brn.li/kawaii-robotto/emergency-stop.git" }
kawaii = { git = "https://git.brn.li/kawaii-robotto/kawaii-rs.git" }
ultrasonic_irq = { git = "https://git.brn.li/kawaii-robotto/ultrasonic-irq.git" }

View File

@@ -0,0 +1,8 @@
CMakeFiles/
Makefile
cmake_install.cmake
emergency-stop-prefix/
emergency-stop.cbp
target/
**/*.rs.bk
*.iml

View File

@@ -0,0 +1,14 @@
[package]
name = "emergency_stop"
version = "0.1.0"
authors = ["Simon Wörner <git@simon-woerner.de>"]
[[bin]]
name = "emergency_stop-test"
doc = false
[features]
measure = ["kawaii/measure"]
[dependencies]
kawaii = { git = "https://git.brn.li/kawaii-robotto/kawaii-rs.git" }

View File

@@ -0,0 +1,102 @@
extern crate kawaii;
use std::time::Duration;
use std::thread;
use std::thread::JoinHandle;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use self::kawaii::gpio::{AsyncPort, Edge, Value};
#[cfg(feature = "measure")]
use self::kawaii::Measure;
#[derive(Debug)]
pub struct EmergencyStop {
thread: Option<JoinHandle<()>>,
pub state: Arc<AtomicBool>,
}
impl EmergencyStop {
/// Constructs a new `EmergencyStop` and starts poll thread.
///
/// # Parameter
/// - `stop_port` GPIO Port number of emergency stop pin.
pub fn new(stop_port: u8) -> std::io::Result<Self> {
let name = format!("EmergencyStop(port = {})", stop_port);
let state = Arc::new(AtomicBool::new(false));
let mut port = AsyncPort::new(stop_port, Edge::Both)?;
let state_clone = state.clone();
let thread = thread::Builder::new()
.name(name)
.spawn(move || EmergencyStop::thread(&mut port, state_clone))?;
Ok(EmergencyStop {
thread: Some(thread),
state: state,
})
}
/// Emergency stop poll thread
fn thread(port: &mut AsyncPort, state: Arc<AtomicBool>) {
#[cfg(feature = "measure")]
let mut measure = Measure::new(format!("EmergencyStop(port = {})", port.port.number));
// clear first value
port.poll(Some(Duration::new(0, 0))).is_ok();
while !state.load(Ordering::Relaxed) {
#[cfg(feature = "measure")]
measure.start();
let timeout = Some(Duration::new(1, 0));
#[cfg(not(feature = "measure"))]
let value = port.poll(timeout);
#[cfg(feature = "measure")]
let value = port.poll_measure(timeout, &mut measure);
// continue on timeout
match value {
Ok(value) => {
if let Some(value) = value {
match value {
Value::High => {
#[cfg(debug_assertions)]
println!("EmergencyStop! ({:?})", value);
state.store(true, Ordering::Relaxed);
}
_ => {
#[cfg(debug_assertions)]
println!("EmergencyStop ignored: ({:?})", value);
}
}
}
}
Err(e) => {
#[cfg(debug_assertions)]
println!("EmergencyStop! ({:?})", e);
state.store(true, Ordering::Relaxed);
}
}
#[cfg(feature = "measure")]
measure.stop();
}
}
}
impl Drop for EmergencyStop {
/// Set emergency stop and join poll thread.
fn drop(&mut self) {
self.state.store(true, Ordering::Relaxed);
if let Some(thread) = self.thread.take() {
thread.join().is_ok();
}
}
}

View File

@@ -0,0 +1,21 @@
extern crate emergency_stop;
use emergency_stop::EmergencyStop;
use std::time::Duration;
use std::thread::sleep;
use std::sync::atomic::Ordering;
static GPIO_PORT_STOP: u8 = 25;
fn main() {
let emergency_stop = EmergencyStop::new(GPIO_PORT_STOP).expect("Create Emergency Stop failed");
println!("{:?}", emergency_stop);
while !emergency_stop.state.load(Ordering::Relaxed) {
sleep(Duration::new(1, 0));
}
println!("Stopped.");
}

View File

@@ -0,0 +1,4 @@
Cargo.lock
target/
**/*.rs.bk
*.iml

View File

@@ -0,0 +1,17 @@
[package]
name = "kawaii"
version = "0.1.0"
authors = ["Simon Wörner <git@simon-woerner.de>"]
[[bin]]
name = "kawaii-test"
doc = false
[features]
measure = []
[dependencies]
nix = "0.8.1"
regex = "^0.2"
separator = "^0.3.1"
time = "^0.1.36"

View File

@@ -0,0 +1,320 @@
extern crate std;
extern crate nix;
use std::fmt;
use std::time::Duration;
use std::io::prelude::*;
use std::io::{Error, ErrorKind, SeekFrom};
use std::fs::File;
use std::path::Path;
use std::os::unix::io::RawFd;
#[cfg(feature = "measure")]
use measure::Measure;
fn duration_to_ms(duration: Duration) -> u64 {
duration.as_secs() * 1_000u64 + duration.subsec_nanos() as u64 / 1_000_000u64
}
#[derive(Clone, Copy, Debug)]
pub enum Direction {
Out,
In,
}
impl Direction {
pub fn from_str(s: &str) -> Option<Direction> {
match s {
"out" => Some(Direction::Out),
"in" => Some(Direction::In),
_ => None,
}
}
pub fn as_str(&self) -> &'static str {
match *self {
Direction::Out => "out",
Direction::In => "in",
}
}
}
#[derive(Clone, Copy, Debug)]
pub enum Edge {
None,
Rising,
Falling,
Both,
}
impl Edge {
pub fn from_str(s: &str) -> Option<Edge> {
match s {
"none" => Some(Edge::None),
"rising" => Some(Edge::Rising),
"falling" => Some(Edge::Falling),
"both" => Some(Edge::Both),
_ => None,
}
}
pub fn as_str(&self) -> &'static str {
match *self {
Edge::None => "none",
Edge::Rising => "rising",
Edge::Falling => "falling",
Edge::Both => "both",
}
}
}
#[derive(Clone, Copy, Debug)]
pub enum Value {
High,
Low,
}
impl Value {
pub fn from_str(s: &str) -> Option<Value> {
match s {
"1" => Some(Value::High),
"0" => Some(Value::Low),
_ => None,
}
}
pub fn from_buffer(b: &[u8; 1]) -> Option<Self> {
Value::from_char(b[0])
}
pub fn from_char(c: u8) -> Option<Self> {
match c {
48 => Some(Value::Low), // '0'
49 => Some(Value::High), // '1'
_ => None,
}
}
pub fn as_str(&self) -> &'static str {
match *self {
Value::High => "1",
Value::Low => "0",
}
}
}
#[derive(Debug)]
pub struct Port {
pub number: u8,
pub direction: Direction,
}
#[derive(Debug)]
pub struct SyncPort {
pub port: Port,
file: File,
buffer: [u8; 1],
}
pub struct AsyncPort {
pub port: Port,
pub edge: Edge,
file: RawFd,
fds: [nix::poll::PollFd; 1],
buffer: [u8; 1],
}
impl fmt::Debug for AsyncPort {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,
"AsyncPort {{ port: {:?}, edge: {:?}, file: {:?}, fds: [?], buffer: {:?} }}",
self.port,
self.edge,
self.file,
self.buffer)
}
}
impl Port {
/// Constructs a new GPIO `Port`.
///
/// # Parameter
/// - `number` GPIO Port number of pin.
/// - `direction` GPIO Port direction.
pub fn new(number: u8, direction: Direction) -> std::io::Result<Port> {
let port = Port {
number: number,
direction: direction,
};
port.init()?;
Ok(port)
}
/// Init GPIO `Port`: export port and set direction
fn init(&self) -> std::io::Result<()> {
self.export().ok();
self.set_direction()?;
Ok(())
}
/// Drop GPIO `Port`: unexport
pub fn drop(&mut self) {
self.unexport().ok();
}
fn write_path(path: &str, value: &str) -> std::io::Result<()> {
File::create(Path::new(path))?
.write_all(value.as_bytes())
}
/// Export GPIO `Port`
fn export(&self) -> std::io::Result<()> {
Port::write_path("/sys/class/gpio/export", self.number.to_string().as_str())
}
/// Unexport GPIO `Port`
fn unexport(&self) -> std::io::Result<()> {
Port::write_path("/sys/class/gpio/unexport", self.number.to_string().as_str())
}
/// Set GPIO `Port` direction
fn set_direction(&self) -> std::io::Result<()> {
Port::write_path(format!("/sys/class/gpio/gpio{}/direction", self.number).as_str(),
self.direction.as_str())
}
}
impl SyncPort {
/// Constructs a new synchronised GPIO `Port`.
///
/// # Parameter
/// - `number` GPIO Port number of pin.
/// - `direction` GPIO Port direction.
pub fn new(number: u8, direction: Direction) -> std::io::Result<SyncPort> {
Ok(SyncPort {
port: Port::new(number, direction)?,
file: SyncPort::open(number, direction)?,
buffer: [0; 1],
})
}
/// Open GPIO `SyncPort` sysfs file
fn open(number: u8, direction: Direction) -> std::io::Result<File> {
let path = format!("/sys/class/gpio/gpio{}/value", number);
let path = Path::new(path.as_str());
Ok(match direction {
Direction::Out => File::create(path)?,
Direction::In => File::open(path)?,
})
}
/// Read from GPIO `SyncPort` sysfs file
pub fn read(&mut self) -> std::io::Result<Value> {
self.file.seek(SeekFrom::Start(0))?;
self.file.read_exact(&mut self.buffer)?;
Value::from_buffer(&self.buffer).ok_or(Error::new(ErrorKind::InvalidData,
"Unrecognized GPIO Value"))
}
/// Write to GPIO `SyncPort` sysfs file
pub fn write(&mut self, value: Value) -> std::io::Result<()> {
self.file.write_all(value.as_str().as_bytes())
}
}
impl AsyncPort {
/// Constructs a new asynchronous GPIO `Port`.
///
/// # Parameter
/// - `number` GPIO Port number of pin.
/// - `edge` GPIO Port edge detection setting.
pub fn new(number: u8, edge: Edge) -> std::io::Result<AsyncPort> {
let port = Port::new(number, Direction::In)?;
let file = AsyncPort::open(number)?;
let port = AsyncPort {
port: port,
edge: edge,
file: file,
fds: [nix::poll::PollFd::new(file, nix::poll::POLLPRI, nix::poll::EventFlags::empty())],
buffer: [0; 1],
};
port.init()?;
Ok(port)
}
/// Init GPIO `Port`: set edge detection
fn init(&self) -> std::io::Result<()> {
self.set_edge()?;
Ok(())
}
/// Open GPIO `AsyncPort` sysfs file with posix API
fn open(number: u8) -> std::io::Result<RawFd> {
nix::fcntl::open(format!("/sys/class/gpio/gpio{}/value", number).as_str(),
nix::fcntl::O_RDONLY,
nix::sys::stat::Mode::empty())
.or(Err(Error::new(ErrorKind::Other, "open failed")))
}
fn get_timeout(timeout: Option<Duration>) -> i32 {
match timeout {
None => -1,
Some(t) => duration_to_ms(t) as i32,
}
}
/// Posix poll on sysfs file
fn nix_poll(&mut self, timeout: i32) -> nix::Result<i32> {
nix::poll::poll(&mut self.fds, timeout)
}
/// Read from GPIO `AsyncPort` sysfs file with posix poll
fn poll_read(&mut self, poll: nix::Result<i32>) -> std::io::Result<Option<Value>> {
let poll = poll.or(Err(Error::new(ErrorKind::Other, "poll failed")))?;
if poll == 0 {
return Ok(None);
}
nix::unistd::lseek(self.file, 0, nix::unistd::Whence::SeekSet)
.or(Err(Error::new(ErrorKind::Other, "lseek failed")))?;
nix::unistd::read(self.file, &mut self.buffer)
.or(Err(Error::new(ErrorKind::Other, "read failed")))?;
Value::from_buffer(&self.buffer).map_or(Err(Error::new(ErrorKind::InvalidData,
"Unrecognized GPIO Value")),
|v| Ok(Some(v)))
}
/// Read asynchronous from GPIO `AsyncPort` sysfs file
pub fn poll(&mut self, timeout: Option<Duration>) -> std::io::Result<Option<Value>> {
let poll = self.nix_poll(Self::get_timeout(timeout));
self.poll_read(poll)
}
/// Read asynchronous from GPIO `AsyncPort` sysfs file with measure support (ignore poll time)
#[cfg(feature = "measure")]
pub fn poll_measure(&mut self,
timeout: Option<Duration>,
measure: &mut Measure)
-> std::io::Result<Option<Value>> {
let timeout = Self::get_timeout(timeout);
measure.pause();
let poll = self.nix_poll(timeout);
measure.start();
self.poll_read(poll)
}
/// Set GPIO `Port` edge detection
fn set_edge(&self) -> std::io::Result<()> {
Port::write_path(format!("/sys/class/gpio/gpio{}/edge", self.port.number).as_str(),
self.edge.as_str())
}
}

View File

@@ -0,0 +1,7 @@
pub mod gpio;
#[cfg(feature = "measure")]
mod measure;
#[cfg(feature = "measure")]
pub use measure::Measure;

View File

@@ -0,0 +1,35 @@
extern crate kawaii;
use std::time::Duration;
use kawaii::gpio::{SyncPort, AsyncPort, Direction, Edge, Value};
#[cfg(feature = "measure")]
use kawaii::measure::Measure;
fn main() {
println!("Hello, world!");
#[cfg(feature = "measure")]
{
let mut measure = Measure::new(String::from("main({test: 1})"));
for _ in 0..5 {
measure.start();
std::thread::sleep(Duration::new(0, 1_000_000));
measure.stop();
}
println!("{:?}", measure);
}
let mut trigger = SyncPort::new(27, Direction::Out).expect("Create Trigger GPIO failed");
let mut echo = AsyncPort::new(28, Edge::Both).expect("Create Echo GPIO failed");
println!("trigger = {:?}", trigger.read());
trigger.write(Value::High).expect("write failed");
println!("trigger = {:?}", trigger.read());
trigger.write(Value::Low).expect("write failed");
println!("trigger = {:?}", trigger.read());
println!("echo = {:?}", echo.poll(Some(Duration::new(1, 0))));
}

View File

@@ -0,0 +1,119 @@
extern crate regex;
extern crate separator;
extern crate time;
use std;
use std::fs::File;
use std::io::prelude::*;
use std::io::{Error, ErrorKind};
use self::regex::Regex;
use self::separator::Separatable;
use self::time::precise_time_ns;
#[derive(Debug)]
pub struct Measure {
pub min: u64,
pub max: u64,
time: u64,
last: u64,
data: Vec<u64>,
pub name: String,
}
impl Measure {
/// Constructs a new `Measure`.
///
/// # Parameter
/// - `name` Name of measured component.
pub fn new(name: String) -> Self {
Measure {
min: u64::max_value(),
max: 0u64,
time: 0u64,
last: 0u64,
data: Vec::with_capacity(1_000_000),
name: name,
}
}
/// Start measurement
pub fn start(&mut self) {
self.last = precise_time_ns();
}
/// Pause measurement
pub fn pause(&mut self) {
if self.last == 0 {
#[cfg(debug_assertions)]
println!("WARNING: {:?} pause called without start!", self);
return;
}
self.time += self.time_diff();
}
/// Stop measurement and calculate time difference
pub fn stop(&mut self) {
if self.last == 0 {
#[cfg(debug_assertions)]
println!("WARNING: {:?} stop called without start!", self);
return;
}
self.time += self.time_diff();
self.data.push(self.time);
if self.time < self.min {
self.min = self.time;
}
if self.time > self.max {
self.max = self.time;
}
self.time = 0u64;
self.last = 0u64;
}
fn time_diff(&mut self) -> u64 {
let current_time = precise_time_ns();
let time_diff = current_time - self.last;
self.last = current_time;
time_diff
}
fn write_data(&self) -> std::io::Result<()> {
let re = Regex::new(r"[^\w\-.]")
.or(Err(Error::new(ErrorKind::Other, "Create filename regex failed.")))?;
let file_name = format!("measure_{}.txt", self.name);
let file_name = re.replace_all(file_name.as_str(), "_").to_string();
println!("{}: Write data to {}", self.name, file_name);
let mut file = File::create(file_name)?;
for value in &self.data {
file.write_fmt(format_args!("{}\n", value))?;
}
Ok(())
}
}
impl Drop for Measure {
/// Print measure results and write times to file
fn drop(&mut self) {
println!("{}:\n\tmin: {} ns\n\tmax: {} ns",
self.name,
self.min.separated_string(),
self.max.separated_string());
if let Err(e) = self.write_data() {
println!("{}: Write measure data failed: {}", self.name, e);
}
}
}

View File

@@ -0,0 +1,7 @@
CMakeFiles/
Makefile
cmake_install.cmake
ultrasonic-irq-prefix/
ultrasonic-irq.cbp
target/
**/*.rs.bk

View File

@@ -0,0 +1,16 @@
[package]
name = "ultrasonic_irq"
version = "0.1.0"
authors = ["kawaii <root@kawaii.home.lost-in-space.net>"]
[[bin]]
name = 'ultrasonic_irq-test'
doc = false
[features]
measure = ["kawaii/measure"]
[dependencies]
time = "^0.1.36"
shuteye = "^0.3.2"
kawaii = { git = "https://git.brn.li/kawaii-robotto/kawaii-rs.git" }

View File

@@ -0,0 +1,215 @@
#![feature(integer_atomics)]
extern crate time;
extern crate shuteye;
extern crate kawaii;
use std::time::Duration;
use std::thread;
use std::thread::JoinHandle;
use std::sync::mpsc::{Sender, Receiver};
use std::sync::mpsc;
use std::sync::Arc;
use std::sync::atomic::{AtomicU32, Ordering};
use self::kawaii::gpio::{SyncPort, AsyncPort, Direction, Edge, Value};
#[cfg(feature = "measure")]
use self::kawaii::Measure;
use self::time::precise_time_ns;
use self::shuteye::sleep;
#[derive(Debug)]
struct ThreadData<T> {
thread: JoinHandle<T>,
tx: Sender<()>,
}
#[derive(Debug)]
pub struct UltrasonicEcho {
echo: AsyncPort,
temperature: u8,
timestamp: u64,
distance: Arc<AtomicU32>,
}
#[derive(Debug)]
pub struct UltrasonicTrigger {
trigger: SyncPort,
}
#[derive(Debug)]
pub struct Ultrasonic {
trigger: Option<ThreadData<()>>,
echo: Option<ThreadData<()>>,
pub distance: Arc<AtomicU32>,
}
impl Ultrasonic {
/// Constructs a new `Ultrasonic` and start threads.
///
/// # Threads
/// - `UltrasonicTrigger`
/// - `UltrasonicEcho`
///
/// # Parameter
/// - `trigger_port` GPIO Port number of trigger pin.
/// - `echo_port` GPIO Port number of echo pin.
/// - `temperature` Room temperature in °C.
pub fn new(trigger_port: u8, echo_port: u8, temperature: u8) -> std::io::Result<Ultrasonic> {
let distance = Arc::new(AtomicU32::new(u32::max_value()));
/// Create `UltrasonicEcho` thread with sync channel.
let echo = UltrasonicEcho {
echo: AsyncPort::new(echo_port, Edge::Both)?,
temperature: temperature,
timestamp: 0,
distance: distance.clone(),
};
let (tx, rx): (Sender<()>, Receiver<()>) = mpsc::channel();
let name = format!("Ultrasonic::echo(port = {})", echo_port);
let echo = ThreadData::<()> {
thread: thread::Builder::new()
.name(name)
.spawn(move || echo.thread(rx))?,
tx: tx,
};
/// Create `UltrasonicTrigger` thread with sync channel.
let trigger = UltrasonicTrigger { trigger: SyncPort::new(trigger_port, Direction::Out)? };
let (tx, rx): (Sender<()>, Receiver<()>) = mpsc::channel();
let name = format!("Ultrasonic::trigger(port = {})", trigger_port);
let trigger = ThreadData::<()> {
thread: thread::Builder::new()
.name(name)
.spawn(move || trigger.thread(rx))?,
tx: tx,
};
Ok(Ultrasonic {
trigger: Some(trigger),
echo: Some(echo),
distance: distance,
})
}
}
impl Drop for Ultrasonic {
/// Drop sync channels and join threads.
fn drop(&mut self) {
if let Some(echo) = self.echo.take() {
echo.tx.send(()).is_ok();
echo.thread.join().is_ok();
}
if let Some(trigger) = self.trigger.take() {
trigger.tx.send(()).is_ok();
trigger.thread.join().is_ok();
}
}
}
impl UltrasonicTrigger {
/// `UltrasonicTrigger` thread function.
fn thread(mut self, stop_rx: Receiver<()>) {
#[cfg(feature = "measure")]
let mut measure = Measure::new(format!("Ultrasonic::trigger(port = {})",
self.trigger.port.number));
while stop_rx.try_recv().is_err() {
#[cfg(feature = "measure")]
measure.start();
self.trigger.write(Value::Low).is_ok();
#[cfg(feature = "measure")]
measure.pause();
// sleep 10us (min length to trigger)
sleep(Duration::new(0, 10_000));
#[cfg(feature = "measure")]
measure.start();
self.trigger.write(Value::High).is_ok();
#[cfg(feature = "measure")]
measure.stop();
// sleep 20ms (max trigger frequency)
sleep(Duration::new(0, 20_000_000));
}
}
}
impl UltrasonicEcho {
/// `UltrasonicEcho` thread function.
fn thread(mut self, stop_rx: Receiver<()>) {
#[cfg(feature = "measure")]
let mut measure = Measure::new(format!("Ultrasonic::echo(port = {})",
self.echo.port.number));
while stop_rx.try_recv().is_err() {
#[cfg(feature = "measure")]
measure.start();
#[cfg(not(feature = "measure"))]
let value = self.echo.poll(Some(Duration::new(1, 0)));
#[cfg(feature = "measure")]
let value = self.echo
.poll_measure(Some(Duration::new(1, 0)), &mut measure);
match value {
Ok(value) => {
if let Some(value) = value {
self.on_value_changed(value);
}
}
Err(_e) => {
#[cfg(debug_assertions)]
println!("POLL failed: e = {:?}", _e);
}
}
#[cfg(feature = "measure")]
measure.stop();
}
}
/// Start time measure or calculates distance based on port value
fn on_value_changed(&mut self, value: Value) {
match value {
Value::High => {
// Switched from Value::High to Value::High
// possibly because of trigger after timeout and slow reading
if self.timestamp > 0 {
#[cfg(debug_assertions)]
println!("{:?}", self);
self.calc_distance();
}
self.timestamp = precise_time_ns();
}
Value::Low => {
// Switched from Value::Low to Value::Low
if self.timestamp == 0 {
#[cfg(debug_assertions)]
println!("{:?}", self);
}
self.calc_distance();
}
}
}
/// Calculates distance based on time measurement and `temperature` and stores it in `distance`
fn calc_distance(&mut self) {
let time_diff = precise_time_ns() - self.timestamp;
let distance = (3315 + self.temperature as u64 * 6) * time_diff / 20_000_000;
self.distance.store(distance as u32, Ordering::Relaxed);
#[cfg(debug_assertions)]
println!("time diff: {}\tdistance: {}mm", time_diff, distance);
self.timestamp = 0u64;
}
}

View File

@@ -0,0 +1,21 @@
extern crate shuteye;
extern crate ultrasonic_irq;
use std::time::Duration;
use std::thread::sleep;
use ultrasonic_irq::Ultrasonic;
static GPIO_PORT_TRIG: u8 = 23;
static GPIO_PORT_ECHO: u8 = 24;
static TEMPERATURE: u8 = 20;
fn main() {
let ultrasonic = Ultrasonic::new(GPIO_PORT_TRIG, GPIO_PORT_ECHO, TEMPERATURE)
.expect("Create Ultrasonic failed");
println!("{:?}", ultrasonic);
sleep(Duration::new(10, 0));
}

0
kawaii/kawaii-rs/doc/.lock Executable file
View File

View File

@@ -0,0 +1,59 @@
These documentation pages include resources by third parties. This copyright
file applies only to those resources. The following third party resources are
included, and carry their own copyright notices and license terms:
* Fira Sans (FiraSans-Regular.woff, FiraSans-Medium.woff):
Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Sans.
Copyright (c) 2014, Telefonica S.A.
Licensed under the SIL Open Font License, Version 1.1.
See FiraSans-LICENSE.txt.
* Heuristica (Heuristica-Italic.woff):
Copyright 1989, 1991 Adobe Systems Incorporated. All rights reserved.
Utopia is either a registered trademark or trademark of Adobe Systems
Incorporated in the United States and/or other countries. Used under
license.
Copyright 2006 Han The Thanh, Vntopia font family, http://vntex.sf.net
Copyright (c) 2008-2012, Andrey V. Panov (panov@canopus.iacp.dvo.ru),
with Reserved Font Name Heuristica.
Licensed under the SIL Open Font License, Version 1.1.
See Heuristica-LICENSE.txt.
* rustdoc.css, main.js, and playpen.js:
Copyright 2015 The Rust Developers.
Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or
the MIT license (LICENSE-MIT.txt) at your option.
* normalize.css:
Copyright (c) Nicolas Gallagher and Jonathan Neal.
Licensed under the MIT license (see LICENSE-MIT.txt).
* Source Code Pro (SourceCodePro-Regular.woff, SourceCodePro-Semibold.woff):
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark
of Adobe Systems Incorporated in the United States and/or other countries.
Licensed under the SIL Open Font License, Version 1.1.
See SourceCodePro-LICENSE.txt.
* Source Serif Pro (SourceSerifPro-Regular.woff, SourceSerifPro-Bold.woff):
Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/), with
Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of
Adobe Systems Incorporated in the United States and/or other countries.
Licensed under the SIL Open Font License, Version 1.1.
See SourceSerifPro-LICENSE.txt.
This copyright file is intended to be distributed with rustdoc output.

View File

@@ -0,0 +1,99 @@
Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Sans.
Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Mono.
Copyright (c) 2014, Telefonica S.A.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,101 @@
Copyright 1989, 1991 Adobe Systems Incorporated. All rights reserved.
Utopia is either a registered trademark or trademark of Adobe Systems
Incorporated in the United States and/or other countries. Used under
license.
Copyright 2006 Han The Thanh, Vntopia font family, http://vntex.sf.net
Copyright (c) 2008-2012, Andrey V. Panov (panov@canopus.iacp.dvo.ru),
with Reserved Font Name Heuristica.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,93 @@
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,93 @@
Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=struct.EmergencyStop.html">
</head>
<body>
<p>Redirecting to <a href="struct.EmergencyStop.html">struct.EmergencyStop.html</a>...</p>
<script>location.replace("struct.EmergencyStop.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `emergency_stop` crate.">
<meta name="keywords" content="rust, rustlang, rust-lang, emergency_stop">
<title>emergency_stop - Rust</title>
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc mod">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Crate emergency_stop</p><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'emergency_stop', ty: 'mod', relpath: '../'};</script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Crate <a class="mod" href=''>emergency_stop</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../src/emergency_stop/lib.rs.html#1-102' title='goto source code'>[src]</a></span></h1>
<h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
<tr class=' module-item'>
<td><a class="struct" href="struct.EmergencyStop.html"
title='struct emergency_stop::EmergencyStop'>EmergencyStop</a></td>
<td class='docblock-short'>
</td>
</tr></table></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "emergency_stop";
</script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1 @@
initSidebarItems({"struct":[["EmergencyStop",""]]});

View File

@@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `EmergencyStop` struct in crate `emergency_stop`.">
<meta name="keywords" content="rust, rustlang, rust-lang, EmergencyStop">
<title>emergency_stop::EmergencyStop - Rust</title>
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Struct EmergencyStop</p><div class="block items"><ul><li><a href="#fields">Fields</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='index.html'>emergency_stop</a></p><script>window.sidebarCurrent = {name: 'EmergencyStop', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>emergency_stop</a>::<wbr><a class="struct" href=''>EmergencyStop</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../src/emergency_stop/lib.rs.html#15-18' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct EmergencyStop {
pub state: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/arc/struct.Arc.html" title="struct alloc::arc::Arc">Arc</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/sync/atomic/struct.AtomicBool.html" title="struct core::sync::atomic::AtomicBool">AtomicBool</a>&gt;,
// some fields omitted
}</pre><h2 id='fields' class='fields'>Fields</h2><span id='structfield.state' class="structfield">
<span id='state.v' class='invisible'>
<code>state: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/arc/struct.Arc.html" title="struct alloc::arc::Arc">Arc</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/sync/atomic/struct.AtomicBool.html" title="struct core::sync::atomic::AtomicBool">AtomicBool</a>&gt;</code>
</span></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../emergency_stop/struct.EmergencyStop.html" title="struct emergency_stop::EmergencyStop">EmergencyStop</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/emergency_stop/lib.rs.html#20-91' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>(stop_port: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;Self&gt;</code></span></h4>
<div class='docblock'><p>Constructs a new <code>EmergencyStop</code> and starts poll thread.</p>
<h1 id='parameter' class='section-header'><a href='#parameter'>Parameter</a></h1>
<ul>
<li><code>stop_port</code> GPIO Port number of emergency stop pin.</li>
</ul>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../emergency_stop/struct.EmergencyStop.html" title="struct emergency_stop::EmergencyStop">EmergencyStop</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/emergency_stop/lib.rs.html#14' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../emergency_stop/struct.EmergencyStop.html" title="struct emergency_stop::EmergencyStop">EmergencyStop</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/emergency_stop/lib.rs.html#93-102' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.drop' class="method"><span id='drop.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop' class='fnname'>drop</a>(&amp;mut self)</code></span></h4>
<div class='docblock'><p>Set emergency stop and join poll thread.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "emergency_stop";
</script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
(function() {var implementors = {};
implementors["kawaii"] = ["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Direction.html\" title=\"enum kawaii::gpio::Direction\">Direction</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Edge.html\" title=\"enum kawaii::gpio::Edge\">Edge</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Value.html\" title=\"enum kawaii::gpio::Value\">Value</a>",];
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()

View File

@@ -0,0 +1,12 @@
(function() {var implementors = {};
implementors["emergency_stop"] = ["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"struct\" href=\"emergency_stop/struct.EmergencyStop.html\" title=\"struct emergency_stop::EmergencyStop\">EmergencyStop</a>",];
implementors["kawaii"] = ["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Direction.html\" title=\"enum kawaii::gpio::Direction\">Direction</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Edge.html\" title=\"enum kawaii::gpio::Edge\">Edge</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Value.html\" title=\"enum kawaii::gpio::Value\">Value</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"struct\" href=\"kawaii/gpio/struct.Port.html\" title=\"struct kawaii::gpio::Port\">Port</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"struct\" href=\"kawaii/gpio/struct.SyncPort.html\" title=\"struct kawaii::gpio::SyncPort\">SyncPort</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"struct\" href=\"kawaii/gpio/struct.AsyncPort.html\" title=\"struct kawaii::gpio::AsyncPort\">AsyncPort</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"struct\" href=\"kawaii/struct.Measure.html\" title=\"struct kawaii::Measure\">Measure</a>",];
implementors["ultrasonic_irq"] = ["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"struct\" href=\"ultrasonic_irq/struct.UltrasonicEcho.html\" title=\"struct ultrasonic_irq::UltrasonicEcho\">UltrasonicEcho</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"struct\" href=\"ultrasonic_irq/struct.UltrasonicTrigger.html\" title=\"struct ultrasonic_irq::UltrasonicTrigger\">UltrasonicTrigger</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html\" title=\"trait core::fmt::Debug\">Debug</a> for <a class=\"struct\" href=\"ultrasonic_irq/struct.Ultrasonic.html\" title=\"struct ultrasonic_irq::Ultrasonic\">Ultrasonic</a>",];
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()

View File

@@ -0,0 +1,10 @@
(function() {var implementors = {};
implementors["kawaii"] = ["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Direction.html\" title=\"enum kawaii::gpio::Direction\">Direction</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Edge.html\" title=\"enum kawaii::gpio::Edge\">Edge</a>","impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html\" title=\"trait core::marker::Copy\">Copy</a> for <a class=\"enum\" href=\"kawaii/gpio/enum.Value.html\" title=\"enum kawaii::gpio::Value\">Value</a>",];
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()

View File

@@ -0,0 +1,12 @@
(function() {var implementors = {};
implementors["emergency_stop"] = ["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html\" title=\"trait core::ops::drop::Drop\">Drop</a> for <a class=\"struct\" href=\"emergency_stop/struct.EmergencyStop.html\" title=\"struct emergency_stop::EmergencyStop\">EmergencyStop</a>",];
implementors["kawaii"] = ["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html\" title=\"trait core::ops::drop::Drop\">Drop</a> for <a class=\"struct\" href=\"kawaii/struct.Measure.html\" title=\"struct kawaii::Measure\">Measure</a>",];
implementors["ultrasonic_irq"] = ["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html\" title=\"trait core::ops::drop::Drop\">Drop</a> for <a class=\"struct\" href=\"ultrasonic_irq/struct.Ultrasonic.html\" title=\"struct ultrasonic_irq::Ultrasonic\">Ultrasonic</a>",];
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=struct.Measure.html">
</head>
<body>
<p>Redirecting to <a href="struct.Measure.html">struct.Measure.html</a>...</p>
<script>location.replace("struct.Measure.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=struct.AsyncPort.html">
</head>
<body>
<p>Redirecting to <a href="struct.AsyncPort.html">struct.AsyncPort.html</a>...</p>
<script>location.replace("struct.AsyncPort.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=enum.Direction.html">
</head>
<body>
<p>Redirecting to <a href="enum.Direction.html">enum.Direction.html</a>...</p>
<script>location.replace("enum.Direction.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=enum.Edge.html">
</head>
<body>
<p>Redirecting to <a href="enum.Edge.html">enum.Edge.html</a>...</p>
<script>location.replace("enum.Edge.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=struct.Port.html">
</head>
<body>
<p>Redirecting to <a href="struct.Port.html">struct.Port.html</a>...</p>
<script>location.replace("struct.Port.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=struct.SyncPort.html">
</head>
<body>
<p>Redirecting to <a href="struct.SyncPort.html">struct.SyncPort.html</a>...</p>
<script>location.replace("struct.SyncPort.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=enum.Value.html">
</head>
<body>
<p>Redirecting to <a href="enum.Value.html">enum.Value.html</a>...</p>
<script>location.replace("enum.Value.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,128 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Direction` enum in crate `kawaii`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Direction">
<title>kawaii::gpio::Direction - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc enum">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Enum Direction</p><div class="block items"><ul><li><a href="#variants">Variants</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a></p><script>window.sidebarCurrent = {name: 'Direction', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Enum <a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a>::<wbr><a class="enum" href=''>Direction</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/kawaii/gpio.rs.html#21-24' title='goto source code'>[src]</a></span></h1>
<pre class='rust enum'>pub enum Direction {
Out,
In,
}</pre><h2 id='variants' class='variants'>Variants</h2>
<span id='variant.Out' class='variant'><span id='Out.v' class='invisible'><code>Out</code></span></span><span id='variant.In' class='variant'><span id='In.v' class='invisible'><code>In</code></span></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#25-40' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from_str' class="method"><span id='from_str.v' class='invisible'><code>fn <a href='#method.from_str' class='fnname'>from_str</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a>&gt;</code></span></h4>
<h4 id='method.as_str' class="method"><span id='as_str.v' class='invisible'><code>fn <a href='#method.as_str' class='fnname'>as_str</a>(&amp;self) -&gt; &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code></span></h4>
</div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#20' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a></code></span></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: &amp;Self)</code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#20' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#20' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "kawaii";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Edge` enum in crate `kawaii`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Edge">
<title>kawaii::gpio::Edge - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc enum">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Enum Edge</p><div class="block items"><ul><li><a href="#variants">Variants</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a></p><script>window.sidebarCurrent = {name: 'Edge', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Enum <a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a>::<wbr><a class="enum" href=''>Edge</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/kawaii/gpio.rs.html#43-48' title='goto source code'>[src]</a></span></h1>
<pre class='rust enum'>pub enum Edge {
None,
Rising,
Falling,
Both,
}</pre><h2 id='variants' class='variants'>Variants</h2>
<span id='variant.None' class='variant'><span id='None.v' class='invisible'><code>None</code></span></span><span id='variant.Rising' class='variant'><span id='Rising.v' class='invisible'><code>Rising</code></span></span><span id='variant.Falling' class='variant'><span id='Falling.v' class='invisible'><code>Falling</code></span></span><span id='variant.Both' class='variant'><span id='Both.v' class='invisible'><code>Both</code></span></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#49-68' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from_str' class="method"><span id='from_str.v' class='invisible'><code>fn <a href='#method.from_str' class='fnname'>from_str</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a>&gt;</code></span></h4>
<h4 id='method.as_str' class="method"><span id='as_str.v' class='invisible'><code>fn <a href='#method.as_str' class='fnname'>as_str</a>(&amp;self) -&gt; &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code></span></h4>
</div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#42' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a></code></span></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: &amp;Self)</code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#42' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#42' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "kawaii";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Value` enum in crate `kawaii`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Value">
<title>kawaii::gpio::Value - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc enum">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Enum Value</p><div class="block items"><ul><li><a href="#variants">Variants</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a></p><script>window.sidebarCurrent = {name: 'Value', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Enum <a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a>::<wbr><a class="enum" href=''>Value</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/kawaii/gpio.rs.html#71-74' title='goto source code'>[src]</a></span></h1>
<pre class='rust enum'>pub enum Value {
High,
Low,
}</pre><h2 id='variants' class='variants'>Variants</h2>
<span id='variant.High' class='variant'><span id='High.v' class='invisible'><code>High</code></span></span><span id='variant.Low' class='variant'><span id='Low.v' class='invisible'><code>Low</code></span></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#75-102' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from_str' class="method"><span id='from_str.v' class='invisible'><code>fn <a href='#method.from_str' class='fnname'>from_str</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a>&gt;</code></span></h4>
<h4 id='method.from_buffer' class="method"><span id='from_buffer.v' class='invisible'><code>fn <a href='#method.from_buffer' class='fnname'>from_buffer</a>(b: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">; 1]</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self&gt;</code></span></h4>
<h4 id='method.from_char' class="method"><span id='from_char.v' class='invisible'><code>fn <a href='#method.from_char' class='fnname'>from_char</a>(c: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self&gt;</code></span></h4>
<h4 id='method.as_str' class="method"><span id='as_str.v' class='invisible'><code>fn <a href='#method.as_str' class='fnname'>as_str</a>(&amp;self) -&gt; &amp;'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code></span></h4>
</div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#70' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a></code></span></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: &amp;Self)</code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></span></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#70' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#70' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "kawaii";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,156 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `gpio` mod in crate `kawaii`.">
<meta name="keywords" content="rust, rustlang, rust-lang, gpio">
<title>kawaii::gpio - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc mod">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Module gpio</p><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><p class='location'><a href='../index.html'>kawaii</a></p><script>window.sidebarCurrent = {name: 'gpio', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Module <a href='../index.html'>kawaii</a>::<wbr><a class="mod" href=''>gpio</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/kawaii/gpio.rs.html#1-320' title='goto source code'>[src]</a></span></h1>
<h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
<tr class=' module-item'>
<td><a class="struct" href="struct.AsyncPort.html"
title='struct kawaii::gpio::AsyncPort'>AsyncPort</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.Port.html"
title='struct kawaii::gpio::Port'>Port</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.SyncPort.html"
title='struct kawaii::gpio::SyncPort'>SyncPort</a></td>
<td class='docblock-short'>
</td>
</tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
<table>
<tr class=' module-item'>
<td><a class="enum" href="enum.Direction.html"
title='enum kawaii::gpio::Direction'>Direction</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.Edge.html"
title='enum kawaii::gpio::Edge'>Edge</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.Value.html"
title='enum kawaii::gpio::Value'>Value</a></td>
<td class='docblock-short'>
</td>
</tr></table></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "kawaii";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1 @@
initSidebarItems({"enum":[["Direction",""],["Edge",""],["Value",""]],"struct":[["AsyncPort",""],["Port",""],["SyncPort",""]]});

View File

@@ -0,0 +1,138 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `AsyncPort` struct in crate `kawaii`.">
<meta name="keywords" content="rust, rustlang, rust-lang, AsyncPort">
<title>kawaii::gpio::AsyncPort - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Struct AsyncPort</p><div class="block items"><ul><li><a href="#fields">Fields</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a></p><script>window.sidebarCurrent = {name: 'AsyncPort', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a>::<wbr><a class="struct" href=''>AsyncPort</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/kawaii/gpio.rs.html#116-122' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct AsyncPort {
pub port: <a class="struct" href="../../kawaii/gpio/struct.Port.html" title="struct kawaii::gpio::Port">Port</a>,
pub edge: <a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a>,
// some fields omitted
}</pre><h2 id='fields' class='fields'>Fields</h2><span id='structfield.port' class="structfield">
<span id='port.v' class='invisible'>
<code>port: <a class="struct" href="../../kawaii/gpio/struct.Port.html" title="struct kawaii::gpio::Port">Port</a></code>
</span></span><span id='structfield.edge' class="structfield">
<span id='edge.v' class='invisible'>
<code>edge: <a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a></code>
</span></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../../kawaii/gpio/struct.AsyncPort.html" title="struct kawaii::gpio::AsyncPort">AsyncPort</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#226-320' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>(number: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, edge: <a class="enum" href="../../kawaii/gpio/enum.Edge.html" title="enum kawaii::gpio::Edge">Edge</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../../kawaii/gpio/struct.AsyncPort.html" title="struct kawaii::gpio::AsyncPort">AsyncPort</a>&gt;</code></span></h4>
<div class='docblock'><p>Constructs a new asynchronous GPIO <code>Port</code>.</p>
<h1 id='parameter' class='section-header'><a href='#parameter'>Parameter</a></h1>
<ul>
<li><code>number</code> GPIO Port number of pin.</li>
<li><code>edge</code> GPIO Port edge detection setting.</li>
</ul>
</div><h4 id='method.poll' class="method"><span id='poll.v' class='invisible'><code>fn <a href='#method.poll' class='fnname'>poll</a>(&amp;mut self, timeout: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html" title="struct std::time::duration::Duration">Duration</a>&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a>&gt;&gt;</code></span></h4>
<div class='docblock'><p>Read asynchronous from GPIO <code>AsyncPort</code> sysfs file</p>
</div><h4 id='method.poll_measure' class="method"><span id='poll_measure.v' class='invisible'><code>fn <a href='#method.poll_measure' class='fnname'>poll_measure</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;timeout: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html" title="struct std::time::duration::Duration">Duration</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;measure: &amp;mut <a class="struct" href="../../kawaii/struct.Measure.html" title="struct kawaii::Measure">Measure</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a>&gt;&gt;</code></span></h4>
<div class='docblock'><p>Read asynchronous from GPIO <code>AsyncPort</code> sysfs file with measure support (ignore poll time)</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../kawaii/gpio/struct.AsyncPort.html" title="struct kawaii::gpio::AsyncPort">AsyncPort</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#124-133' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "kawaii";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,135 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Port` struct in crate `kawaii`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Port">
<title>kawaii::gpio::Port - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Struct Port</p><div class="block items"><ul><li><a href="#fields">Fields</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a></p><script>window.sidebarCurrent = {name: 'Port', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a>::<wbr><a class="struct" href=''>Port</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/kawaii/gpio.rs.html#105-108' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Port {
pub number: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>,
pub direction: <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a>,
}</pre><h2 id='fields' class='fields'>Fields</h2><span id='structfield.number' class="structfield">
<span id='number.v' class='invisible'>
<code>number: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code>
</span></span><span id='structfield.direction' class="structfield">
<span id='direction.v' class='invisible'>
<code>direction: <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a></code>
</span></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../../kawaii/gpio/struct.Port.html" title="struct kawaii::gpio::Port">Port</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#135-184' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>(number: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, direction: <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../../kawaii/gpio/struct.Port.html" title="struct kawaii::gpio::Port">Port</a>&gt;</code></span></h4>
<div class='docblock'><p>Constructs a new GPIO <code>Port</code>.</p>
<h1 id='parameter' class='section-header'><a href='#parameter'>Parameter</a></h1>
<ul>
<li><code>number</code> GPIO Port number of pin.</li>
<li><code>direction</code> GPIO Port direction.</li>
</ul>
</div><h4 id='method.drop' class="method"><span id='drop.v' class='invisible'><code>fn <a href='#method.drop' class='fnname'>drop</a>(&amp;mut self)</code></span></h4>
<div class='docblock'><p>Drop GPIO <code>Port</code>: unexport</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../kawaii/gpio/struct.Port.html" title="struct kawaii::gpio::Port">Port</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#104' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "kawaii";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `SyncPort` struct in crate `kawaii`.">
<meta name="keywords" content="rust, rustlang, rust-lang, SyncPort">
<title>kawaii::gpio::SyncPort - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Struct SyncPort</p><div class="block items"><ul><li><a href="#fields">Fields</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a></p><script>window.sidebarCurrent = {name: 'SyncPort', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>kawaii</a>::<wbr><a href='index.html'>gpio</a>::<wbr><a class="struct" href=''>SyncPort</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/kawaii/gpio.rs.html#111-115' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct SyncPort {
pub port: <a class="struct" href="../../kawaii/gpio/struct.Port.html" title="struct kawaii::gpio::Port">Port</a>,
// some fields omitted
}</pre><h2 id='fields' class='fields'>Fields</h2><span id='structfield.port' class="structfield">
<span id='port.v' class='invisible'>
<code>port: <a class="struct" href="../../kawaii/gpio/struct.Port.html" title="struct kawaii::gpio::Port">Port</a></code>
</span></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../../kawaii/gpio/struct.SyncPort.html" title="struct kawaii::gpio::SyncPort">SyncPort</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#186-224' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>(number: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, direction: <a class="enum" href="../../kawaii/gpio/enum.Direction.html" title="enum kawaii::gpio::Direction">Direction</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../../kawaii/gpio/struct.SyncPort.html" title="struct kawaii::gpio::SyncPort">SyncPort</a>&gt;</code></span></h4>
<div class='docblock'><p>Constructs a new synchronised GPIO <code>Port</code>.</p>
<h1 id='parameter' class='section-header'><a href='#parameter'>Parameter</a></h1>
<ul>
<li><code>number</code> GPIO Port number of pin.</li>
<li><code>direction</code> GPIO Port direction.</li>
</ul>
</div><h4 id='method.read' class="method"><span id='read.v' class='invisible'><code>fn <a href='#method.read' class='fnname'>read</a>(&amp;mut self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a>&gt;</code></span></h4>
<div class='docblock'><p>Read from GPIO <code>SyncPort</code> sysfs file</p>
</div><h4 id='method.write' class="method"><span id='write.v' class='invisible'><code>fn <a href='#method.write' class='fnname'>write</a>(&amp;mut self, value: <a class="enum" href="../../kawaii/gpio/enum.Value.html" title="enum kawaii::gpio::Value">Value</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">()</a>&gt;</code></span></h4>
<div class='docblock'><p>Write to GPIO <code>SyncPort</code> sysfs file</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../kawaii/gpio/struct.SyncPort.html" title="struct kawaii::gpio::SyncPort">SyncPort</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/kawaii/gpio.rs.html#110' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "kawaii";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,128 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `kawaii` crate.">
<meta name="keywords" content="rust, rustlang, rust-lang, kawaii">
<title>kawaii - Rust</title>
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc mod">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Crate kawaii</p><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'kawaii', ty: 'mod', relpath: '../'};</script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Crate <a class="mod" href=''>kawaii</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../src/kawaii/lib.rs.html#1-7' title='goto source code'>[src]</a></span></h1>
<h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table>
<tr class=' module-item'>
<td><a class="mod" href="gpio/index.html"
title='mod kawaii::gpio'>gpio</a></td>
<td class='docblock-short'>
</td>
</tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
<tr class=' module-item'>
<td><a class="struct" href="struct.Measure.html"
title='struct kawaii::Measure'>Measure</a></td>
<td class='docblock-short'>
</td>
</tr></table></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "kawaii";
</script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=struct.Measure.html">
</head>
<body>
<p>Redirecting to <a href="struct.Measure.html">struct.Measure.html</a>...</p>
<script>location.replace("struct.Measure.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../kawaii/struct.Measure.html">
</head>
<body>
<p>Redirecting to <a href="../../kawaii/struct.Measure.html">../../kawaii/struct.Measure.html</a>...</p>
<script>location.replace("../../kawaii/struct.Measure.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1 @@
initSidebarItems({"mod":[["gpio",""]],"struct":[["Measure",""]]});

View File

@@ -0,0 +1,146 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Measure` struct in crate `kawaii`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Measure">
<title>kawaii::Measure - Rust</title>
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'>Struct Measure</p><div class="block items"><ul><li><a href="#fields">Fields</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='index.html'>kawaii</a></p><script>window.sidebarCurrent = {name: 'Measure', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>kawaii</a>::<wbr><a class="struct" href=''>Measure</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../src/kawaii/measure.rs.html#15-22' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Measure {
pub min: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
pub max: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
pub name: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
// some fields omitted
}</pre><h2 id='fields' class='fields'>Fields</h2><span id='structfield.min' class="structfield">
<span id='min.v' class='invisible'>
<code>min: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code>
</span></span><span id='structfield.max' class="structfield">
<span id='max.v' class='invisible'>
<code>max: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code>
</span></span><span id='structfield.name' class="structfield">
<span id='name.v' class='invisible'>
<code>name: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code>
</span></span><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../kawaii/struct.Measure.html" title="struct kawaii::Measure">Measure</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/kawaii/measure.rs.html#24-105' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>(name: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -&gt; Self</code></span></h4>
<div class='docblock'><p>Constructs a new <code>Measure</code>.</p>
<h1 id='parameter' class='section-header'><a href='#parameter'>Parameter</a></h1>
<ul>
<li><code>name</code> Name of measured component.</li>
</ul>
</div><h4 id='method.start' class="method"><span id='start.v' class='invisible'><code>fn <a href='#method.start' class='fnname'>start</a>(&amp;mut self)</code></span></h4>
<div class='docblock'><p>Start measurement</p>
</div><h4 id='method.pause' class="method"><span id='pause.v' class='invisible'><code>fn <a href='#method.pause' class='fnname'>pause</a>(&amp;mut self)</code></span></h4>
<div class='docblock'><p>Pause measurement</p>
</div><h4 id='method.stop' class="method"><span id='stop.v' class='invisible'><code>fn <a href='#method.stop' class='fnname'>stop</a>(&amp;mut self)</code></span></h4>
<div class='docblock'><p>Stop measurement and calculate time difference</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../kawaii/struct.Measure.html" title="struct kawaii::Measure">Measure</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/kawaii/measure.rs.html#14' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span></h4>
<div class='docblock'><p>Formats the value using the given formatter.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../kawaii/struct.Measure.html" title="struct kawaii::Measure">Measure</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/kawaii/measure.rs.html#107-119' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.drop' class="method"><span id='drop.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop' class='fnname'>drop</a>(&amp;mut self)</code></span></h4>
<div class='docblock'><p>Print measure results and write times to file</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../";
window.currentCrate = "kawaii";
</script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=fn.emergency_stop_clean.html">
</head>
<body>
<p>Redirecting to <a href="fn.emergency_stop_clean.html">fn.emergency_stop_clean.html</a>...</p>
<script>location.replace("fn.emergency_stop_clean.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=fn.emergency_stop_get_state.html">
</head>
<body>
<p>Redirecting to <a href="fn.emergency_stop_get_state.html">fn.emergency_stop_get_state.html</a>...</p>
<script>location.replace("fn.emergency_stop_get_state.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=fn.emergency_stop_init.html">
</head>
<body>
<p>Redirecting to <a href="fn.emergency_stop_init.html">fn.emergency_stop_init.html</a>...</p>
<script>location.replace("fn.emergency_stop_init.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../kawaii_api/fn.emergency_stop_clean.html">
</head>
<body>
<p>Redirecting to <a href="../../kawaii_api/fn.emergency_stop_clean.html">../../kawaii_api/fn.emergency_stop_clean.html</a>...</p>
<script>location.replace("../../kawaii_api/fn.emergency_stop_clean.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../kawaii_api/fn.emergency_stop_get_state.html">
</head>
<body>
<p>Redirecting to <a href="../../kawaii_api/fn.emergency_stop_get_state.html">../../kawaii_api/fn.emergency_stop_get_state.html</a>...</p>
<script>location.replace("../../kawaii_api/fn.emergency_stop_get_state.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../kawaii_api/fn.emergency_stop_init.html">
</head>
<body>
<p>Redirecting to <a href="../../kawaii_api/fn.emergency_stop_init.html">../../kawaii_api/fn.emergency_stop_init.html</a>...</p>
<script>location.replace("../../kawaii_api/fn.emergency_stop_init.html" + location.search + location.hash);</script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=fn.emergency_stop_clean.html">
</head>
<body>
<p>Redirecting to <a href="fn.emergency_stop_clean.html">fn.emergency_stop_clean.html</a>...</p>
<script>location.replace("fn.emergency_stop_clean.html" + location.search + location.hash);</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More