Skip to content

Commit 4d3d11c

Browse files
bradjcppannuto
authored andcommitted
fix sensors app
1 parent 16323bd commit 4d3d11c

26 files changed

+107
-10
lines changed

examples/sensors/main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ int main(void) {
7272
printf("[Sensors] All available sensors on the platform will be sampled.\n");
7373

7474
/* *INDENT-OFF* */
75-
light = libtock_ambient_light_exists();
76-
temperature = libtock_temperature_exists();
77-
humidity = libtock_humidity_exists();
78-
ninedof = libtock_ninedof_exists();
79-
proximity = libtock_proximity_exists();
80-
sound_pressure = libtock_sound_pressure_exists();
81-
moisture = libtock_moisture_exists();
82-
rainfall = libtock_rainfall_exists();
75+
light = libtocksync_ambient_light_exists();
76+
temperature = libtocksync_temperature_exists();
77+
humidity = libtocksync_humidity_exists();
78+
ninedof = libtocksync_ninedof_exists();
79+
proximity = libtocksync_proximity_exists();
80+
sound_pressure = libtocksync_sound_pressure_exists();
81+
moisture = libtocksync_moisture_exists();
82+
rainfall = libtocksync_rainfall_exists();
8383
/* *INDENT-ON* */
8484

8585
if (ninedof) {
@@ -103,7 +103,7 @@ int main(void) {
103103
/* *INDENT-ON* */
104104

105105
if (sound_pressure) {
106-
libtock_sound_pressure_command_enable();
106+
libtocksync_sound_pressure_enable();
107107
}
108108

109109
// Setup periodic alarm to sample the sensors.

libtock-sync/crypto/hmac.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
#include "hmac.h"
55

6+
bool libtocksync_hmac_exists(void) {
7+
return libtocksync_hmac_driver_exists();
8+
}
9+
610
returncode_t libtocksync_hmac_simple(libtock_hmac_algorithm_t hmac_type,
711
uint8_t* key_buffer, uint32_t key_length,
812
uint8_t* input_buffer, uint32_t input_length,

libtock-sync/crypto/hmac.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
extern "C" {
1010
#endif
1111

12+
13+
bool libtocksync_hmac_exists(void);
14+
1215
// Compute an HMAC on the given buffer.
1316
returncode_t libtocksync_hmac_simple(libtock_hmac_algorithm_t hmac_type,
1417
uint8_t* key_buffer, uint32_t key_length,

libtock-sync/crypto/sha.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ static void sha_cb_hash(returncode_t ret) {
1414
result.ret = ret;
1515
}
1616

17+
bool libtocksync_sha_exists(void) {
18+
return libtocksync_sha_driver_exists();
19+
}
20+
1721
returncode_t libtocksync_sha_simple_hash(libtock_sha_algorithm_t hash_type,
1822
uint8_t* input_buffer, uint32_t input_length,
1923
uint8_t* hash_buffer, uint32_t hash_length) {

libtock-sync/crypto/sha.h

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

10+
11+
bool libtocksync_sha_exists(void);
12+
1013
// Compute a SHA hash on the given buffer.
1114
returncode_t libtocksync_sha_simple_hash(libtock_sha_algorithm_t hash_type,
1215
uint8_t* input_buffer, uint32_t input_length,

libtock-sync/sensors/ambient_light.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ static void ambient_light_callback(returncode_t ret, int intensity) {
1717
result.fired = true;
1818
}
1919

20+
bool libtocksync_ambient_light_exists(void) {
21+
return libtock_ambient_light_driver_exists();
22+
}
23+
2024
returncode_t libtocksync_ambient_light_read_intensity(int* lux_value) {
2125
returncode_t err;
2226

libtock-sync/sensors/ambient_light.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_ambient_light_exists(void);
11+
1012
// Read the ambient light sensor synchronously.
1113
//
1214
// ## Arguments

libtock-sync/sensors/humidity.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ static void humidity_callback(returncode_t ret, int humidity) {
1717
result.fired = true;
1818
}
1919

20+
bool libtocksync_humidity_exists(void) {
21+
return libtock_humidity_driver_exists();
22+
}
23+
2024
returncode_t libtocksync_humidity_read(int* humidity) {
2125
returncode_t err;
2226

libtock-sync/sensors/humidity.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_humidity_exists(void);
11+
1012
// Read the humidity sensor synchronously.
1113
//
1214
// ## Arguments

libtock-sync/sensors/moisture.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ static void moisture_callback(returncode_t ret, int moisture) {
1717
result.fired = true;
1818
}
1919

20+
bool libtocksync_moisture_exists(void) {
21+
return libtock_moisture_driver_exists();
22+
}
23+
2024
returncode_t libtocksync_moisture_read(int* moisture) {
2125
returncode_t err;
2226

0 commit comments

Comments
 (0)