Added beeper, moved bsp init into separate function
This commit is contained in:
@@ -42,3 +42,7 @@
|
||||
[submodule "libs/servo"]
|
||||
path = libs/servo
|
||||
url = https://git.simvelop.de/aconnoLibs/servo
|
||||
[submodule "libs/aconnoBeeper"]
|
||||
path = libs/aconnoBeeper
|
||||
url = https://git.simvelop.de/aconnoLibs/aconnoBeeper.git
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "menuStates.h"
|
||||
#include "aconnoHelpers.h"
|
||||
#include "GDEP015OC1.h"
|
||||
#include "aconnoBeeper.h"
|
||||
|
||||
extern TaskHandle_t LDRTask;
|
||||
extern TaskHandle_t potTask;
|
||||
@@ -37,6 +38,8 @@ extern AconnoGPIO ledBlue;
|
||||
|
||||
extern QueueHandle_t interruptSourceQueueSecondary;
|
||||
|
||||
extern AconnoBeeper beeper;
|
||||
|
||||
uint8_t irFlag;
|
||||
uint8_t joyFlag;
|
||||
|
||||
@@ -170,7 +173,7 @@ State* SoundMenuState::handleEvent(IOEXP_INT_SOURCE intSource)
|
||||
}
|
||||
case IOEXP_INT_SOURCE::JOY_CENTER:
|
||||
{
|
||||
returnStatep = new UnimplementedState();
|
||||
returnStatep = new SoundExampleState();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -188,6 +191,33 @@ void SoundMenuState::displayOnEpd()
|
||||
epd.write();
|
||||
}
|
||||
|
||||
State *SoundExampleState::handleEvent(IOEXP_INT_SOURCE intSource)
|
||||
{
|
||||
State *returnStatep;
|
||||
switch(intSource)
|
||||
{
|
||||
case IOEXP_INT_SOURCE::JOY_CENTER:
|
||||
{
|
||||
returnStatep = new SoundMenuState();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
returnStatep = new SoundExampleState();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnStatep;
|
||||
}
|
||||
|
||||
void SoundExampleState::displayOnEpd()
|
||||
{
|
||||
epd.drawImage(sound1);
|
||||
epd.write();
|
||||
char *song = "Greensleaves:d=4,o=5,b=140:g,2a#,c6,d.6,8d#6,d6,2c6,a,f.,8g,a,2a#,g,g.,8f#,g,2a,f#,2d,g,2a#,c6,d.6,8d#6,d6,2c6,a,f.,8g,a,a#.,8a,g,f#.,8e,f#,2g";
|
||||
beeper.playRttl(song);
|
||||
}
|
||||
|
||||
|
||||
State *RgbLedMenuState::handleEvent(IOEXP_INT_SOURCE intSource)
|
||||
{
|
||||
|
||||
@@ -49,6 +49,7 @@ class State
|
||||
* better control of the transitions.
|
||||
*/
|
||||
virtual void displayOnEpd() = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -112,6 +113,15 @@ class SoundMenuState : public State
|
||||
|
||||
};
|
||||
|
||||
class SoundExampleState : public State
|
||||
{
|
||||
public:
|
||||
|
||||
State *handleEvent(IOEXP_INT_SOURCE intSource);
|
||||
void displayOnEpd();
|
||||
|
||||
};
|
||||
|
||||
class RgbLedMenuState : public State
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -44,6 +44,10 @@ PROJ_SRC += \
|
||||
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_spi.c \
|
||||
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_spi.c \
|
||||
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_spim.c \
|
||||
$(PROJ_DIR)/libs/aconnoBeeper/aconnoBeeper.cpp \
|
||||
$(PROJ_DIR)/libs/aconnoPWM/aconnoPWM.cpp \
|
||||
|
||||
|
||||
|
||||
PROJ_INC += \
|
||||
$(PROJ_DIR)/libs/aconnoGPIO \
|
||||
@@ -65,6 +69,9 @@ PROJ_INC += \
|
||||
$(PROJ_DIR)/libs/LSM9DS1 \
|
||||
$(PROJ_DIR)/libs/servo/ \
|
||||
#$(PROJ_DIR)/BLE/nordicBLE/ \
|
||||
$(PROJ_DIR)/libs/aconnoBeeper \
|
||||
$(PROJ_DIR)/libs/aconnoPWM \
|
||||
|
||||
|
||||
# Source files common to all targets
|
||||
SRC_FILES += \
|
||||
|
||||
+15330
-2586
File diff suppressed because it is too large
Load Diff
Submodule
+1
Submodule libs/aconnoBeeper added at 739aaf2ae9
+3
-1
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "aconnoBLE.h"
|
||||
#include "aconnoTasks.h"
|
||||
|
||||
#include "aconnoBeeper.h"
|
||||
|
||||
/**
|
||||
* @brief loger task handler
|
||||
@@ -111,6 +111,8 @@ Potentiometer pot(adc, ADC_POT);
|
||||
MCP9700 ambientTemperature(adc, ADC_TEMP);
|
||||
|
||||
Servo servo(PIN_SERVO2, 2);
|
||||
AconnoBeeper beeper(1, PIN_BUZZER);
|
||||
|
||||
// Must be global
|
||||
AconnoBLEService myService;
|
||||
AconnoBLEChar myChar;
|
||||
|
||||
@@ -36,6 +36,7 @@ extern uint8_t irFlag;
|
||||
extern QueueHandle_t interruptSourceQueue;
|
||||
IOEXP_INT_SOURCE intSourceSend = IOEXP_INT_SOURCE::NOTHING;
|
||||
IOEXP_INT_SOURCE intSourceRecv = IOEXP_INT_SOURCE::NOTHING;
|
||||
|
||||
/**
|
||||
* @brief A flag to help with initial drawing of the joystick example
|
||||
*
|
||||
@@ -108,7 +109,6 @@ void getInterruptSourceFunction(void *arg)
|
||||
xQueueSendToBack(interruptSourceQueue,
|
||||
(void *) &intSourceSend,
|
||||
((TickType_t)TICKS_TO_BLOCK_DEFAULT) != pdPASS);
|
||||
|
||||
xTimerReset(intFlagTimer ,TICKS_TO_BLOCK_DEFAULT);
|
||||
}
|
||||
// give other code a chance to execute since we have a higher
|
||||
|
||||
Reference in New Issue
Block a user