Skip to content

Commit 69bfaf0

Browse files
bradjcppannuto
authored andcommitted
libtock-sync: add driver_exists
1 parent 4d3d11c commit 69bfaf0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+140
-3
lines changed

examples/tests/hmac/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int main(void) {
2020
returncode_t ret;
2121
printf("[TEST] HMAC\r\n");
2222

23-
if (!libtock_hmac_exists()) {
23+
if (!libtocksync_hmac_exists()) {
2424
printf("No HMAC driver.\n");
2525
return -2;
2626
}

libtock-sync/crypto/hmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "hmac.h"
55

66
bool libtocksync_hmac_exists(void) {
7-
return libtocksync_hmac_driver_exists();
7+
return libtock_hmac_driver_exists();
88
}
99

1010
returncode_t libtocksync_hmac_simple(libtock_hmac_algorithm_t hmac_type,

libtock-sync/crypto/sha.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void sha_cb_hash(returncode_t ret) {
1515
}
1616

1717
bool libtocksync_sha_exists(void) {
18-
return libtocksync_sha_driver_exists();
18+
return libtock_sha_driver_exists();
1919
}
2020

2121
returncode_t libtocksync_sha_simple_hash(libtock_sha_algorithm_t hash_type,

libtock-sync/display/screen.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <libtock/display/syscalls/screen_syscalls.h>
2+
13
#include "screen.h"
24

35
struct screen_done {
@@ -37,6 +39,10 @@ static void screen_cb_rotation(returncode_t ret, libtock_screen_rotation_t rotat
3739
result_rotation.fired = true;
3840
}
3941

42+
bool libtocksync_screen_exists(void) {
43+
return libtock_screen_driver_exists();
44+
}
45+
4046
returncode_t libtocksync_screen_set_brightness(uint32_t brightness) {
4147
returncode_t ret;
4248

libtock-sync/display/screen.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
extern "C" {
88
#endif
99

10+
bool libtocksync_screen_exists(void);
11+
1012
// Set the screen brightness.
1113
returncode_t libtocksync_screen_set_brightness(uint32_t brightness);
1214

libtock-sync/display/text_screen.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ static returncode_t text_screen_op(returncode_t (*op)(void (*)(returncode_t))) {
4040
return result.ret;
4141
}
4242

43+
bool libtocksync_text_screen_exists(void) {
44+
return libtock_text_screen_driver_exists();
45+
}
46+
4347
returncode_t libtocksync_text_screen_display_on(void) {
4448
return text_screen_op(libtock_text_screen_display_on);
4549
}

libtock-sync/display/text_screen.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
extern "C" {
88
#endif
99

10+
bool libtocksync_text_screen_exists(void);
11+
1012
returncode_t libtocksync_text_screen_display_on(void);
1113

1214
returncode_t libtocksync_text_screen_display_off(void);

libtock-sync/interface/button.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <libtock/interface/syscalls/button_syscalls.h>
2+
13
#include "button.h"
24

35
struct data {
@@ -18,6 +20,10 @@ static void button_cb(returncode_t ret, int button_num, bool pressed) {
1820
}
1921

2022

23+
bool libtocksync_button_exists(void) {
24+
return libtock_button_driver_exists();
25+
}
26+
2127
returncode_t libtocksync_button_wait_for_press(int button_num) {
2228
returncode_t err;
2329
result.fired = false;

libtock-sync/interface/button.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
extern "C" {
88
#endif
99

10+
bool libtocksync_button_exists(void);
11+
1012
// Wait for a specific button to be pressed.
1113
//
1214
// This blocks until the button has been pressed. Note, this will not return if

libtock-sync/interface/buzzer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
extern "C" {
88
#endif
99

10+
bool libtocksync_buzzer_exists(void);
11+
1012
// Play a constant tone for a certain amount of time.
1113
//
1214
// This blocks until the tone has played.

0 commit comments

Comments
 (0)