Skip to content

Commit

Permalink
dial in
Browse files Browse the repository at this point in the history
  • Loading branch information
echavemann committed Nov 16, 2024
1 parent feb23c5 commit 065c84b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/drivers/capsense_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "drivers/driver_enums.hpp"
#include "drivers/gpio_pin.hpp"
#include "microbit_v2.h"
#include "nrf_gpio.h"
#include "util.hpp"

namespace edge::drivers {
Expand All @@ -12,6 +13,7 @@ class CapsenseController {
GPIOPin touch_logo{TOUCH_LOGO, GPIOConfiguration::IN_NORES};

etl::array<ProcessCallbackPtr, MAX_PROCESSES> subscriptions;
bool touched = false;

CapsenseController();
~CapsenseController() = default;
Expand All @@ -26,6 +28,10 @@ class CapsenseController {

void subscribe_captouch_press(ProcessCallbackPtr callback, uint8_t process_id);

bool get_captouch_pressed();

void handle_gpio_interrupt(nrf_gpio_pin_sense_t sense);

};


Expand Down
18 changes: 18 additions & 0 deletions src/drivers/captouch_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,23 @@ void CapsenseController::subscribe_captouch_press(ProcessCallbackPtr callback, u
return;
}

bool CapsenseController::get_captouch_pressed()
{
return touched;
}

void CapsenseController::handle_gpio_interrupt(nrf_gpio_pin_sense_t sense)
{
if (sense == NRF_GPIO_PIN_SENSE_HIGH)
{
touched = true;
}
else
{
touched = false;
}
return;
}

} // end ns drivers

0 comments on commit 065c84b

Please sign in to comment.