Skip to content

Commit

Permalink
✨ (dac): Add DAC spike
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLocatelli committed Feb 21, 2024
1 parent 53d1a4f commit 6e03668
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spikes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_subdirectory(${SPIKES_DIR}/lk_command_kit)
add_subdirectory(${SPIKES_DIR}/lk_config_kit)
add_subdirectory(${SPIKES_DIR}/lk_coreled)
add_subdirectory(${SPIKES_DIR}/lk_core_touch_sensor)
add_subdirectory(${SPIKES_DIR}/lk_dac)
add_subdirectory(${SPIKES_DIR}/lk_event_queue)
add_subdirectory(${SPIKES_DIR}/lk_file_reception)
add_subdirectory(${SPIKES_DIR}/lk_file_manager_kit)
Expand Down Expand Up @@ -57,6 +58,7 @@ add_dependencies(spikes_leka
spike_lk_command_kit
spike_lk_coreled
spike_lk_core_touch_sensor
spike_lk_dac
spike_lk_event_queue
spike_lk_file_reception
spike_lk_file_manager_kit
Expand Down
17 changes: 17 additions & 0 deletions spikes/lk_dac/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Leka - LekaOS
# Copyright 2024 APF France handicap
# SPDX-License-Identifier: Apache-2.0

add_mbed_executable(spike_lk_dac)

target_include_directories(spike_lk_dac
PRIVATE
.
)

target_sources(spike_lk_dac
PRIVATE
main.cpp
)

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

#include "drivers/AnalogOut.h"
#include "drivers/DigitalOut.h"
#include "rtos/ThisThread.h"

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

using namespace leka;
using namespace std::chrono_literals;

auto dac_enable = mbed::DigitalOut {SOUND_ENABLE, 1};
auto dac_output = mbed::AnalogOut {MCU_SOUND_OUT};

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

HelloWorld hello;
hello.start();

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

while (true) {
log_info("Still alive");
rtos::ThisThread::sleep_for(10s);
}
}

0 comments on commit 6e03668

Please sign in to comment.