Skip to content

Commit

Permalink
✨ (spikes): Add lk_touch_sensor_kit
Browse files Browse the repository at this point in the history
  • Loading branch information
MMyster committed Jun 20, 2022
1 parent 73c7520 commit fcd035a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spikes/lk_touch_sensor_kit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Leka - LekaOS
# Copyright 2022 APF France handicap
# SPDX-License-Identifier: Apache-2.0

add_mbed_executable(spike_lk_touch_sensor_kit)

target_include_directories(spike_lk_touch_sensor_kit
PRIVATE
.
)

target_sources(spike_lk_touch_sensor_kit
PRIVATE
main.cpp
)

target_link_libraries(spike_lk_touch_sensor_kit
TouchSensorKit
)

target_link_custom_leka_targets(spike_lk_touch_sensor_kit)
43 changes: 43 additions & 0 deletions spikes/lk_touch_sensor_kit/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Leka - LekaOS
// Copyright 2022 APF France handicap
// SPDX-License-Identifier: Apache-2.0

#include "drivers/BufferedSerial.h"
#include "rtos/ThisThread.h"

#include "HelloWorld.h"
#include "LogKit.h"
#include "TouchSensorKit.h"

using namespace leka;
using namespace std::chrono;

auto main() -> int
{
logger::init();

HelloWorld hello;
hello.start();

log_info("Hello, World!\n\n");

auto touch_sensor_kit = TouchSensorKit();
touch_sensor_kit.setup();

auto start = rtos::Kernel::Clock::now();

rtos::ThisThread::sleep_for(2s);

auto t = rtos::Kernel::Clock::now() - start;
log_info("A message from your board %s --> \"%s\" at %i s\n", MBED_CONF_APP_TARGET_NAME, hello.world,
int(t.count() / 1000));
touch_sensor_kit.calibration();
rtos::ThisThread::sleep_for(2s);

while (true) {
touch_sensor_kit.updateState();
touch_sensor_kit.printState();
log_info("\n\n");
rtos::ThisThread::sleep_for(1s);
}
}

0 comments on commit fcd035a

Please sign in to comment.