Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
c56d0c38
Commit
c56d0c38
authored
Aug 30, 2014
by
Projects
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vibra: Driver, basic functions.
parent
cb02bd4e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
106 additions
and
0 deletions
+106
-0
vibra.c
sw/common/drivers/vibra.c
+50
-0
vibra.h
sw/common/drivers/vibra.h
+47
-0
Makefile
sw/freertos/Makefile
+1
-0
example_app.c
sw/freertos/src/apps/example_app.c
+6
-0
main.c
sw/freertos/src/main.c
+2
-0
No files found.
sw/common/drivers/vibra.c
0 → 100644
View file @
c56d0c38
/*
* Copyright (C) 2014 Julian Lewis
* @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Matthieu Cattin <matthieu.cattin@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @brief Vibration motor control.
*/
#include "vibra.h"
#include <em_cmu.h>
#include <em_gpio.h>
#define VIBRA_PORT gpioPortA
#define VIBRA_PIN 3
void
vibra_init
(
void
)
{
GPIO_PinModeSet
(
VIBRA_PORT
,
VIBRA_PIN
,
gpioModePushPull
,
0
);
}
void
vibra_enable
(
void
)
{
GPIO_PinOutSet
(
VIBRA_PORT
,
VIBRA_PIN
);
}
void
vibra_disable
(
void
)
{
GPIO_PinOutClear
(
VIBRA_PORT
,
VIBRA_PIN
);
}
sw/common/drivers/vibra.h
0 → 100644
View file @
c56d0c38
/*
* Copyright (C) 2014 Julian Lewis
* @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Matthieu Cattin <matthieu.cattin@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @brief Vibration motor control.
*/
#ifndef VIBRA_H
#define VIBRA_H
/**
* @brief Initialize vibration motor.
*/
void
vibra_init
(
void
);
/**
* @brief Turns on the vibration motor.
*/
void
vibra_enable
(
void
);
/**
* @brief Turns off the vibration motor.
*/
void
vibra_disable
(
void
);
#endif
/* VIBRA_H */
sw/freertos/Makefile
View file @
c56d0c38
...
...
@@ -142,6 +142,7 @@ C_SRC += \
../common/drivers/buttons.c
\
../common/drivers/buzzer.c
\
../common/drivers/rtc.c
\
../common/drivers/vibra.c
\
../common/gfx/font_helv11.c
\
../common/gfx/font_helv17.c
\
../common/gfx/font_helv17b.c
\
...
...
sw/freertos/src/apps/example_app.c
View file @
c56d0c38
...
...
@@ -27,6 +27,7 @@
#include "application.h"
#include "widgets/status_bar.h"
#include "drivers/buzzer.h"
#include "drivers/vibra.h"
#include <string.h> // for strcpy
...
...
@@ -61,6 +62,11 @@ static void widget_event(struct ui_widget *w, const struct event *evt)
case
BUT_TL
:
// this should not happen, it is handled
break
;
// in the main loop
}
// short vibration
vibra_enable
();
vTaskDelay
(
100
);
vibra_disable
();
break
;
case
RTC_TICK
:
...
...
sw/freertos/src/main.c
View file @
c56d0c38
...
...
@@ -34,6 +34,7 @@
#include <drivers/buzzer.h>
#include <drivers/lcd.h>
#include <drivers/rtc.h>
#include <drivers/vibra.h>
#include <gfx/ui.h>
int
main
(
void
)
...
...
@@ -47,6 +48,7 @@ int main(void)
buttons_init
();
buzzer_init
();
vibra_init
();
rtc_init
();
lcd_init
();
ui_init
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment