Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Removed usage of SW2 / SW3 #55

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ struct MbedClientDevice device = {
// Instantiate the class which implements LWM2M Client API (from simpleclient.h)
MbedClient mbed_client(device);

// Set up Hardware interrupt button.
InterruptIn obs_button(SW2);
InterruptIn unreg_button(SW3);
// Set up a timer to update resource
Ticker timer;

// LED Output
DigitalOut led1(LED1);
Expand Down Expand Up @@ -226,7 +225,7 @@ void unregister() {
updates.release();
}

void button_clicked() {
void update_resource() {
clicked = true;
updates.release();
}
Expand Down Expand Up @@ -292,13 +291,13 @@ int main() {
ButtonResource button_resource;
LedResource led_resource;

// On press of SW3 button on K64F board, example application
// On press of a button, example application
// will call unregister API towards mbed Device Connector
//unreg_button.fall(&mbed_client,&MbedClient::test_unregister);
unreg_button.fall(&unregister);
//unreg_button.fall(&unregister);

// Observation Button (SW2) press will send update of endpoint resource values to connector
obs_button.fall(&button_clicked);
// Send update of endpoint resource values to connector periodically
timer.attach(&update_resource, 5.0);

// Create endpoint interface to manage register and unregister
mbed_client.create_interface(MBED_SERVER_ADDRESS, network_interface);
Expand Down Expand Up @@ -333,7 +332,7 @@ int main() {
}
if(clicked) {
clicked = false;
button_resource.handle_button_click();
button_resource.handle_button_click();
}
}

Expand Down