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
mlatoundji committed Jul 15, 2022
1 parent 6459baa commit 3600dc7
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions spikes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ add_subdirectory(${SPIKES_DIR}/lk_sensors_temperature_humidity)
add_subdirectory(${SPIKES_DIR}/lk_sensors_touch)
add_subdirectory(${SPIKES_DIR}/lk_serial_number)
add_subdirectory(${SPIKES_DIR}/lk_ticker_timeout)
add_subdirectory(${SPIKES_DIR}/lk_touch_sensor_kit)
add_subdirectory(${SPIKES_DIR}/lk_watchdog_isr)
add_subdirectory(${SPIKES_DIR}/lk_wifi)

Expand Down
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)
44 changes: 44 additions & 0 deletions spikes/lk_touch_sensor_kit/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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.adjustSensitivity(0x0000, true);
rtos::ThisThread::sleep_for(2s);

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

0 comments on commit 3600dc7

Please sign in to comment.