68 Commits
Author SHA1 Message Date
Jurica 48ec730006 Small changes 2019-05-15 15:22:45 +02:00
Jurica cd63ca1305 Small changes in MakeFile 2019-05-15 15:14:09 +02:00
Jurica Rešetar 4959758715 Merge branch 'USB_Fix' into 'master'
Usb fix

See merge request ACD528xxMasterExample/ACD528xxMasterExampleFW!28
2019-05-15 14:29:18 +02:00
Odri Tomas 9c8c291b0c removing developer toolchain path specific data 2019-05-15 12:07:48 +02:00
Odri Tomas e4b7638577 Issue #18 2019-05-15 11:11:00 +02:00
Odri Tomas b088d20759 Issue #21 2019-05-15 10:55:09 +02:00
Odri Tomas 79eea88d64 Small fix - removing unneeded flags 2019-05-14 14:47:56 +02:00
Odri Tomas e281c6e0af Issue #18 on 40board resolved
32 board still has no memory error for BLE stack
2019-05-14 14:47:12 +02:00
Odri Tomas 6d116dbe2e Issue #19
Mouse doesn't move diagonally
2019-05-13 12:02:53 +02:00
Odri Tomas 46ad2336d7 Resolving discussion issue
Renaming to our standards and removing NRF CLI flag
2019-05-13 10:59:31 +02:00
Odri Tomas ca2bb7a8b4 LEDs turned off 2019-05-10 13:17:58 +02:00
Odri Tomas 395b37b761 Added flag support for different boards 2019-05-10 13:01:06 +02:00
Odri Tomas f72f86790d Queue reset 2019-05-10 13:00:56 +02:00
Odri Tomas 8095b06cce Mouse moving in all directions
The queue error still exists
2019-05-10 13:00:56 +02:00
Odri Tomas a09eb86dcf Mouse moving down, left, while stoping on button-right-up 2019-05-10 13:00:56 +02:00
Odri Tomas 0516ba3929 Moving in X direction 2019-05-10 13:00:56 +02:00
Odri Tomas e06a0ab709 USB is discoverable when using BLE/softdevices 2019-05-10 13:00:56 +02:00
Jurica 202fcd39fa Memory fix 2019-05-10 13:00:56 +02:00
Jurica 92141059d5 Device is recognized by PC 2019-05-10 13:00:56 +02:00
Odri Tomas 11657f41e1 USB with invalid state error 2019-05-10 13:00:19 +02:00
Odri Tomas 6247922370 Generic hid...report in set error 2019-05-10 13:00:19 +02:00
Odri Tomas 5c7b6fd64a usb beginning 2019-05-10 13:00:19 +02:00
Odri Tomas 2c92de2f7f usb task 2019-05-10 13:00:19 +02:00
Jurica Rešetar a974a2f501 Merge branch 'nrf52840Support' into 'master'
Nrf52840 support

See merge request ACD528xxMasterExample/ACD528xxMasterExampleFW!27
2019-04-30 14:11:25 +02:00
Odri Tomas d953180b28 Config files common for all platforms removed 2019-04-29 17:06:07 +02:00
Odri Tomas 5c03cd5072 Minor config and makefile changes 2019-04-29 15:44:10 +02:00
odri@aconno.de 4a968d4981 Merge branch 'nrf8532-40' into nrf52840Support 2019-04-29 13:24:49 +02:00
Odri Tomas cbb77b5782 nrf5832 fix 2019-04-29 13:17:34 +02:00
Odri Tomas c9e02ff9b2 nrf5832 try 2019-04-26 14:23:56 +02:00
Odri Tomas 9e10b6bdc6 Small header changes 2019-04-25 15:06:56 +02:00
Odri Tomas 77e19fd5e5 working master ex. on 40 board 2019-04-25 14:15:40 +02:00
Odri Tomas 69b8e3b833 edit gitignore 2019-04-24 13:35:42 +02:00
Odri Tomas b07835e0ec Small changed 2019-04-24 13:31:26 +02:00
Odri Tomas e89846187c DFU and support with memory problems 2019-04-24 09:46:58 +02:00
Jurica Rešetar 901ae0634c Merge branch 'freezeButtonFix' into 'master'
Fixed a bug that sometimes occured while a button was rapidly pressed

See merge request ACD52832MasterExample/ACD52832MasterExampleFW!25
2019-04-08 15:41:55 +02:00
Dominik Kotarski d46876fcaa Fixed a bug that sometimes occured while a button was rapidly pressed 2019-04-08 09:14:23 +02:00
Jurica Rešetar 253c76d45a Merge branch 'submoduleDoxy' into 'master'
Submodule updates

See merge request ACD52832MasterExample/ACD52832MasterExampleFW!23
2019-04-04 11:17:58 +02:00
Dominik Kotarski 75ce487b1b Submodule updates 2019-04-04 10:12:17 +02:00
Jurica 005466b4a1 Small fixes 2019-04-03 16:41:21 +02:00
Jurica a0ecd4a5c6 Doxy changes 2019-04-03 15:32:18 +02:00
Jurica b189fe7c2d Merge branch 'menuStatesDoxy' 2019-04-03 12:14:29 +02:00
Jurica 556df3a0b9 Small changes in make 2019-04-03 12:02:25 +02:00
Dominik Kotarski 54509ab5f0 Cosmetic changes 2019-04-03 09:15:53 +02:00
Dominik Kotarski e0340f436e Minor cosmetic changes 2019-04-02 09:38:46 +02:00
Dominik Kotarski aa346a065d Config standardisation 2019-04-02 09:17:14 +02:00
Dominik Kotarski a01ae82cb2 aconnoTasks standardisation 2019-04-02 09:05:40 +02:00
Dominik Kotarski 00ae5d55e8 Doxygen on main 2019-04-02 08:45:38 +02:00
Dominik Kotarski 39cfac95f8 Doxygen WIP 2019-04-01 16:16:14 +02:00
Dominik Kotarski 9371a70e6a Renaming and refactoring 2019-04-01 16:10:15 +02:00
Dominik Kotarski 87b727efb0 menuStates renamed into states and moved into a separate directory 2019-04-01 15:26:01 +02:00
Dominik Kotarski 9a079840fb IOEXP_INT_SOURCE TO INT_SOURCE and menuStates doxygen 2019-04-01 15:15:00 +02:00
Dominik Kotarski 8e36e238a0 WIP menuStatesDoxy 2019-03-28 10:27:25 +01:00
odri@aconno.de a4d93aeb91 Adding comments for DoxyGen 2019-03-28 09:21:56 +01:00
Jurica Rešetar 128d9c54ce Merge branch 'epdWriteFix' into 'master'
Epd write fix

See merge request ACD52832_MasterExample/ACD52832_MasterExampleFW!21
2019-03-26 13:30:28 +01:00
Odri Tomas b49b33579e Removed unwanted NRF_LOG 2019-03-26 13:29:31 +01:00
Dominik Kotarski 7e7382f7cd Latest hex 2019-03-26 12:55:04 +01:00
Dominik Kotarski d520adcde6 Submodule update 2019-03-26 12:53:52 +01:00
Dominik Kotarski 5799593dfb Fixed parallel epd write bug 2019-03-26 12:53:11 +01:00
Odri Tomas e758428c53 Submodule update and fix for joystick 2019-03-22 14:21:22 +01:00
Odri Tomas eff5ba5ad5 Interrupt fix 2019-03-22 13:41:22 +01:00
Odri Tomas 93fe5f5b14 Temp flag 2019-03-21 13:57:23 +01:00
Jurica Rešetar 7ec6eaebc6 Merge branch 'servoIssue' into 'master'
Servo issue #12

See merge request ACD52832_MasterExample/ACD52832_MasterExampleFW!20
2019-03-21 12:50:58 +01:00
Odri Tomas a0fccd2c56 deleted commented 2019-03-21 12:46:11 +01:00
Odri Tomas 7e0198b6cf Servo issue
Enable and disable pwm  before write
2019-03-21 12:44:33 +01:00
Jurica Rešetar 20b955696e Merge branch 'issueFix' into 'master'
Issue #13 & #14

See merge request ACD52832_MasterExample/ACD52832_MasterExampleFW!19
2019-03-21 11:00:13 +01:00
odri@aconno.de 4f3fe6428a Issue #13 & #14 2019-03-21 10:52:21 +01:00
Jurica Rešetar 815643255d Merge branch 'bugFix2' into 'master'
Fixed tardy joystick bug

See merge request ACD52832_MasterExample/ACD52832_MasterExampleFW!18
2019-03-21 09:31:44 +01:00
Dominik Kotarski 4582bdf1eb Fixed tardy joystick bug 2019-03-21 08:19:13 +01:00
49 changed files with 44408 additions and 30535 deletions
+5
View File
@@ -4,3 +4,8 @@ build/_build/*
.directory*
.DS_Store
cscope.out
Docs
nrf52832/build/_build/*
!nrf52832/build/_build/nrf52832_xxaa.hex
nrf52840/build/_build/*
!nrf52840/build/_build/nrf52832_xxaa.hex
+6
View File
@@ -46,3 +46,9 @@
path = libs/aconnoBeeper
url = https://git.simvelop.de/aconnoLibs/aconnoBeeper.git
[submodule "libs/aconnoLog"]
path = libs/aconnoLog
url = https://git.simvelop.de/aconnoLibs/aconnoLog
[submodule "aconnoSettings"]
path = aconnoSettings
url = https://git.simvelop.de/aconnoLibs/aconnoSettings
+16 -19
View File
@@ -9,6 +9,7 @@
*
*/
//------------------------------ INCLUDES -------------------------------------
#include "aconnoHelpers.h"
#include "sdk_config.h"
#include "app_error.h"
@@ -20,8 +21,12 @@
#include "nrf_log_default_backends.h"
#include "MCP23017.h"
#include "acd52832Bsp.h"
#include "aconnoBsp.h"
//-------------------------------- MACROS -------------------------------------
//----------------------------- DATA TYPES ------------------------------------
//--------------------- PRIVATE FUNCTION PROTOTYPES ---------------------------
//----------------------- STATIC DATA & CONSTANTS -----------------------------
//------------------------------ GLOBAL DATA ----------------------------------
extern bool getInterruptSourceFlag;
extern AconnoI2C i2c;
extern AconnoGPIO ledRed;
@@ -29,10 +34,9 @@ extern AconnoGPIO ledBlue;
extern AconnoGPIO ledGreen;
extern MCP23017 expdr;
extern AconnoGPIO ld1;
/**@brief Function for the Timer initialization.
*
* @details Initializes the timer module. This creates and starts application timers.
*/
//--------------------- PUBLIC FUNCTIONS AND OBJECTS --------------------------
void timersInit(void)
{
// Initialize timer module.
@@ -40,20 +44,15 @@ void timersInit(void)
APP_ERROR_CHECK(err_code);
}
/**@brief Function for starting application timers.
* @details Timers are run after the scheduler has started.
*/
void applicationTimerStart(void)
{
}
/**@brief Clear bond information /*/
void deleteBonds(void)
{
NRF_LOG_INFO("Erase bonds!");
}
/**@brief Function for initializing the nrf log module. */
void logInit(void)
{
ret_code_t err_code = NRF_LOG_INIT(NULL);
@@ -62,8 +61,6 @@ void logInit(void)
NRF_LOG_DEFAULT_BACKENDS_INIT();
}
/**@brief Function for initializing the clock.
*/
void clockInit(void)
{
ret_code_t err_code = nrf_drv_clock_init();
@@ -117,7 +114,7 @@ BaseType_t xTaskCreateOrResume(TaskFunction_t pvTaskCode,
void logState(TaskHandle_t xCreatedTask)
{
eTaskState taskState =eTaskGetState( xCreatedTask );
eTaskState taskState = eTaskGetState(xCreatedTask);
switch (taskState)
{
case eRunning:
@@ -146,7 +143,7 @@ void initIoExpander(MCP23017 *expdr)
expdr->reset();
expdr->config(0x01F8, 0xFFFF, 0x0000);
for(uint8_t x=3; x<10; x++) // Init values on Expander pins
for(uint8_t x = 3; x < 10; x++) // Init values on Expander pins
{
expdr->writeGPIOBit(1, x);
}
@@ -157,15 +154,15 @@ void initIoExpander(MCP23017 *expdr)
uint8_t checkState(MCP23017 *expdr, AconnoGPIO *sw1)
{
uint8_t result = 0x00; // 0: pressed, 1: released
#define _(x) result |= (expdr->readGPIOBit(IOEXP_INT_SOURCE:: JOY_##x) << x##_BIT)
#define _(x) result |= (expdr->readGPIOBit(INT_SOURCE:: JOY_##x) << x##_BIT)
_(UP);
_(DOWN);
_(LEFT);
_(RIGHT);
_(CENTER);
#undef _
result |= (expdr->readGPIOBit(IOEXP_INT_SOURCE:: SW2) << SW2_BIT);
result |= ((uint8_t)sw1->read() << SW1_BIT);
result |= (expdr->readGPIOBit(INT_SOURCE::SW2) << SW2_BIT);
result |= ((uint8_t) sw1->read() << SW1_BIT);
result ^= 0xff;
return result;
@@ -195,4 +192,4 @@ void bspInit()
ledBlue.set();
ledGreen.set();
ld1.set();
}
}
+56 -37
View File
@@ -11,19 +11,19 @@
#ifndef __ACONNO_HELPERS_H__
#define __ACONNO_HELPERS_H__
//------------------------------ INCLUDES -------------------------------------
#include <stdint.h>
#include "FreeRTOS.h"
#include "task.h"
#include "MCP23017.h"
#include "aconnoConfig.h"
#include "timers.h"
//----------------------------- DATA TYPES ------------------------------------
/**
* @brief Enumeration for the interrupt source pressed
*
*/
enum IOEXP_INT_SOURCE : uint8_t
enum INT_SOURCE : uint8_t
{
NOTHING = 0,
JOY_UP = 6,
@@ -37,6 +37,37 @@ enum IOEXP_INT_SOURCE : uint8_t
REL2 = 10
};
/**
* @brief BLE Beacon advertisement packet
*
*/
struct __attribute__((packed, aligned(1))) advertisementPacket_t
{
uint8_t size = sizeof(advertisementPacket_t)-1;
uint8_t msdID = MSD_ID;
uint16_t nordicUUID = NORDIC_UUID;
uint8_t aconnoUUID = ACONNO_UUID;;
uint8_t productID = PRODUCT_ID;
uint8_t settingsFlag : 1, versionNumber : 7;
int8_t advType = FIRST_ADV_TYPE_ID;
union
{
struct __attribute__((packed, aligned(4)))
{
int16_t gyroscope[3];
int16_t accelerometer[3];
int16_t magnetometer[3];
};
struct __attribute__((packed, aligned(4)))
{
float temp;
float light;
uint8_t joy;
uint8_t pot;
};
};
};
//-------------------------- CONSTANTS & MACROS -------------------------------
/**
* @defgroup GROUP_BIT
* @brief IoExpander gpio input read bit position
@@ -50,11 +81,33 @@ enum IOEXP_INT_SOURCE : uint8_t
#define SW2_BIT (1)
#define SW1_BIT (0)
/** @} */
//----------------------------PUBLIC PROTOTYPES -------------------------------
/**
* @brief Function for the Timer initialization.
* @details Initializes the timer module. This creates and starts application timers.
*/
void timersInit(void);
/**
* @brief Function for starting application timers.
* @details Timers are run after the scheduler has started.
*/
void applicationTimerStart(void);
/**
* @brief Clear bond information
*/
void deleteBonds(void);
/**
* @brief Function for initializing the nrf log module.
*/
void logInit(void);
/**
* @brief Function for initializing the clock.
*/
void clockInit(void);
/**
@@ -89,37 +142,6 @@ void initIoExpander(MCP23017 *expdr);
*/
uint8_t checkState(MCP23017 *expdr, AconnoGPIO *sw1);
/**
* @brief BLE Beacon advertisement packet
*
*/
struct __attribute__((packed, aligned(1))) advertisementPacket_t
{
uint8_t size = sizeof(advertisementPacket_t)-1;
uint8_t msdID = MSD_ID;
uint16_t nordicUUID = NORDIC_UUID;
uint8_t aconnoUUID = ACONNO_UUID;;
uint8_t productID = PRODUCT_ID;
uint8_t settingsFlag : 1, versionNumber : 7;
int8_t advType = FIRST_ADV_TYPE_ID;
union
{
struct __attribute__((packed, aligned(4)))
{
int16_t gyroscope[3];
int16_t accelerometer[3];
int16_t magnetometer[3];
};
struct __attribute__((packed, aligned(4)))
{
float temp;
float light;
uint8_t joy;
uint8_t pot;
};
};
};
/**
* @brief Timer callback to set the flag which prevents too many interrupt
* events from ioexpander from occuring
@@ -134,7 +156,4 @@ void intFlagTimerCallback(TimerHandle_t xTimer);
*/
void bspInit();
#endif // __ACONNO_HELPERS_H__
-361
View File
@@ -1,361 +0,0 @@
/**
* @file menuStates.h
* @author Dominik Kotarski (d.kotarski@aconno.de)
* @brief
* @version 0.1
* @date 2019-02-18
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __MENU_STATES_H__
#define __MENU_STATES_H__
#include "FreeRTOS.h"
#include "task.h"
#include "aconnoHelpers.h"
#include "aconnoTasks.h"
/**
* @brief Abstract state.
*
*/
class State
{
public:
enum class EPD_WRITE_METHOD
{
FULL,
PARTIAL
};
State();
State(EPD_WRITE_METHOD writeMethod);
virtual ~State();
/**
* @brief Function to handle an interrupt (a button press) in a context
* of the current state
*
* @param intSource Id of the interrupt that occured,
* see IOEXP_INT_SOURCE
* @return State* Returns the next state object (can be itself if the
* state is not supposed to change)
*/
virtual State *handleEvent(IOEXP_INT_SOURCE intSource) = 0;
/**
* @brief Function which handles displaying the state on epd.
*
* This function can also be used to start a task, which will then
* handle drawing on the epd. However, user should take care of
* suspending the mentioned task while exiting the state.
*/
virtual void displayOnEpd() = 0;
/**
* @brief Function to perform epd.write() or epd.fullWrite()
* depending on the writeMethod variable which is given in
* constructor
*
* @see writeMethod
*
* @return uint8_t
*/
uint8_t writeToEpd();
private:
EPD_WRITE_METHOD _writeMethod;
};
class UnimplementedState : public State
{
public:
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class Intro1State : public State
{
public:
Intro1State(EPD_WRITE_METHOD writeMethod);
Intro1State();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class Intro2State : public State
{
public:
Intro2State(EPD_WRITE_METHOD writeMethod);
Intro2State();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class Intro3State : public State
{
public:
Intro3State(EPD_WRITE_METHOD writeMethod);
Intro3State();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class JoystickMenuState : public State
{
public:
JoystickMenuState(EPD_WRITE_METHOD writeMethod);
JoystickMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class JoystickExampleState : public State
{
public:
JoystickExampleState(EPD_WRITE_METHOD writeMethod);
JoystickExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class SoundMenuState : public State
{
public:
SoundMenuState(EPD_WRITE_METHOD writeMethod);
SoundMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class SoundExampleState : public State
{
public:
SoundExampleState(EPD_WRITE_METHOD writeMethod);
SoundExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class RgbLedMenuState : public State
{
public:
RgbLedMenuState(EPD_WRITE_METHOD writeMethod);
RgbLedMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class RgbLedExampleState : public State
{
public:
RgbLedExampleState(EPD_WRITE_METHOD writeMethod);
RgbLedExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class ServoMenuState : public State
{
public:
ServoMenuState(EPD_WRITE_METHOD writeMethod);
ServoMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class ServoExampleState : public State
{
public:
ServoExampleState(EPD_WRITE_METHOD writeMethod);
ServoExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class ServoInstructionState : public State
{
public:
ServoInstructionState(EPD_WRITE_METHOD writeMethod);
ServoInstructionState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class LdrMenuState : public State
{
public:
LdrMenuState(EPD_WRITE_METHOD writeMethod);
LdrMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class LdrExampleState : public State
{
public:
LdrExampleState(EPD_WRITE_METHOD writeMethod);
LdrExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class PotentiometerMenuState : public State
{
public:
PotentiometerMenuState(EPD_WRITE_METHOD writeMethod);
PotentiometerMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class PotentiometerExampleState : public State
{
public:
PotentiometerExampleState(EPD_WRITE_METHOD writeMethod);
PotentiometerExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class TempProbeMenuState : public State
{
public:
TempProbeMenuState(EPD_WRITE_METHOD writeMethod);
TempProbeMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class TempProbeExampleState : public State
{
public:
TempProbeExampleState(EPD_WRITE_METHOD writeMethod);
TempProbeExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class RelayMenuState : public State
{
public:
RelayMenuState(EPD_WRITE_METHOD writeMethod);
RelayMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class RelayExampleState : public State
{
public:
RelayExampleState(EPD_WRITE_METHOD writeMethod);
RelayExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class LedMenuState : public State
{
public:
LedMenuState(EPD_WRITE_METHOD writeMethod);
LedMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class LedExampleState : public State
{
public:
LedExampleState(EPD_WRITE_METHOD writeMethod);
LedExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class InfraredMenuState : public State
{
public:
InfraredMenuState(EPD_WRITE_METHOD writeMethod);
InfraredMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class InfraredExampleState : public State
{
public:
InfraredExampleState(EPD_WRITE_METHOD writeMethod);
InfraredExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class GyroMenuState : public State
{
public:
GyroMenuState(EPD_WRITE_METHOD writeMethod);
GyroMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class GyroExampleState : public State
{
public:
GyroExampleState(EPD_WRITE_METHOD writeMethod);
GyroExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class BleMenuState : public State
{
public:
BleMenuState(EPD_WRITE_METHOD writeMethod);
BleMenuState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
class BleExampleState : public State
{
public:
BleExampleState(EPD_WRITE_METHOD writeMethod);
BleExampleState();
State *handleEvent(IOEXP_INT_SOURCE intSource);
void displayOnEpd();
};
#endif //__MENU_STATES_H__
+151 -1
View File
@@ -1,3 +1,19 @@
/**
* @file pictures.h
* @author Odri Tomas (odri@aconno.de)
* @brief
* @version 0.1
* @date 2019-03-27
*
* @copyright Copyright (c) 2019
*/
//----------------------------- DATA TYPES ------------------------------------
//-------------------------- CONSTANTS & MACROS -------------------------------
/**
* @brief Intro 1 image data
*
*/
const unsigned char intro1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -201,6 +217,10 @@ const unsigned char intro1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for introduction EPD image 2
*
*/
const unsigned char intro2[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -404,6 +424,10 @@ const unsigned char intro2[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for introduction EPD image 3
*
*/
const unsigned char intro3[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -607,6 +631,10 @@ const unsigned char intro3[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for joystick menu EPD image
*
*/
const unsigned char joystick0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -810,6 +838,10 @@ const unsigned char joystick0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for sound menu EPD image
*
*/
const unsigned char sound0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -1013,6 +1045,10 @@ const unsigned char sound0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for RGB Led menu EPD image
*
*/
const unsigned char rgb0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -1216,6 +1252,10 @@ const unsigned char rgb0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for servo menu EPD image
*
*/
const unsigned char servo0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -1419,6 +1459,10 @@ const unsigned char servo0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for LDR menu image
*
*/
const unsigned char ldr0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -1622,6 +1666,10 @@ const unsigned char ldr0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for potentiometer menu image
*
*/
const unsigned char pot0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -1825,6 +1873,10 @@ const unsigned char pot0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for temperature menu image
*
*/
const unsigned char temp0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -2028,6 +2080,10 @@ const unsigned char temp0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for relay menu image
*
*/
const unsigned char relay0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -2231,6 +2287,10 @@ const unsigned char relay0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for LED menu image
*
*/
const unsigned char led0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -2434,6 +2494,10 @@ const unsigned char led0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for Infrared LED menu image
*
*/
const unsigned char ir0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -2637,6 +2701,10 @@ const unsigned char ir0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for gyroscope menu image
*
*/
const unsigned char gyro0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -2840,6 +2908,10 @@ const unsigned char gyro0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for compass image
*
*/
const unsigned char compass0[] = {
0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80
,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0
@@ -3043,6 +3115,10 @@ const unsigned char compass0[] = {
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
};
/**
* @brief Data for joystick task image
*
*/
const unsigned char joystick1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -3246,6 +3322,10 @@ const unsigned char joystick1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for sound task image
*
*/
const unsigned char sound1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -3449,6 +3529,10 @@ const unsigned char sound1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for RGB task image
*
*/
const unsigned char rgb1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -3652,6 +3736,10 @@ const unsigned char rgb1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data with servo instructions image
*
*/
const unsigned char servo1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -3855,6 +3943,10 @@ const unsigned char servo1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for servo task image
*
*/
const unsigned char servo2[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -4058,6 +4150,10 @@ const unsigned char servo2[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for LDR task
*
*/
const unsigned char ldr1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -4261,6 +4357,10 @@ const unsigned char ldr1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for potentiometer task image
*
*/
const unsigned char pot1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -4464,6 +4564,10 @@ const unsigned char pot1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for potentiometer clockwise spin
*
*/
const unsigned char potCW[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -4667,6 +4771,10 @@ const unsigned char potCW[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for counter clockwise potentiometer spin
*
*/
const unsigned char potCCW[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -4870,6 +4978,10 @@ const unsigned char potCCW[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for temperature task image
*
*/
const unsigned char temp1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -5073,6 +5185,10 @@ const unsigned char temp1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for relay task image
*
*/
const unsigned char relay1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -5276,6 +5392,10 @@ const unsigned char relay1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for LED task image
*
*/
const unsigned char led1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -5479,6 +5599,10 @@ const unsigned char led1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for infrared task image
*
*/
const unsigned char ir1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -5682,6 +5806,10 @@ const unsigned char ir1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for gyroscope task image
*
*/
const unsigned char gyro1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -5885,6 +6013,11 @@ const unsigned char gyro1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for compass task
* @note Currently not used
*
*/
const unsigned char compass1[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -6088,6 +6221,10 @@ const unsigned char compass1[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for BLE advertisement menu image
*
*/
const unsigned char BleBeacon[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
@@ -6291,6 +6428,10 @@ const unsigned char BleBeacon[]={
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for BLE task image
*
*/
const unsigned char BleBeaconInMeni[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -6494,6 +6635,10 @@ const unsigned char BleBeaconInMeni[]={
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for BLE EPD image menu
*
*/
const unsigned char BleImgEPD[]={
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
@@ -6697,6 +6842,10 @@ const unsigned char BleImgEPD[]={
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/**
* @brief Data for BLE Image EPD task image
*
*/
const unsigned char BleImgEPDInMeni[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -6898,4 +7047,5 @@ const unsigned char BleImgEPDInMeni[]={
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
};
//----------------------------PUBLIC PROTOTYPES -------------------------------
+1
Submodule aconnoSettings added at cc305d3556
-415
View File
@@ -1,415 +0,0 @@
PROJECT_NAME := ble_app_hrs_freertos_pca10040_s132
TARGETS := nrf52832_xxaa
OUTPUT_DIRECTORY := _build
SDK_ROOT := ../../nRF5_SDK_15.2.0
PROJ_DIR := ../
# edit toolchain path
# GNU_INSTALL_ROOT ?= /usr/local/gcc_arm/gcc-arm-none-eabi-8-2018-q4-major/bin/
# GNU_VERSION ?= 8.2.1
# GNU_PREFIX ?= arm-none-eabi
$(OUTPUT_DIRECTORY)/nrf52832_xxaa.out: \
LINKER_SCRIPT := ble_app_hrs_freertos_gcc_nrf52.ld
PROJ_SRC += \
$(PROJ_DIR)/source/main.cpp \
$(PROJ_DIR)/aconnoHelpers/aconnoHelpers.cpp \
$(PROJ_DIR)/tasks/aconnoTasks.cpp \
$(PROJ_DIR)/aconnoBLE/aconnoBLE.cpp \
$(PROJ_DIR)/aconnoBLE/aconnoGAP.cpp \
$(PROJ_DIR)/aconnoBLE/aconnoGATT.cpp \
$(PROJ_DIR)/aconnoBLE/aconnoBLEChar.cpp \
$(PROJ_DIR)/aconnoBLE/aconnoBLEService.cpp \
$(PROJ_DIR)/libs/aconnoGPIO/aconnoGPIO.cpp \
$(PROJ_DIR)/libs/aconnoNordicPAL/aconnoNordicPAL.cpp \
$(PROJ_DIR)/aconnoHelpers/menuStates.cpp \
$(PROJ_DIR)/libs/aconnoI2C/aconnoI2C.cpp \
$(PROJ_DIR)/libs/aconnoSPI/aconnoSPI.cpp \
$(PROJ_DIR)/libs/aconnoPWM/aconnoPWM.cpp \
$(PROJ_DIR)/libs/GDEP015OC1/GDEP015OC1.cpp \
$(PROJ_DIR)/libs/MCP23017/MCP23017.cpp \
$(PROJ_DIR)/libs/LDR/LDR.cpp \
$(PROJ_DIR)/libs/potentiometer/potentiometer.cpp \
$(PROJ_DIR)/libs/MCP9700/MCP9700.cpp \
$(PROJ_DIR)/libs/aconnoSensor/aconnoSensor.cpp \
$(PROJ_DIR)/libs/aconnoSAADC/aconnoSAADC.cpp \
$(PROJ_DIR)/libs/LSM9DS1/LSM9DS1.cpp \
$(PROJ_DIR)/libs/servo/servo.cpp \
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_twi.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_twi.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_twim.c \
$(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 \
$(PROJ_DIR)/libs/aconnoNordicPAL \
$(PROJ_DIR)/config/ \
$(PROJ_DIR)/aconnoHelpers/ \
$(PROJ_DIR)/tasks/ \
$(PROJ_DIR)/aconnoBLE/ \
$(PROJ_DIR)/libs/aconnoI2C \
$(PROJ_DIR)/libs/aconnoSPI \
$(PROJ_DIR)/libs/aconnoPWM \
$(PROJ_DIR)/libs/GDEP015OC1 \
$(PROJ_DIR)/libs/MCP23017 \
$(PROJ_DIR)/libs/MCP9700/ \
$(PROJ_DIR)/libs/LDR/ \
$(PROJ_DIR)/libs/potentiometer/ \
$(PROJ_DIR)/libs/aconnoSensor/ \
$(PROJ_DIR)/libs/aconnoSAADC/ \
$(PROJ_DIR)/libs/LSM9DS1 \
$(PROJ_DIR)/libs/servo/ \
$(PROJ_DIR)/libs/aconnoBeeper \
$(PROJ_DIR)/libs/aconnoPWM \
#$(PROJ_DIR)/BLE/nordicBLE/ \
# Source files common to all targets
SRC_FILES += \
$(PROJ_SRC) \
$(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_nrf52.S \
$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_rtt.c \
$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c \
$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_uart.c \
$(SDK_ROOT)/components/libraries/log/src/nrf_log_default_backends.c \
$(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c \
$(SDK_ROOT)/components/libraries/log/src/nrf_log_str_formatter.c \
$(SDK_ROOT)/components/libraries/button/app_button.c \
$(SDK_ROOT)/components/libraries/util/app_error.c \
$(SDK_ROOT)/components/libraries/util/app_error_handler_gcc.c \
$(SDK_ROOT)/components/libraries/util/app_error_weak.c \
$(SDK_ROOT)/components/libraries/timer/app_timer_freertos.c \
$(SDK_ROOT)/components/libraries/util/app_util_platform.c \
$(SDK_ROOT)/components/libraries/crc16/crc16.c \
$(SDK_ROOT)/components/libraries/fds/fds.c \
$(SDK_ROOT)/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c \
$(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \
$(SDK_ROOT)/components/libraries/util/nrf_assert.c \
$(SDK_ROOT)/components/libraries/atomic_fifo/nrf_atfifo.c \
$(SDK_ROOT)/components/libraries/atomic_flags/nrf_atflags.c \
$(SDK_ROOT)/components/libraries/atomic/nrf_atomic.c \
$(SDK_ROOT)/components/libraries/balloc/nrf_balloc.c \
$(SDK_ROOT)/external/fprintf/nrf_fprintf.c \
$(SDK_ROOT)/external/fprintf/nrf_fprintf_format.c \
$(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage.c \
$(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage_sd.c \
$(SDK_ROOT)/components/libraries/memobj/nrf_memobj.c \
$(SDK_ROOT)/components/libraries/ringbuf/nrf_ringbuf.c \
$(SDK_ROOT)/components/libraries/experimental_section_vars/nrf_section_iter.c \
$(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c \
$(SDK_ROOT)/components/libraries/sensorsim/sensorsim.c \
$(SDK_ROOT)/modules/nrfx/mdk/system_nrf52.c \
$(SDK_ROOT)/external/freertos/source/croutine.c \
$(SDK_ROOT)/external/freertos/source/event_groups.c \
$(SDK_ROOT)/external/freertos/source/portable/MemMang/heap_1.c \
$(SDK_ROOT)/external/freertos/source/list.c \
$(SDK_ROOT)/external/freertos/portable/GCC/nrf52/port.c \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52/port_cmsis.c \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c \
$(SDK_ROOT)/external/freertos/source/queue.c \
$(SDK_ROOT)/external/freertos/source/stream_buffer.c \
$(SDK_ROOT)/external/freertos/source/tasks.c \
$(SDK_ROOT)/external/freertos/source/timers.c \
$(SDK_ROOT)/components/boards/boards.c \
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_clock.c \
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_uart.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_clock.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_gpiote.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_power_clock.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/prs/nrfx_prs.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c \
$(SDK_ROOT)/components/libraries/bsp/bsp.c \
$(SDK_ROOT)/components/libraries/bsp/bsp_btn_ble.c \
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c \
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c \
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c \
$(SDK_ROOT)/components/ble/peer_manager/auth_status_tracker.c \
$(SDK_ROOT)/components/ble/common/ble_advdata.c \
$(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c \
$(SDK_ROOT)/components/ble/common/ble_conn_params.c \
$(SDK_ROOT)/components/ble/common/ble_conn_state.c \
$(SDK_ROOT)/components/ble/common/ble_srv_common.c \
$(SDK_ROOT)/components/ble/peer_manager/gatt_cache_manager.c \
$(SDK_ROOT)/components/ble/peer_manager/gatts_cache_manager.c \
$(SDK_ROOT)/components/ble/peer_manager/id_manager.c \
$(SDK_ROOT)/components/ble/nrf_ble_gatt/nrf_ble_gatt.c \
$(SDK_ROOT)/components/ble/nrf_ble_qwr/nrf_ble_qwr.c \
$(SDK_ROOT)/components/ble/peer_manager/peer_data_storage.c \
$(SDK_ROOT)/components/ble/peer_manager/peer_database.c \
$(SDK_ROOT)/components/ble/peer_manager/peer_id.c \
$(SDK_ROOT)/components/ble/peer_manager/peer_manager.c \
$(SDK_ROOT)/components/ble/peer_manager/peer_manager_handler.c \
$(SDK_ROOT)/components/ble/peer_manager/pm_buffer.c \
$(SDK_ROOT)/components/ble/peer_manager/security_dispatcher.c \
$(SDK_ROOT)/components/ble/peer_manager/security_manager.c \
$(SDK_ROOT)/external/utf_converter/utf.c \
$(SDK_ROOT)/components/ble/ble_services/ble_bas/ble_bas.c \
$(SDK_ROOT)/components/ble/ble_services/ble_dis/ble_dis.c \
$(SDK_ROOT)/components/ble/ble_services/ble_hrs/ble_hrs.c \
$(SDK_ROOT)/components/softdevice/common/nrf_sdh.c \
$(SDK_ROOT)/components/softdevice/common/nrf_sdh_ble.c \
$(SDK_ROOT)/components/softdevice/common/nrf_sdh_freertos.c \
$(SDK_ROOT)/components/softdevice/common/nrf_sdh_soc.c \
# Include folders common to all targets
INC_FOLDERS += \
$(PROJ_INC) \
$(SDK_ROOT)/components/nfc/ndef/generic/message \
$(SDK_ROOT)/components/nfc/t2t_lib \
$(SDK_ROOT)/components/nfc/t4t_parser/hl_detection_procedure \
$(SDK_ROOT)/components/ble/ble_services/ble_ancs_c \
$(SDK_ROOT)/components/ble/ble_services/ble_ias_c \
$(SDK_ROOT)/components/libraries/pwm \
$(SDK_ROOT)/components/softdevice/s132/headers/nrf52 \
$(SDK_ROOT)/components/libraries/usbd/class/cdc/acm \
$(SDK_ROOT)/components/libraries/usbd/class/hid/generic \
$(SDK_ROOT)/components/libraries/usbd/class/msc \
$(SDK_ROOT)/components/libraries/usbd/class/hid \
$(SDK_ROOT)/modules/nrfx/hal \
$(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/le_oob_rec_parser \
$(SDK_ROOT)/components/libraries/log \
$(SDK_ROOT)/components/ble/ble_services/ble_gls \
$(SDK_ROOT)/components/libraries/fstorage \
$(SDK_ROOT)/components/nfc/ndef/text \
$(SDK_ROOT)/components/libraries/mutex \
$(SDK_ROOT)/components/libraries/gpiote \
$(SDK_ROOT)/components/libraries/bootloader/ble_dfu \
$(SDK_ROOT)/components/nfc/ndef/connection_handover/common \
$(SDK_ROOT)/components/boards \
$(SDK_ROOT)/components/nfc/ndef/generic/record \
$(SDK_ROOT)/components/nfc/t4t_parser/cc_file \
$(SDK_ROOT)/components/ble/ble_advertising \
$(SDK_ROOT)/external/utf_converter \
$(SDK_ROOT)/components/ble/ble_services/ble_bas_c \
$(SDK_ROOT)/modules/nrfx/drivers/include \
$(SDK_ROOT)/components/libraries/experimental_task_manager \
$(SDK_ROOT)/components/ble/ble_services/ble_hrs_c \
$(SDK_ROOT)/components/nfc/ndef/connection_handover/le_oob_rec \
$(SDK_ROOT)/components/libraries/queue \
$(SDK_ROOT)/components/libraries/pwr_mgmt \
$(SDK_ROOT)/external/freertos/portable/GCC/nrf52 \
$(SDK_ROOT)/components/ble/ble_dtm \
$(SDK_ROOT)/components/toolchain/cmsis/include \
$(SDK_ROOT)/components/ble/ble_services/ble_rscs_c \
$(SDK_ROOT)/components/ble/common \
$(SDK_ROOT)/components/ble/ble_services/ble_lls \
$(SDK_ROOT)/components/libraries/hardfault/nrf52 \
$(SDK_ROOT)/components/libraries/bsp \
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ac_rec \
$(SDK_ROOT)/components/ble/ble_services/ble_bas \
$(SDK_ROOT)/components/libraries/mpu \
$(SDK_ROOT)/components/libraries/experimental_section_vars \
$(SDK_ROOT)/components/softdevice/s132/headers \
$(SDK_ROOT)/components/ble/ble_services/ble_ans_c \
$(SDK_ROOT)/components/libraries/slip \
$(SDK_ROOT)/components/libraries/delay \
$(SDK_ROOT)/components/libraries/mem_manager \
$(SDK_ROOT)/components/libraries/csense_drv \
$(SDK_ROOT)/components/libraries/memobj \
$(SDK_ROOT)/components/ble/ble_services/ble_nus_c \
$(SDK_ROOT)/components/softdevice/common \
$(SDK_ROOT)/components/ble/ble_services/ble_ias \
$(SDK_ROOT)/components/libraries/usbd/class/hid/mouse \
$(SDK_ROOT)/components/libraries/low_power_pwm \
$(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/ble_oob_advdata_parser \
$(SDK_ROOT)/components/ble/ble_services/ble_dfu \
$(SDK_ROOT)/external/fprintf \
$(SDK_ROOT)/components/libraries/svc \
$(SDK_ROOT)/components/libraries/atomic \
$(SDK_ROOT)/components \
$(SDK_ROOT)/components/libraries/scheduler \
$(SDK_ROOT)/components/libraries/cli \
$(SDK_ROOT)/components/ble/ble_services/ble_lbs \
$(SDK_ROOT)/components/ble/ble_services/ble_hts \
$(SDK_ROOT)/components/libraries/crc16 \
$(SDK_ROOT)/components/nfc/t4t_parser/apdu \
$(SDK_ROOT)/external/freertos/config \
$(SDK_ROOT)/components/libraries/util \
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52 \
../config \
$(SDK_ROOT)/components/libraries/usbd/class/cdc \
$(SDK_ROOT)/components/libraries/csense \
$(SDK_ROOT)/components/libraries/balloc \
$(SDK_ROOT)/components/libraries/ecc \
$(SDK_ROOT)/components/libraries/hardfault \
$(SDK_ROOT)/components/ble/ble_services/ble_cscs \
$(SDK_ROOT)/components/libraries/hci \
$(SDK_ROOT)/components/libraries/usbd/class/hid/kbd \
$(SDK_ROOT)/components/libraries/timer \
$(SDK_ROOT)/integration/nrfx \
$(SDK_ROOT)/components/nfc/t4t_parser/tlv \
$(SDK_ROOT)/components/libraries/sortlist \
$(SDK_ROOT)/components/libraries/spi_mngr \
$(SDK_ROOT)/components/libraries/led_softblink \
$(SDK_ROOT)/components/nfc/ndef/conn_hand_parser \
$(SDK_ROOT)/components/libraries/sdcard \
$(SDK_ROOT)/components/nfc/ndef/parser/record \
$(SDK_ROOT)/modules/nrfx/mdk \
$(SDK_ROOT)/components/ble/ble_services/ble_cts_c \
$(SDK_ROOT)/components/ble/ble_services/ble_nus \
$(SDK_ROOT)/components/libraries/twi_mngr \
$(SDK_ROOT)/components/ble/ble_services/ble_hids \
$(SDK_ROOT)/components/libraries/strerror \
$(SDK_ROOT)/components/libraries/crc32 \
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_oob_advdata \
$(SDK_ROOT)/components/nfc/t2t_parser \
$(SDK_ROOT)/external/freertos/source/include \
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_pair_msg \
$(SDK_ROOT)/components/libraries/usbd/class/audio \
$(SDK_ROOT)/components/nfc/t4t_lib/hal_t4t \
$(SDK_ROOT)/components/libraries/sensorsim \
$(SDK_ROOT)/components/nfc/t4t_lib \
$(SDK_ROOT)/components/ble/peer_manager \
$(SDK_ROOT)/components/drivers_nrf/usbd \
$(SDK_ROOT)/components/libraries/ringbuf \
$(SDK_ROOT)/components/ble/ble_services/ble_tps \
$(SDK_ROOT)/components/nfc/ndef/parser/message \
$(SDK_ROOT)/components/ble/ble_services/ble_dis \
$(SDK_ROOT)/components/nfc/ndef/uri \
$(SDK_ROOT)/components/ble/nrf_ble_gatt \
$(SDK_ROOT)/components/ble/nrf_ble_qwr \
$(SDK_ROOT)/components/libraries/gfx \
$(SDK_ROOT)/components/libraries/button \
$(SDK_ROOT)/modules/nrfx \
$(SDK_ROOT)/components/libraries/twi_sensor \
$(SDK_ROOT)/integration/nrfx/legacy \
$(SDK_ROOT)/components/libraries/usbd \
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ep_oob_rec \
$(SDK_ROOT)/external/segger_rtt \
$(SDK_ROOT)/components/libraries/atomic_fifo \
$(SDK_ROOT)/components/ble/ble_services/ble_lbs_c \
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_pair_lib \
$(SDK_ROOT)/components/libraries/crypto \
$(SDK_ROOT)/components/ble/ble_racp \
$(SDK_ROOT)/components/libraries/fds \
$(SDK_ROOT)/components/nfc/ndef/launchapp \
$(SDK_ROOT)/components/libraries/atomic_flags \
$(SDK_ROOT)/components/ble/ble_services/ble_hrs \
$(SDK_ROOT)/components/ble/ble_services/ble_rscs \
$(SDK_ROOT)/components/nfc/ndef/connection_handover/hs_rec \
$(SDK_ROOT)/components/nfc/t2t_lib/hal_t2t \
$(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/ac_rec_parser \
$(SDK_ROOT)/components/libraries/stack_guard \
$(SDK_ROOT)/components/libraries/log/src \
# Libraries common to all targets
LIB_FILES += \
# Optimization flags
OPT = -O3 -g3
# Uncomment the line below to enable link time optimization
#OPT += -flto
# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBOARD_PCA10040
#CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DFREERTOS
CFLAGS += -DNRF52
CFLAGS += -DNRF52832_XXAA
CFLAGS += -DNRF52_PAN_74
CFLAGS += -DNRF_SD_BLE_API_VERSION=6
CFLAGS += -DS132
CFLAGS += -DSOFTDEVICE_PRESENT
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += -Wall
#CFLAGS += -Werror
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in a separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin -fshort-enums
CFLAGS += -DDEBUG
# C++ flags common to all targets
CXXFLAGS += $(OPT)
CXXFLAGS += -DDEBUG
# Assembler flags common to all targets
ASMFLAGS += -g3
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DBOARD_PCA10040
#ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
ASMFLAGS += -DFLOAT_ABI_HARD
ASMFLAGS += -DFREERTOS
ASMFLAGS += -DNRF52
ASMFLAGS += -DNRF52832_XXAA
ASMFLAGS += -DNRF52_PAN_74
ASMFLAGS += -DNRF_SD_BLE_API_VERSION=6
ASMFLAGS += -DS132
ASMFLAGS += -DSOFTDEVICE_PRESENT
# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += --specs=nano.specs
nrf52832_xxaa: CFLAGS += -D__HEAP_SIZE=1024
nrf52832_xxaa: CFLAGS += -D__STACK_SIZE=2048
nrf52832_xxaa: ASMFLAGS += -D__HEAP_SIZE=1024
nrf52832_xxaa: ASMFLAGS += -D__STACK_SIZE=2048
# Add standard libraries at the very end of the linker input, after all objects
# that may need symbols provided by these libraries.
LIB_FILES += -lc -lnosys -lm -lstdc++
.PHONY: default help
# Default target - first one defined
default: nrf52832_xxaa
# Print all targets that can be built
help:
@echo following targets are available:
@echo nrf52832_xxaa
@echo flash_softdevice
@echo sdk_config - starting external tool for editing sdk_config.h
@echo flash - flashing binary
TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
include $(TEMPLATE_PATH)/Makefile.common
$(foreach target, $(TARGETS), $(call define_target, $(target)))
.PHONY: flash flash_softdevice erase
# Flash the program
flash: default
@echo Flashing: $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex
nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex --sectorerase
nrfjprog -f nrf52 --reset
# Flash softdevice
flash_softdevice:
@echo Flashing: s132_nrf52_6.1.0_softdevice.hex
nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_6.1.0_softdevice.hex --sectorerase
nrfjprog -f nrf52 --reset
erase:
nrfjprog -f nrf52 --eraseall
SDK_CONFIG_FILE := ../config/sdk_config.h
CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
sdk_config:
java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -63,7 +63,7 @@
#define configTICK_RATE_HZ 1024
#define configMAX_PRIORITIES (3)
#define configMINIMAL_STACK_SIZE (60)
#define configTOTAL_HEAP_SIZE (5*4096)
#define configTOTAL_HEAP_SIZE (6*4096)
#define configMAX_TASK_NAME_LEN (4)
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
+14 -12
View File
@@ -8,10 +8,12 @@
* @copyright Copyright (c) 2019
*
*/
#ifndef __ACONNO_CONFIG_H__
#define __ACONNO_CONFIG_H__
//------------------------------ INCLUDES -------------------------------------
//----------------------------- DATA TYPES ------------------------------------
//-------------------------- CONSTANTS & MACROS -------------------------------
/**< BLE advertisement packet information */
#define MSD_ID (0xFF)
#define NORDIC_UUID (0x0059)
#define ACONNO_UUID (0x69)
@@ -19,14 +21,10 @@
#define SETTINGS_SUPPORT_FLAG (0b0)
#define PRODUCT_VERSION (0x00)
#define FIRST_ADV_TYPE_ID (0x00)
/**< Application's BLE observer priority. You shouldn't need to modify this value. */
#define APP_BLE_OBSERVER_PRIO 3
/**< A tag identifying the SoftDevice BLE configuration. */
#define APP_BLE_CONN_CFG_TAG 1
/**< The advertising interval (in units of 0.625 ms). */
#define APP_ADV_INTERVAL 100
/**< The advertising duration in units of 10 milliseconds. */
@@ -35,7 +33,6 @@
#define BLE_EX_CHAR_UUID (0xA000)
/**< BLE example characteristic size in B. */
#define BLE_EX_CHAR_SIZE_B (500)
/**< Time from initiating event (connect or start of notification)
* to first time sd_ble_gap_conn_param_update is called (5 seconds). */
#define FIRST_CONN_PARAMS_UPDATE_DELAY 5000
@@ -44,7 +41,6 @@
#define NEXT_CONN_PARAMS_UPDATE_DELAY 30000
/**< Number of attempts before giving up the connection parameter negotiation.*/
#define MAX_CONN_PARAMS_UPDATE_COUNT 3
/**< Perform bonding. */
#define SEC_PARAM_BOND 1
/**< Man In The Middle protection not required. */
@@ -61,15 +57,21 @@
#define SEC_PARAM_MIN_KEY_SIZE 7
/**< Maximum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE 16
/**< Value used as error code on stack dump, can be used to identify
* stack location on stack unwind. */
#define DEAD_BEEF 0xDEADBEEF
/**< BLE Beacon packet information */
#define APPLICATION_ID (0xCF170059)
#define FIRST_PACKET_ID (0x00)
#define SECOND_PACKET_ID (0x01)
#define MAX_ADV_PACKET_LENGTH (31)
#endif // __ACONNO_CONFIG_H__
/**< Stack depth for freeRtos tasks in words, not bytes*/
#define TASK_STACK_DEPTH(A) (A)
/**< Task priority for freeRtos tasks, higher number means higher priority */
#define TASK_PRIORITY(A) (A)
/**< Default parametres to a freertos task */
#define DEFAULT_TASK_PARAMETERS NULL
/**< Pwm instance id. Instance number should be supported by PAL */
#define PWM_INSTANCE_ID(A) (A)
//----------------------------PUBLIC PROTOTYPES -------------------------------
#endif // __ACONNO_CONFIG_H__
+5 -5
View File
@@ -11,9 +11,9 @@
#ifndef __ACONNO_PAL_CONFIG_H__
#define __ACONNO_PAL_CONFIG_H__
//------------------------------ INCLUDES -------------------------------------
#include "aconnoNordicPAL.h"
#endif // __ACONNO_PAL_CONFIG_H__
//----------------------------- DATA TYPES ------------------------------------
//-------------------------- CONSTANTS & MACROS -------------------------------
//----------------------------PUBLIC PROTOTYPES -------------------------------
#endif // __ACONNO_PAL_CONFIG_H__
+24
View File
@@ -0,0 +1,24 @@
$(PROJ_DIR)/config
$(PROJ_DIR)/aconnoHelpers/
$(PROJ_DIR)/tasks/
$(PROJ_DIR)/aconnoBLE/
$(PROJ_DIR)/aconnoSettings/
$(PROJ_DIR)/libs/aconnoGPIO
$(PROJ_DIR)/libs/aconnoNordicPAL
$(PROJ_DIR)/libs/aconnoLog
$(PROJ_DIR)/states/
$(PROJ_DIR)/source/
$(PROJ_DIR)/libs/aconnoI2C
$(PROJ_DIR)/libs/aconnoSPI
$(PROJ_DIR)/libs/aconnoPWM
$(PROJ_DIR)/libs/GDEP015OC1
$(PROJ_DIR)/libs/MCP23017
$(PROJ_DIR)/libs/MCP9700/
$(PROJ_DIR)/libs/LDR/
$(PROJ_DIR)/libs/potentiometer/
$(PROJ_DIR)/libs/aconnoSensor/
$(PROJ_DIR)/libs/aconnoSAADC/
$(PROJ_DIR)/libs/LSM9DS1
$(PROJ_DIR)/libs/servo/
$(PROJ_DIR)/libs/aconnoBeeper
$(PROJ_DIR)/libs/aconnoPWM
+33
View File
@@ -0,0 +1,33 @@
$(PROJ_DIR)/aconnoBLE/aconnoBLEService.cpp
$(PROJ_DIR)/aconnoBLE/aconnoBLEChar.cpp
$(PROJ_DIR)/aconnoBLE/aconnoDFU.cpp
$(PROJ_DIR)/aconnoBLE/advPayload.cpp
$(PROJ_DIR)/aconnoSettings/settings.cpp
$(PROJ_DIR)/aconnoSettings/configParams.cpp
$(PROJ_DIR)/aconnoSettings/basicConfig.cpp
$(PROJ_DIR)/aconnoSettings/arbData.cpp
$(PROJ_DIR)/aconnoSettings/slots.cpp
$(PROJ_DIR)/libs/aconnoGPIO/aconnoGPIO.cpp
$(PROJ_DIR)/libs/aconnoNordicPAL/aconnoNordicPAL.cpp
$(PROJ_DIR)/libs/aconnoLog/aconnoLog.cpp
$(PROJ_DIR)/source/main.cpp
$(PROJ_DIR)/aconnoHelpers/aconnoHelpers.cpp
$(PROJ_DIR)/tasks/aconnoTasks.cpp
$(PROJ_DIR)/aconnoBLE/aconnoBLE.cpp
$(PROJ_DIR)/aconnoBLE/aconnoGAP.cpp
$(PROJ_DIR)/aconnoBLE/aconnoGATT.cpp
$(PROJ_DIR)/states/states.cpp
$(PROJ_DIR)/libs/aconnoI2C/aconnoI2C.cpp
$(PROJ_DIR)/libs/aconnoSPI/aconnoSPI.cpp
$(PROJ_DIR)/libs/aconnoPWM/aconnoPWM.cpp
$(PROJ_DIR)/libs/GDEP015OC1/GDEP015OC1.cpp
$(PROJ_DIR)/libs/MCP23017/MCP23017.cpp
$(PROJ_DIR)/libs/LDR/LDR.cpp
$(PROJ_DIR)/libs/potentiometer/potentiometer.cpp
$(PROJ_DIR)/libs/MCP9700/MCP9700.cpp
$(PROJ_DIR)/libs/aconnoSensor/aconnoSensor.cpp
$(PROJ_DIR)/libs/aconnoSAADC/aconnoSAADC.cpp
$(PROJ_DIR)/libs/LSM9DS1/LSM9DS1.cpp
$(PROJ_DIR)/libs/servo/servo.cpp
$(PROJ_DIR)/libs/aconnoBeeper/aconnoBeeper.cpp
$(PROJ_DIR)/libs/aconnoPWM/aconnoPWM.cpp
+138
View File
@@ -0,0 +1,138 @@
$(SDK_ROOT)/components/nfc/ndef/generic/message
$(SDK_ROOT)/components/nfc/t2t_lib
$(SDK_ROOT)/components/nfc/t4t_parser/hl_detection_procedure
$(SDK_ROOT)/components/ble/ble_services/ble_ancs_c
$(SDK_ROOT)/components/ble/ble_services/ble_ias_c
$(SDK_ROOT)/components/libraries/pwm
$(SDK_ROOT)/components/libraries/usbd/class/cdc/acm
$(SDK_ROOT)/components/libraries/usbd/class/hid/generic
$(SDK_ROOT)/components/libraries/usbd/class/msc
$(SDK_ROOT)/components/libraries/usbd/class/hid
$(SDK_ROOT)/modules/nrfx/hal
$(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/le_oob_rec_parser
$(SDK_ROOT)/components/libraries/log
$(SDK_ROOT)/components/ble/ble_services/ble_gls
$(SDK_ROOT)/components/libraries/fstorage
$(SDK_ROOT)/components/nfc/ndef/text
$(SDK_ROOT)/components/libraries/mutex
$(SDK_ROOT)/components/libraries/gpiote
$(SDK_ROOT)/components/libraries/bootloader/ble_dfu
$(SDK_ROOT)/components/nfc/ndef/connection_handover/common
$(SDK_ROOT)/components/boards
$(SDK_ROOT)/components/nfc/ndef/generic/record
$(SDK_ROOT)/components/nfc/t4t_parser/cc_file
$(SDK_ROOT)/components/ble/ble_advertising
$(SDK_ROOT)/external/utf_converter
$(SDK_ROOT)/components/ble/ble_services/ble_bas_c
$(SDK_ROOT)/modules/nrfx/drivers/include
$(SDK_ROOT)/components/libraries/experimental_task_manager
$(SDK_ROOT)/components/ble/ble_services/ble_hrs_c
$(SDK_ROOT)/components/nfc/ndef/connection_handover/le_oob_rec
$(SDK_ROOT)/components/libraries/queue
$(SDK_ROOT)/components/libraries/pwr_mgmt
$(SDK_ROOT)/external/freertos/portable/GCC/nrf52
$(SDK_ROOT)/components/ble/ble_dtm
$(SDK_ROOT)/components/toolchain/cmsis/include
$(SDK_ROOT)/components/ble/ble_services/ble_rscs_c
$(SDK_ROOT)/components/ble/common
$(SDK_ROOT)/components/ble/ble_services/ble_lls
$(SDK_ROOT)/components/libraries/hardfault/nrf52
$(SDK_ROOT)/components/libraries/bsp
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ac_rec
$(SDK_ROOT)/components/ble/ble_services/ble_bas
$(SDK_ROOT)/components/libraries/mpu
$(SDK_ROOT)/components/libraries/experimental_section_vars
$(SDK_ROOT)/components/ble/ble_services/ble_ans_c
$(SDK_ROOT)/components/libraries/slip
$(SDK_ROOT)/components/libraries/delay
$(SDK_ROOT)/components/libraries/mem_manager
$(SDK_ROOT)/components/libraries/csense_drv
$(SDK_ROOT)/components/libraries/memobj
$(SDK_ROOT)/components/ble/ble_services/ble_nus_c
$(SDK_ROOT)/components/softdevice/common
$(SDK_ROOT)/components/ble/ble_services/ble_ias
$(SDK_ROOT)/components/libraries/usbd/class/hid/mouse
$(SDK_ROOT)/components/libraries/low_power_pwm
$(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/ble_oob_advdata_parser
$(SDK_ROOT)/components/ble/ble_services/ble_dfu
$(SDK_ROOT)/external/fprintf
$(SDK_ROOT)/components/libraries/svc
$(SDK_ROOT)/components/libraries/atomic
$(SDK_ROOT)/components
$(SDK_ROOT)/components/libraries/scheduler
$(SDK_ROOT)/components/libraries/cli
$(SDK_ROOT)/components/ble/ble_services/ble_lbs
$(SDK_ROOT)/components/ble/ble_services/ble_hts
$(SDK_ROOT)/components/libraries/crc16
$(SDK_ROOT)/components/nfc/t4t_parser/apdu
$(SDK_ROOT)/external/freertos/config
$(SDK_ROOT)/components/libraries/util
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52
$(SDK_ROOT)/components/libraries/usbd/class/cdc
$(SDK_ROOT)/components/libraries/csense
$(SDK_ROOT)/components/libraries/balloc
$(SDK_ROOT)/components/libraries/ecc
$(SDK_ROOT)/components/libraries/hardfault
$(SDK_ROOT)/components/ble/ble_services/ble_cscs
$(SDK_ROOT)/components/libraries/hci
$(SDK_ROOT)/components/libraries/usbd/class/hid/kbd
$(SDK_ROOT)/components/libraries/timer
$(SDK_ROOT)/integration/nrfx
$(SDK_ROOT)/components/nfc/t4t_parser/tlv
$(SDK_ROOT)/components/libraries/sortlist
$(SDK_ROOT)/components/libraries/spi_mngr
$(SDK_ROOT)/components/libraries/led_softblink
$(SDK_ROOT)/components/nfc/ndef/conn_hand_parser
$(SDK_ROOT)/components/libraries/sdcard
$(SDK_ROOT)/components/nfc/ndef/parser/record
$(SDK_ROOT)/modules/nrfx/mdk
$(SDK_ROOT)/components/ble/ble_services/ble_cts_c
$(SDK_ROOT)/components/ble/ble_services/ble_nus
$(SDK_ROOT)/components/libraries/twi_mngr
$(SDK_ROOT)/components/ble/ble_services/ble_hids
$(SDK_ROOT)/components/libraries/strerror
$(SDK_ROOT)/components/libraries/crc32
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_oob_advdata
$(SDK_ROOT)/components/nfc/t2t_parser
$(SDK_ROOT)/external/freertos/source/include
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_pair_msg
$(SDK_ROOT)/components/libraries/usbd/class/audio
$(SDK_ROOT)/components/nfc/t4t_lib/hal_t4t
$(SDK_ROOT)/components/libraries/sensorsim
$(SDK_ROOT)/components/nfc/t4t_lib
$(SDK_ROOT)/components/ble/peer_manager
$(SDK_ROOT)/components/drivers_nrf/usbd
$(SDK_ROOT)/components/libraries/ringbuf
$(SDK_ROOT)/components/ble/ble_services/ble_tps
$(SDK_ROOT)/components/nfc/ndef/parser/message
$(SDK_ROOT)/components/ble/ble_services/ble_dis
$(SDK_ROOT)/components/nfc/ndef/uri
$(SDK_ROOT)/components/ble/nrf_ble_gatt
$(SDK_ROOT)/components/ble/nrf_ble_qwr
$(SDK_ROOT)/components/libraries/gfx
$(SDK_ROOT)/components/libraries/button
$(SDK_ROOT)/modules/nrfx
$(SDK_ROOT)/components/libraries/twi_sensor
$(SDK_ROOT)/integration/nrfx/legacy
$(SDK_ROOT)/components/libraries/usbd
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ep_oob_rec
$(SDK_ROOT)/external/segger_rtt
$(SDK_ROOT)/components/libraries/atomic_fifo
$(SDK_ROOT)/components/ble/ble_services/ble_lbs_c
$(SDK_ROOT)/components/nfc/ndef/connection_handover/ble_pair_lib
$(SDK_ROOT)/components/libraries/crypto
$(SDK_ROOT)/components/ble/ble_racp
$(SDK_ROOT)/components/libraries/fds
$(SDK_ROOT)/components/nfc/ndef/launchapp
$(SDK_ROOT)/components/libraries/atomic_flags
$(SDK_ROOT)/components/ble/ble_services/ble_hrs
$(SDK_ROOT)/components/ble/ble_services/ble_rscs
$(SDK_ROOT)/components/nfc/ndef/connection_handover/hs_rec
$(SDK_ROOT)/components/nfc/t2t_lib/hal_t2t
$(SDK_ROOT)/components/nfc/ndef/conn_hand_parser/ac_rec_parser
$(SDK_ROOT)/components/libraries/stack_guard
$(SDK_ROOT)/components/libraries/log/src
$(SDK_ROOT)/components/libraries/bootloader
$(SDK_ROOT)/components/libraries/bootloader/ble_dfu
$(SDK_ROOT)/components/libraries/bootloader/dfu
$(SDK_ROOT)/components/ble/ble_services/ble_dfu/
+98
View File
@@ -0,0 +1,98 @@
$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_rtt.c
$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_serial.c
$(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_uart.c
$(SDK_ROOT)/components/libraries/log/src/nrf_log_default_backends.c
$(SDK_ROOT)/components/libraries/log/src/nrf_log_frontend.c
$(SDK_ROOT)/components/libraries/log/src/nrf_log_str_formatter.c
$(SDK_ROOT)/components/libraries/button/app_button.c
$(SDK_ROOT)/components/libraries/util/app_error.c
$(SDK_ROOT)/components/libraries/util/app_error_handler_gcc.c
$(SDK_ROOT)/components/libraries/util/app_error_weak.c
$(SDK_ROOT)/components/libraries/timer/app_timer_freertos.c
$(SDK_ROOT)/components/libraries/util/app_util_platform.c
$(SDK_ROOT)/components/libraries/crc16/crc16.c
$(SDK_ROOT)/components/libraries/fds/fds.c
$(SDK_ROOT)/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c
$(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c
$(SDK_ROOT)/components/libraries/util/nrf_assert.c
$(SDK_ROOT)/components/libraries/atomic_fifo/nrf_atfifo.c
$(SDK_ROOT)/components/libraries/atomic_flags/nrf_atflags.c
$(SDK_ROOT)/components/libraries/atomic/nrf_atomic.c
$(SDK_ROOT)/components/libraries/balloc/nrf_balloc.c
$(SDK_ROOT)/external/fprintf/nrf_fprintf.c
$(SDK_ROOT)/external/fprintf/nrf_fprintf_format.c
$(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage.c
$(SDK_ROOT)/components/libraries/fstorage/nrf_fstorage_sd.c
$(SDK_ROOT)/components/libraries/memobj/nrf_memobj.c
$(SDK_ROOT)/components/libraries/ringbuf/nrf_ringbuf.c
$(SDK_ROOT)/components/libraries/experimental_section_vars/nrf_section_iter.c
$(SDK_ROOT)/components/libraries/strerror/nrf_strerror.c
$(SDK_ROOT)/components/libraries/sensorsim/sensorsim.c
$(SDK_ROOT)/external/freertos/source/croutine.c
$(SDK_ROOT)/external/freertos/source/event_groups.c
$(SDK_ROOT)/external/freertos/source/portable/MemMang/heap_1.c
$(SDK_ROOT)/external/freertos/source/list.c
$(SDK_ROOT)/external/freertos/portable/GCC/nrf52/port.c
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52/port_cmsis.c
$(SDK_ROOT)/external/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c
$(SDK_ROOT)/external/freertos/source/queue.c
$(SDK_ROOT)/external/freertos/source/stream_buffer.c
$(SDK_ROOT)/external/freertos/source/tasks.c
$(SDK_ROOT)/external/freertos/source/timers.c
$(SDK_ROOT)/components/boards/boards.c
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_clock.c
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_uart.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_clock.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_gpiote.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_power_clock.c
$(SDK_ROOT)/modules/nrfx/drivers/src/prs/nrfx_prs.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uart.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_uarte.c
$(SDK_ROOT)/components/libraries/bsp/bsp.c
$(SDK_ROOT)/components/libraries/bsp/bsp_btn_ble.c
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c
$(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c
$(SDK_ROOT)/components/ble/peer_manager/auth_status_tracker.c
$(SDK_ROOT)/components/ble/common/ble_advdata.c
$(SDK_ROOT)/components/ble/ble_advertising/ble_advertising.c
$(SDK_ROOT)/components/ble/common/ble_conn_params.c
$(SDK_ROOT)/components/ble/common/ble_conn_state.c
$(SDK_ROOT)/components/ble/common/ble_srv_common.c
$(SDK_ROOT)/components/ble/peer_manager/gatt_cache_manager.c
$(SDK_ROOT)/components/ble/peer_manager/gatts_cache_manager.c
$(SDK_ROOT)/components/ble/peer_manager/id_manager.c
$(SDK_ROOT)/components/ble/nrf_ble_gatt/nrf_ble_gatt.c
$(SDK_ROOT)/components/ble/nrf_ble_qwr/nrf_ble_qwr.c
$(SDK_ROOT)/components/ble/peer_manager/peer_data_storage.c
$(SDK_ROOT)/components/ble/peer_manager/peer_database.c
$(SDK_ROOT)/components/ble/peer_manager/peer_id.c
$(SDK_ROOT)/components/ble/peer_manager/peer_manager.c
$(SDK_ROOT)/components/ble/peer_manager/peer_manager_handler.c
$(SDK_ROOT)/components/ble/peer_manager/pm_buffer.c
$(SDK_ROOT)/components/ble/peer_manager/security_dispatcher.c
$(SDK_ROOT)/components/ble/peer_manager/security_manager.c
$(SDK_ROOT)/external/utf_converter/utf.c
$(SDK_ROOT)/components/ble/ble_services/ble_bas/ble_bas.c
$(SDK_ROOT)/components/ble/ble_services/ble_dis/ble_dis.c
$(SDK_ROOT)/components/ble/ble_services/ble_hrs/ble_hrs.c
$(SDK_ROOT)/components/softdevice/common/nrf_sdh.c
$(SDK_ROOT)/components/softdevice/common/nrf_sdh_ble.c
$(SDK_ROOT)/components/softdevice/common/nrf_sdh_freertos.c
$(SDK_ROOT)/components/softdevice/common/nrf_sdh_soc.c
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_twi.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_twi.c
$(SDK_ROOT)/components/libraries/pwm/app_pwm.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_gpiote.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_ppi.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_timer.c
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_ppi.c
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_pwm.c
$(SDK_ROOT)/components/ble/ble_services/ble_dfu/ble_dfu.c
$(SDK_ROOT)/components/ble/ble_services/ble_dfu/ble_dfu_bonded.c
$(SDK_ROOT)/components/ble/ble_services/ble_dfu/ble_dfu_unbonded.c
$(SDK_ROOT)/components/libraries/bootloader/dfu/nrf_dfu_svci.c
$(SDK_ROOT)/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c
$(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
+1
Submodule libs/aconnoLog added at 938bdd3b64
-10
View File
@@ -1,10 +0,0 @@
/**
* @file aconnoLog.cpp
* @author Jurica Resetar (Jurica@aconno.de)
* @brief
* @version 0.1
* @date 2019-01-22
*
* @copyright Copyright (c) 2019
*
*/
-17
View File
@@ -1,17 +0,0 @@
/**
* @file aconnoLog.h
* @author Jurica Resetar (Jurica@aconno.de)
* @brief
* @version 0.1
* @date 2019-01-22
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __ACONNO_LOG_H__
#define __ACONNO_LOG_H__
#endif // __ACONNO_LOG_H__
Submodule libs/aconnoPWM updated: 9b6bd8c468...989dccb03c
Submodule libs/aconnoSAADC updated: d2ddb76505...85bd63ed13
Submodule libs/aconnoSensor updated: cbdd172fb6...fa552a2931
+66 -73
View File
@@ -8,7 +8,9 @@
* @copyright Copyright (c) 2019
*
*/
#ifndef __ACD_52832_BSP_H__
#define __ACD_52832_BSP_H__
//------------------------------ INCLUDES -------------------------------------
/** Communication headers */
#include "aconnoSPI.h"
#include "aconnoI2C.h"
@@ -27,75 +29,71 @@
/** Ambient temperature header */
#include "MCP9700.h"
/** Menu states header */
#include "menuStates.h"
#include "states.h"
/** iNEMO inertial module header*/
#include "LSM9DS1.h"
/** Servo header */
#include "servo.h"
/**
* @defgroup PIN_GROUP
* @note General IO pins
* @{
*/
#define PIN_BUTTON (25) /**< SW1 gpio number (Active low) */
#define PIN_LED (26) /**< LD1 gpio number (Active low) */
#define PIN_IRLED (27) /**< LD4 gpio number (Active high) */
#define PIN_BUZZER (31) /**< LS1 gpio number (Active high) */
#define PIN_LED_RED (22) /**< Module red LED */
#define PIN_LED_BLUE (23) /**< Module blue LED */
#define PIN_LED_GREEN (24) /**< Module green LED */
//----------------------------- DATA TYPES ------------------------------------
//-------------------------- CONSTANTS & MACROS -------------------------------
/**< SW1 gpio number (Active low) */
#define PIN_BUTTON (25)
/**< LD1 gpio number (Active low) */
#define PIN_LED (26)
/**< LD4 gpio number (Active high) */
#define PIN_IRLED (27)
/**< LS1 gpio number (Active high) */
#define PIN_BUZZER (31)
/**< Module red LED */
#define PIN_LED_RED (22)
/**< Module blue LED */
#define PIN_LED_BLUE (23)
/**< Module green LED */
#define PIN_LED_GREEN (24)
/** Alternate General IO pins */
#define PIN_SERVO1 (25) /**< Servo1 gpio number */
#define PIN_SERVO2 (26) /**< Servo2 gpio number */
/** @} */
/**< Servo1 gpio number */
#define PIN_SERVO1 (25)
/**< Servo2 gpio number */
#define PIN_SERVO2 (26)
/**
* @defgroup ADC_GROUP
* @note Analog to Digital Conversion (ADC) pins
* @{
*/
#define ADC_BAT (2) /**< Battery */
#define ADC_POT (5) /**< Potentiometer */
#define ADC_LIGHT (6) /**< Light Dependant Resistor */
#define ADC_TEMP (7) /**< Temperature Dependant Resistor */
/** @} */
/**< Battery */
#define ADC_BAT (2)
/**< Potentiometer */
#define ADC_POT (5)
/**< Light Dependant Resistor */
#define ADC_LIGHT (6)
/**< Temperature Dependant Resistor */
#define ADC_TEMP (7)
/**
* @defgroup PIN_EPD_GROUP
* @note Electronic Paper Display (EPD) pins
* @{
*/
#define PIN_EPD_CS (5) /**< EPD Chip select pin (Active low) */
#define PIN_EPD_DC (6) /**< EPD Data/Command pin (Data active high) */
#define PIN_EPD_RST (7) /**< EPD Reset pin (Active low) */
#define PIN_EPD_BUSY (8) /**< EPD Busy pin (Active low) */
#define PIN_EPD_SCK (4) /**< EPD SCK pin */
#define PIN_EPD_MOSI (3) /**< EPD MOSI pin */
#define PIN_EPD_MISO (0xFF) /**< EPD MISO pin not used */
/** @} */
/**< EPD Chip select pin (Active low) */
#define PIN_EPD_CS (5)
/**< EPD Data/Command pin (Data active high) */
#define PIN_EPD_DC (6)
/**< EPD Reset pin (Active low) */
#define PIN_EPD_RST (7)
/**< EPD Busy pin (Active low) */
#define PIN_EPD_BUSY (8)
/**< EPD SCK pin */
#define PIN_EPD_SCK (4)
/**< EPD MOSI pin */
#define PIN_EPD_MOSI (3)
/**< EPD MISO pin not used */
#define PIN_EPD_MISO (0xFF)
/**
* @defgroup PIN_EXP_GROUP
* @note IO Expander pins
* @{
*/
#define PIN_EXP_RST (19) /**< IO Expander reset pin */
#define EXPDR_A_INT (11) /**< IO Expander */
#define PIN_EXP_INT_A (11) /**< IO Expander interrupt for PORTA */
#define PIN_EXP_INT_B (12) /**< IO Expander interrupt for PORTB */
#define PIN_EXP_SDA (20) /**< TWI SCK pin */
#define PIN_EXP_SCL (21) /**< TWI SCL pin */
/** @} */
/**< IO Expander reset pin */
#define PIN_EXP_RST (19)
/**< IO Expander */
#define EXPDR_A_INT (11)
/**< IO Expander interrupt for PORTA */
#define PIN_EXP_INT_A (11)
/**< IO Expander interrupt for PORTB */
#define PIN_EXP_INT_B (12)
/**< TWI SCK pin */
#define PIN_EXP_SDA (20)
/**< TWI SCL pin */
#define PIN_EXP_SCL (21)
/**
* @defgroup MCP23017_GROUP
* @brief GPIO Pin configuration on IO Expander
* @{
*/
#define MCP23017_CENTER (7)
#define MCP23017_LEFT (5)
#define MCP23017_RIGHT (3)
@@ -105,17 +103,12 @@
#define MCP23017_LED2 (9)
#define MCP23017_REL1 (11)
#define MCP23017_REL2 (10)
/** @} */
/**
* @defgroup TWI_GROUP
* @note Pins concerning TWI Addresses
* Control bits are added by nrf_drv_twi
* @{
*/
#define TWI_EXPANDER_ADDR (0x40) /**< Port expander address */
#define TWI_AG_ADDR (0x6A << 1) /**< Accelerometer/Gyroscope address */
#define TWI_MAG_ADDR (0x1C << 1) /**< Magnetometer address */
/** @} */
/**< Port expander address */
#define TWI_EXPANDER_ADDR (0x40)
/**< Accelerometer/Gyroscope address */
#define TWI_AG_ADDR (0x6A << 1)
/**< Magnetometer address */
#define TWI_MAG_ADDR (0x1C << 1)
//----------------------------PUBLIC PROTOTYPES -------------------------------
#endif // __ACD_52832_BSP_H__
+17
View File
@@ -0,0 +1,17 @@
/**
* @file aconnoBSP.h
* @author Jurica Resetar (Jurica@aconno.de)
* @brief
* @version 0.1
* @date 2019-04-19
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __ACONNO_BSP_H__
#define __ACONNO_BSP_H__
#include "acd52832Bsp.h"
#endif // __ACONNO_BSP_H__
+187
View File
@@ -0,0 +1,187 @@
PROJECT_NAME := ACD52832Master
TARGETS := nrf52832_xxaa
OUTPUT_DIRECTORY := _build
SDK_ROOT := ../../../nRF5_SDK_15.2.0
PROJ_DIR := ../../
# Comment if the project does not use DFU
#USE_ACONNO_DFU := YES
$(OUTPUT_DIRECTORY)/nrf52832_xxaa.out: \
LINKER_SCRIPT := ble_app_hrs_freertos_gcc_nrf52.ld
ACONNO_SRC_FILE = ../../config/buildConfig/aconnoSource.txt
ACONNO_SOURCE = $(shell cat ${ACONNO_SRC_FILE})
ACONNO_INC_FILE = ../../config/buildConfig/aconnoInclude.txt
ACONNO_INCLUDE = $(shell cat ${ACONNO_INC_FILE})
NORDIC_SRC_FILE = ../../config/buildConfig/nordicSource.txt
NORDIC_SOURCE = $(shell cat ${NORDIC_SRC_FILE})
NORDIC_INC_FILE = ../../config/buildConfig/nordicInclude.txt
NORDIC_INCLUDE = $(shell cat ${NORDIC_INC_FILE})
# Source files common to all targets
SRC_FILES += \
$(ACONNO_SOURCE) \
$(NORDIC_SOURCE) \
$(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_nrf52.S \
$(SDK_ROOT)/modules/nrfx/mdk/system_nrf52.c \
# Include folders common to all targets
INC_FOLDERS += \
$(ACONNO_INCLUDE) \
$(NORDIC_INCLUDE) \
$(PROJ_DIR)/nrf52832/ \
$(PROJ_DIR)/nrf52832/config \
$(SDK_ROOT)/components/softdevice/s132/headers \
$(SDK_ROOT)/components/softdevice/s132/headers/nrf52 \
# Libraries common to all targets
LIB_FILES += \
# Optimization flags
OPT = -O3 -g3
# Uncomment the line below to enable link time optimization
#OPT += -flto
# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBOARD_PCA10040
CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DFREERTOS
CFLAGS += -DNRF52
CFLAGS += -DNRF52832_XXAA
CFLAGS += -DNRF52_PAN_74
CFLAGS += -DNRF_SD_BLE_API_VERSION=6
CFLAGS += -DS132
CFLAGS += -DSOFTDEVICE_PRESENT
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += -Wall
#CFLAGS += -Werror
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in a separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin -fshort-enums
CFLAGS += -DDEBUG
CFLAGS += -DNRF_DFU_SVCI_ENABLED
CFLAGS += -DNRF_DFU_TRANSPORT_BLE=1
ifdef USE_ACONNO_DFU
CFLAGS += -DUSE_ACONNO_DFU
endif
# C++ flags common to all targets
CXXFLAGS += $(OPT)
CXXFLAGS += -DDEBUG
# Assembler flags common to all targets
ASMFLAGS += -g3
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DBOARD_PCA10040
ASMFLAGS += -DFLOAT_ABI_HARD
ASMFLAGS += -DFREERTOS
ASMFLAGS += -DNRF52
ASMFLAGS += -DNRF52832_XXAA
ASMFLAGS += -DNRF52_PAN_74
ASMFLAGS += -DNRF_SD_BLE_API_VERSION=6
ASMFLAGS += -DS132
ASMFLAGS += -DSOFTDEVICE_PRESENT
ASMFLAGS += -DNRF_DFU_SVCI_ENABLED
ASMFLAGS += -DNRF_DFU_TRANSPORT_BLE=1
# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += --specs=nano.specs
nrf52832_xxaa: CFLAGS += -D__HEAP_SIZE=1024
nrf52832_xxaa: CFLAGS += -D__STACK_SIZE=2048
nrf52832_xxaa: ASMFLAGS += -D__HEAP_SIZE=1024
nrf52832_xxaa: ASMFLAGS += -D__STACK_SIZE=2048
# Add standard libraries at the very end of the linker input, after all objects
# that may need symbols provided by these libraries.
LIB_FILES += -lc -lnosys -lm -lstdc++
.PHONY: default help
# Default target - first one defined
default: nrf52832_xxaa
# Print all targets that can be built
help:
@echo following targets are available:
@echo nrf52832_xxaa
@echo flash_softdevice
@echo sdk_config - starting external tool for editing sdk_config.h
@echo flash - flashing binary
@echo $(VARIABLE)
TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
include $(TEMPLATE_PATH)/Makefile.common
$(foreach target, $(TARGETS), $(call define_target, $(target)))
.PHONY: flash flash_softdevice erase
# Flash the program
flash_app: default
@echo Flashing: $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex
nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex --sectorerase
nrfjprog -f nrf52 --reset
# Flash softdevice
flash_softdevice:
@echo Flashing: s132_nrf52_6.1.0_softdevice.hex
nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_6.1.0_softdevice.hex --sectorerase
nrfjprog -f nrf52 --reset
# Flash the program and softdevice
flash_all:
@echo Flashing: $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex
nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex --sectorerase
nrfjprog -f nrf52 --reset
# Merge the program and softdevice
merge_soft:
@echo Merging: $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex and s132_nrf52_6.1.0_softdevice.hex
mergehex -m $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_6.1.0_softdevice.hex $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex -o $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex
# Merge four hexes
merge_all:
ifdef USE_ACONNO_DFU
@echo Merging I:
@echo DFU bootloader: $(SDK_ROOT)/examples/dfu/secure_bootloader/pca10040_ble_debug/armgcc/_build/nrf52832_xxaa_s132.hex
@echo Application hex: $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex
mergehex -m $(SDK_ROOT)/components/aconno/nrf52832_xxaa_s132.hex $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex -o $(OUTPUT_DIRECTORY)/mergedBLandApp.hex
@echo
@echo Merging II:
@echo Bootloader settings page: $(SDK_ROOT)/components/aconno/bootloaderSettings.hex
@echo SoftDevice: $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_6.1.0_softdevice.hex
@echo Previously merged hex: $(OUTPUT_DIRECTORY)/mergedBLandApp.hex
mergehex -m $(SDK_ROOT)/components/aconno/bootloaderSettings.hex $(SDK_ROOT)/components/softdevice/s132/hex/s132_nrf52_6.1.0_softdevice.hex $(OUTPUT_DIRECTORY)/mergedBLandApp.hex -o $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex
else
make merge_soft
endif
all:
make merge_all
make flash_all
erase:
nrfjprog -f nrf52 --eraseall
SDK_CONFIG_FILE := ../config/sdk_config.h
CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
sdk_config:
java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,112 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x52000
RAM (rwx) : ORIGIN = 0x200057b8, LENGTH = 0xa848
uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
}
SECTIONS
{
.uicr_bootloader_start_address :
{
PROVIDE(__start_uicr_bootloader_start_address = .);
KEEP(*(SORT(.uicr_bootloader_start_address*)))
PROVIDE(__stop_uicr_bootloader_start_address = .);
} > uicr_bootloader_start_address
}
SECTIONS
{
. = ALIGN(4);
.mem_section_dummy_ram :
{
}
.log_dynamic_data :
{
PROVIDE(__start_log_dynamic_data = .);
KEEP(*(SORT(.log_dynamic_data*)))
PROVIDE(__stop_log_dynamic_data = .);
} > RAM
.log_filter_data :
{
PROVIDE(__start_log_filter_data = .);
KEEP(*(SORT(.log_filter_data*)))
PROVIDE(__stop_log_filter_data = .);
} > RAM
.fs_data :
{
PROVIDE(__start_fs_data = .);
KEEP(*(.fs_data))
PROVIDE(__stop_fs_data = .);
} > RAM
} INSERT AFTER .data;
SECTIONS
{
.mem_section_dummy_rom :
{
}
.sdh_ble_observers :
{
PROVIDE(__start_sdh_ble_observers = .);
KEEP(*(SORT(.sdh_ble_observers*)))
PROVIDE(__stop_sdh_ble_observers = .);
} > FLASH
.sdh_soc_observers :
{
PROVIDE(__start_sdh_soc_observers = .);
KEEP(*(SORT(.sdh_soc_observers*)))
PROVIDE(__stop_sdh_soc_observers = .);
} > FLASH
.pwr_mgmt_data :
{
PROVIDE(__start_pwr_mgmt_data = .);
KEEP(*(SORT(.pwr_mgmt_data*)))
PROVIDE(__stop_pwr_mgmt_data = .);
} > FLASH
.log_const_data :
{
PROVIDE(__start_log_const_data = .);
KEEP(*(SORT(.log_const_data*)))
PROVIDE(__stop_log_const_data = .);
} > FLASH
.sdh_stack_observers :
{
PROVIDE(__start_sdh_stack_observers = .);
KEEP(*(SORT(.sdh_stack_observers*)))
PROVIDE(__stop_sdh_stack_observers = .);
} > FLASH
.sdh_req_observers :
{
PROVIDE(__start_sdh_req_observers = .);
KEEP(*(SORT(.sdh_req_observers*)))
PROVIDE(__stop_sdh_req_observers = .);
} > FLASH
.sdh_state_observers :
{
PROVIDE(__start_sdh_state_observers = .);
KEEP(*(SORT(.sdh_state_observers*)))
PROVIDE(__stop_sdh_state_observers = .);
} > FLASH
.log_backends :
{
PROVIDE(__start_log_backends = .);
KEEP(*(SORT(.log_backends*)))
PROVIDE(__stop_log_backends = .);
} > FLASH
.nrf_balloc :
{
PROVIDE(__start_nrf_balloc = .);
KEEP(*(.nrf_balloc))
PROVIDE(__stop_nrf_balloc = .);
} > FLASH
} INSERT AFTER .text
INCLUDE "nrf_common.ld"
File diff suppressed because it is too large Load Diff
+116
View File
@@ -0,0 +1,116 @@
/**
* @file acd52840Bsp.h
* @author Odri Tomas (odri@aconno.de)
* @brief
* @version 0.1
* @date 2019-04-26
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __ACD_52840_BSP_H__
#define __ACD_52840_BSP_H__
//------------------------------ INCLUDES -------------------------------------
/** Communication headers */
#include "aconnoSPI.h"
#include "aconnoI2C.h"
/** SAADC header*/
#include "aconnoSAADC.h"
/** EPD header */
#include "GDEP015OC1.h"
/** MCP23017 header */
#include "MCP23017.h"
/** GPIO header */
#include "aconnoGPIO.h"
/** LDR header */
#include "LDR.h"
/** Potentiometer header */
#include "potentiometer.h"
/** Ambient temperature header */
#include "MCP9700.h"
/** Menu states header */
#include "states.h"
/** iNEMO inertial module header*/
#include "LSM9DS1.h"
/** Servo header */
#include "servo.h"
//----------------------------- DATA TYPES ------------------------------------
//-------------------------- CONSTANTS & MACROS -------------------------------
#define GPIO_PIN_MAP(port, pin) (((port) << 5) | ((pin) & 0x1F))
/**< SW1 gpio number (Active low) */
#define PIN_BUTTON (GPIO_PIN_MAP(1, 10))
/**< LD1 gpio number (Active low) */
#define PIN_LED (GPIO_PIN_MAP(1, 13))
/**< LD4 gpio number (Active high) */
#define PIN_IRLED (GPIO_PIN_MAP(1, 15))
/**< LS1 gpio number (Active high) */
#define PIN_BUZZER (GPIO_PIN_MAP(0, 29))
/**< Module red LED */
#define PIN_LED_RED (GPIO_PIN_MAP(1, 2))
/**< Module blue LED */
#define PIN_LED_BLUE (GPIO_PIN_MAP(1, 4))
/**< Module green LED */
#define PIN_LED_GREEN (GPIO_PIN_MAP(1, 6))
/** Alternate General IO pins */
/**< Servo1 gpio number */
#define PIN_SERVO1 (GPIO_PIN_MAP(1, 10))
/**< Servo2 gpio number */
#define PIN_SERVO2 (GPIO_PIN_MAP(1, 13))
/**< Battery */
#define ADC_BAT (9) // pin P0.31
/**< Potentiometer */
#define ADC_POT (1)
/**< Light Dependant Resistor */
#define ADC_LIGHT (2)
/**< Temperature Dependant Resistor */
#define ADC_TEMP (5)
/**< EPD Chip select pin (Active low) */
#define PIN_EPD_CS (GPIO_PIN_MAP(0, 4))
/**< EPD Data/Command pin (Data active high) */
#define PIN_EPD_DC (GPIO_PIN_MAP(0, 26))
/**< EPD Reset pin (Active low) */
#define PIN_EPD_RST (GPIO_PIN_MAP(0, 27))
/**< EPD Busy pin (Active low) */
#define PIN_EPD_BUSY (GPIO_PIN_MAP(0, 6))
/**< EPD SCK pin */
#define PIN_EPD_SCK (GPIO_PIN_MAP(0, 5))
/**< EPD MOSI pin */
#define PIN_EPD_MOSI (GPIO_PIN_MAP(0, 30))
/**< EPD MISO pin not used */
#define PIN_EPD_MISO (0xFF)
/**< IO Expander reset pin */
#define PIN_EXP_RST (GPIO_PIN_MAP(0, 17))
/**< IO Expander */
#define EXPDR_A_INT (GPIO_PIN_MAP(0, 8))
/**< IO Expander interrupt for PORTA */
#define PIN_EXP_INT_A (GPIO_PIN_MAP(0, 8))
/**< IO Expander interrupt for PORTB */
#define PIN_EXP_INT_B (GPIO_PIN_MAP(1, 9))
/**< TWI SCK pin */
#define PIN_EXP_SDA (GPIO_PIN_MAP(0, 24))
/**< TWI SCL pin */
#define PIN_EXP_SCL (GPIO_PIN_MAP(0, 18))
#define MCP23017_CENTER (7)
#define MCP23017_LEFT (5)
#define MCP23017_RIGHT (3)
#define MCP23017_UP (6)
#define MCP23017_DOWN (4)
#define MCP23017_SW2 (8)
#define MCP23017_LED2 (9)
#define MCP23017_REL1 (11)
#define MCP23017_REL2 (10)
/**< Port expander address */
#define TWI_EXPANDER_ADDR (0x40)
/**< Accelerometer/Gyroscope address */
#define TWI_AG_ADDR (0x6A << 1)
/**< Magnetometer address */
#define TWI_MAG_ADDR (0x1C << 1)
//----------------------------PUBLIC PROTOTYPES -------------------------------
#endif // __ACD_52840_BSP_H__
+17
View File
@@ -0,0 +1,17 @@
/**
* @file aconnoBSP.h
* @author Jurica Resetar (Jurica@aconno.de)
* @brief
* @version 0.1
* @date 2019-04-19
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __ACONNO_BSP_H__
#define __ACONNO_BSP_H__
#include "acd52840Bsp.h"
#endif // __ACONNO_BSP_H__
+204
View File
@@ -0,0 +1,204 @@
PROJECT_NAME := ACD52840Master
TARGETS := nrf52840_xxaa
OUTPUT_DIRECTORY := _build
SDK_ROOT := ../../../nRF5_SDK_15.2.0
PROJ_DIR := ../../
# Comment if the project does not use DFU
# USE_ACONNO_DFU := YES
$(OUTPUT_DIRECTORY)/nrf52840_xxaa.out: \
LINKER_SCRIPT := ble_app_hrs_freertos_gcc_nrf52.ld
ACONNO_SRC_FILE = ../../config/buildConfig/aconnoSource.txt
ACONNO_SOURCE = $(shell cat ${ACONNO_SRC_FILE})
ACONNO_INC_FILE = ../../config/buildConfig/aconnoInclude.txt
ACONNO_INCLUDE = $(shell cat ${ACONNO_INC_FILE})
NORDIC_SRC_FILE = ../../config/buildConfig/nordicSource.txt
NORDIC_SOURCE = $(shell cat ${NORDIC_SRC_FILE})
NORDIC_INC_FILE = ../../config/buildConfig/nordicInclude.txt
NORDIC_INCLUDE = $(shell cat ${NORDIC_INC_FILE})
# Source files common to all targets
SRC_FILES += \
$(ACONNO_SOURCE) \
$(PROJ_SRC) \
$(NORDIC_SOURCE) \
$(SDK_ROOT)/modules/nrfx/mdk/gcc_startup_nrf52840.S \
$(SDK_ROOT)/modules/nrfx/mdk/system_nrf52840.c \
$(PROJ_DIR)/source/aconnoUSBMouse.cpp \
$(SDK_ROOT)/components/libraries/usbd/app_usbd.c \
$(SDK_ROOT)/components/libraries/bsp/bsp_cli.c \
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_power.c \
$(SDK_ROOT)/components/libraries/usbd/app_usbd_string_desc.c \
$(SDK_ROOT)/components/drivers_nrf/usbd/nrf_drv_usbd.c \
$(SDK_ROOT)/components/libraries/queue/nrf_queue.c \
$(SDK_ROOT)/components/libraries/cli/nrf_cli.c \
$(SDK_ROOT)/components/libraries/cli/uart/nrf_cli_uart.c \
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_power.c \
$(SDK_ROOT)/components/libraries/usbd/app_usbd_core.c \
$(SDK_ROOT)/components/libraries/usbd/class/hid/app_usbd_hid.c \
$(SDK_ROOT)/components/libraries/usbd/class/hid/kbd/app_usbd_hid_kbd.c \
$(SDK_ROOT)/components/libraries/usbd/class/hid/mouse/app_usbd_hid_mouse.c \
$(SDK_ROOT)/components/libraries/usbd/class/hid/generic/app_usbd_hid_generic.c\
# Include folders common to all targets
INC_FOLDERS += \
$(ACONNO_INCLUDE) \
$(PROJ_INC) \
$(NORDIC_INCLUDE) \
$(PROJ_DIR)/nrf52840/ \
$(PROJ_DIR)/nrf52840/config \
$(SDK_ROOT)/components/softdevice/s140/headers/nrf52 \
$(SDK_ROOT)/components/softdevice/s140/headers \
$(PROJ_DIR)/source/ \
$(SDK_ROOT)/components/libraries/usbd/ \
$(SDK_ROOT)/components/libraries/usbd/class/hid/generic/ \
$(SDK_ROOT)/components/libraries/usbd/class/hid/mouse/ \
$(SDK_ROOT)/components/libraries/usbd/class/hid/kbd/ \
$(SDK_ROOT)/components/drivers_nrf/usbd \
$(SDK_ROOT)/components/libraries/usbd/class/hid \
$(SDK_ROOT)/components/libraries/cli/ \
$(SDK_ROOT)/components/libraries/cli/uart \
$(SDK_ROOT)/integration/nrfx/legacy \
$(SDK_ROOT)/modules/nrfx/drivers/include/ \
$(SDK_ROOT)/components/libraries/util/ \
# Libraries common to all targets
LIB_FILES += \
# Optimization flags
OPT = -O3 -g3
# Uncomment the line below to enable link time optimization
#OPT += -flto
# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBOARD_PCA10056
#CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DFLOAT_ABI_HARD
CFLAGS += -DFREERTOS
CFLAGS += -DNRF52840_XXAA
CFLAGS += -DNRF_SD_BLE_API_VERSION=6
CFLAGS += -DS140
CFLAGS += -DSOFTDEVICE_PRESENT
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += -Wall
#CFLAGS += -Werror
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in a separate section, this allows linker to discard unused ones
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin -fshort-enums
CFLAGS += -DDEBUG
CFLAGS += -DNRF_DFU_SVCI_ENABLED
CFLAGS += -DNRF_DFU_TRANSPORT_BLE=1
ifdef USE_ACONNO_DFU
CFLAGS += -DUSE_ACONNO_DFU
endif
# C++ flags common to all targets
CXXFLAGS += $(OPT)
CXXFLAGS += -DDEBUG
# Assembler flags common to all targets
ASMFLAGS += -g3
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DBOARD_PCA10056
#ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
ASMFLAGS += -DFLOAT_ABI_HARD
ASMFLAGS += -DFREERTOS
ASMFLAGS += -DNRF52840_XXAA
ASMFLAGS += -DNRF_SD_BLE_API_VERSION=6
ASMFLAGS += -DS140
ASMFLAGS += -DSOFTDEVICE_PRESENT
ASMFLAGS += -DNRF_DFU_SVCI_ENABLED
ASMFLAGS += -DNRF_DFU_TRANSPORT_BLE=1
# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += --specs=nano.specs
nrf52840_xxaa: CFLAGS += -D__HEAP_SIZE=1024
nrf52840_xxaa: CFLAGS += -D__STACK_SIZE=2048
nrf52840_xxaa: ASMFLAGS += -D__HEAP_SIZE=1024
nrf52840_xxaa: ASMFLAGS += -D__STACK_SIZE=2048
# Add standard libraries at the very end of the linker input, after all objects
# that may need symbols provided by these libraries.
LIB_FILES += -lc -lnosys -lm -lstdc++
.PHONY: default help
# Default target - first one defined
default: nrf52840_xxaa
# Print all targets that can be built
help:
@echo following targets are available:
@echo nrf52840_xxaa
@echo flash_softdevice
@echo sdk_config - starting external tool for editing sdk_config.h
@echo flash - flashing binary
TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc
include $(TEMPLATE_PATH)/Makefile.common
$(foreach target, $(TARGETS), $(call define_target, $(target)))
.PHONY: flash flash_softdevice erase
# Flash the program
flash: default
@echo Flashing: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex --sectorerase
nrfjprog -f nrf52 --reset
# Flash softdevice
flash_softdevice:
@echo Flashing: s140_nrf52_6.1.0_softdevice.hex
nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s140/hex/s140_nrf52_6.1.0_softdevice.hex --sectorerase
nrfjprog -f nrf52 --reset
# Flash the program and softdevice
flash_merged:
@echo Flashing: $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex
nrfjprog -f nrf52 --program $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex --sectorerase
nrfjprog -f nrf52 --reset
# Merge the program and softdevice
merge_soft:
@echo Merging: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex and s140_nrf52_6.1.0_softdevice.hex
mergehex -m $(SDK_ROOT)/components/softdevice/s140/hex/s140_nrf52_6.1.0_softdevice.hex $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex -o $(OUTPUT_DIRECTORY)/$(PROJECT_NAME).hex
# Merge four hexes
merge_all:
make merge_soft
all:
make merge_all
make flash_merged
erase:
nrfjprog -f nrf52 --eraseall
SDK_CONFIG_FILE := ../config/sdk_config.h
CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
sdk_config:
java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)
@@ -1,129 +1,129 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000
RAM (rwx) : ORIGIN = 0x200057b8, LENGTH = 0xa848
}
SECTIONS
{
}
SECTIONS
{
. = ALIGN(4);
.mem_section_dummy_ram :
{
}
.cli_sorted_cmd_ptrs :
{
PROVIDE(__start_cli_sorted_cmd_ptrs = .);
KEEP(*(.cli_sorted_cmd_ptrs))
PROVIDE(__stop_cli_sorted_cmd_ptrs = .);
} > RAM
.fs_data :
{
PROVIDE(__start_fs_data = .);
KEEP(*(.fs_data))
PROVIDE(__stop_fs_data = .);
} > RAM
.log_dynamic_data :
{
PROVIDE(__start_log_dynamic_data = .);
KEEP(*(SORT(.log_dynamic_data*)))
PROVIDE(__stop_log_dynamic_data = .);
} > RAM
.log_filter_data :
{
PROVIDE(__start_log_filter_data = .);
KEEP(*(SORT(.log_filter_data*)))
PROVIDE(__stop_log_filter_data = .);
} > RAM
} INSERT AFTER .data;
SECTIONS
{
.mem_section_dummy_rom :
{
}
.sdh_soc_observers :
{
PROVIDE(__start_sdh_soc_observers = .);
KEEP(*(SORT(.sdh_soc_observers*)))
PROVIDE(__stop_sdh_soc_observers = .);
} > FLASH
.sdh_ble_observers :
{
PROVIDE(__start_sdh_ble_observers = .);
KEEP(*(SORT(.sdh_ble_observers*)))
PROVIDE(__stop_sdh_ble_observers = .);
} > FLASH
.sdh_stack_observers :
{
PROVIDE(__start_sdh_stack_observers = .);
KEEP(*(SORT(.sdh_stack_observers*)))
PROVIDE(__stop_sdh_stack_observers = .);
} > FLASH
.sdh_req_observers :
{
PROVIDE(__start_sdh_req_observers = .);
KEEP(*(SORT(.sdh_req_observers*)))
PROVIDE(__stop_sdh_req_observers = .);
} > FLASH
.sdh_state_observers :
{
PROVIDE(__start_sdh_state_observers = .);
KEEP(*(SORT(.sdh_state_observers*)))
PROVIDE(__stop_sdh_state_observers = .);
} > FLASH
.nrf_queue :
{
PROVIDE(__start_nrf_queue = .);
KEEP(*(.nrf_queue))
PROVIDE(__stop_nrf_queue = .);
} > FLASH
.nrf_balloc :
{
PROVIDE(__start_nrf_balloc = .);
KEEP(*(.nrf_balloc))
PROVIDE(__stop_nrf_balloc = .);
} > FLASH
.cli_command :
{
PROVIDE(__start_cli_command = .);
KEEP(*(.cli_command))
PROVIDE(__stop_cli_command = .);
} > FLASH
.crypto_data :
{
PROVIDE(__start_crypto_data = .);
KEEP(*(SORT(.crypto_data*)))
PROVIDE(__stop_crypto_data = .);
} > FLASH
.pwr_mgmt_data :
{
PROVIDE(__start_pwr_mgmt_data = .);
KEEP(*(SORT(.pwr_mgmt_data*)))
PROVIDE(__stop_pwr_mgmt_data = .);
} > FLASH
.log_const_data :
{
PROVIDE(__start_log_const_data = .);
KEEP(*(SORT(.log_const_data*)))
PROVIDE(__stop_log_const_data = .);
} > FLASH
.log_backends :
{
PROVIDE(__start_log_backends = .);
KEEP(*(SORT(.log_backends*)))
PROVIDE(__stop_log_backends = .);
} > FLASH
} INSERT AFTER .text
INCLUDE "nrf_common.ld"
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xda000
RAM (rwx) : ORIGIN = 0x200057b8, LENGTH = 0x3a848
}
SECTIONS
{
}
SECTIONS
{
. = ALIGN(4);
.mem_section_dummy_ram :
{
}
.cli_sorted_cmd_ptrs :
{
PROVIDE(__start_cli_sorted_cmd_ptrs = .);
KEEP(*(.cli_sorted_cmd_ptrs))
PROVIDE(__stop_cli_sorted_cmd_ptrs = .);
} > RAM
.fs_data :
{
PROVIDE(__start_fs_data = .);
KEEP(*(.fs_data))
PROVIDE(__stop_fs_data = .);
} > RAM
.log_dynamic_data :
{
PROVIDE(__start_log_dynamic_data = .);
KEEP(*(SORT(.log_dynamic_data*)))
PROVIDE(__stop_log_dynamic_data = .);
} > RAM
.log_filter_data :
{
PROVIDE(__start_log_filter_data = .);
KEEP(*(SORT(.log_filter_data*)))
PROVIDE(__stop_log_filter_data = .);
} > RAM
} INSERT AFTER .data;
SECTIONS
{
.mem_section_dummy_rom :
{
}
.sdh_soc_observers :
{
PROVIDE(__start_sdh_soc_observers = .);
KEEP(*(SORT(.sdh_soc_observers*)))
PROVIDE(__stop_sdh_soc_observers = .);
} > FLASH
.sdh_ble_observers :
{
PROVIDE(__start_sdh_ble_observers = .);
KEEP(*(SORT(.sdh_ble_observers*)))
PROVIDE(__stop_sdh_ble_observers = .);
} > FLASH
.sdh_stack_observers :
{
PROVIDE(__start_sdh_stack_observers = .);
KEEP(*(SORT(.sdh_stack_observers*)))
PROVIDE(__stop_sdh_stack_observers = .);
} > FLASH
.sdh_req_observers :
{
PROVIDE(__start_sdh_req_observers = .);
KEEP(*(SORT(.sdh_req_observers*)))
PROVIDE(__stop_sdh_req_observers = .);
} > FLASH
.sdh_state_observers :
{
PROVIDE(__start_sdh_state_observers = .);
KEEP(*(SORT(.sdh_state_observers*)))
PROVIDE(__stop_sdh_state_observers = .);
} > FLASH
.nrf_queue :
{
PROVIDE(__start_nrf_queue = .);
KEEP(*(.nrf_queue))
PROVIDE(__stop_nrf_queue = .);
} > FLASH
.nrf_balloc :
{
PROVIDE(__start_nrf_balloc = .);
KEEP(*(.nrf_balloc))
PROVIDE(__stop_nrf_balloc = .);
} > FLASH
.cli_command :
{
PROVIDE(__start_cli_command = .);
KEEP(*(.cli_command))
PROVIDE(__stop_cli_command = .);
} > FLASH
.crypto_data :
{
PROVIDE(__start_crypto_data = .);
KEEP(*(SORT(.crypto_data*)))
PROVIDE(__stop_crypto_data = .);
} > FLASH
.pwr_mgmt_data :
{
PROVIDE(__start_pwr_mgmt_data = .);
KEEP(*(SORT(.pwr_mgmt_data*)))
PROVIDE(__stop_pwr_mgmt_data = .);
} > FLASH
.log_const_data :
{
PROVIDE(__start_log_const_data = .);
KEEP(*(SORT(.log_const_data*)))
PROVIDE(__stop_log_const_data = .);
} > FLASH
.log_backends :
{
PROVIDE(__start_log_backends = .);
KEEP(*(SORT(.log_backends*)))
PROVIDE(__stop_log_backends = .);
} > FLASH
} INSERT AFTER .text
INCLUDE "nrf_common.ld"
File diff suppressed because it is too large Load Diff
+277
View File
@@ -0,0 +1,277 @@
/**
* @file mouse.cpp
* @author Odri (odri@aconno.de)
* @brief USB HID Mouse source file
* @version 0.1
* @date 2019-05-09
*
* @copyright Copyright (c) 2019
*
*/
#ifdef NRF52840_XXAA
//------------------------------ INCLUDES -------------------------------------
#include "aconnoUSBMouse.h"
#include "aconnoBsp.h"
//-------------------------------- MACROS -------------------------------------
//----------------------------- DATA TYPES ------------------------------------
//--------------------- PRIVATE FUNCTION PROTOTYPES ---------------------------
/**
* @brief Handler for the mouse down movement timer
*
* @param p_context
*/
static void mouseMoveDownTimerHandler(void * p_context);
/**
* @brief Handler for the mouse up movement timer
*
* @param p_context
*/
static void mouseMoveUpTimerHandler(void * p_context);
/**
* @brief Handler for the mouse left movement timer
*
* @param p_context
*/
static void mouseMoveLeftTimerHandler(void * p_context);
/**
* @brief Handler for the mouse right movement timer
*
* @param p_context
*/
static void mouseMoveRightTimerHandler(void * p_context);
/**
* @brief Class specific event handler.
*
* @param p_inst Class instance.
* @param event Class specific event.
* */
static void hidMouseUserEvHandler(app_usbd_class_inst_t const * p_inst,
app_usbd_hid_user_event_t event);
/**
* @brief USBD library specific event handler.
*
* @param event USBD library event.
* */
static void usbdUserEvHandler(app_usbd_event_type_t event);
//----------------------- STATIC DATA & CONSTANTS -----------------------------
//------------------------------ GLOBAL DATA ----------------------------------
extern MCP23017 expdr;
extern AconnoGPIO ld1;
/**
* @brief Timer to repeat mouse move down
*/
APP_TIMER_DEF(mouseMoveDownTimer);
/**
* @brief Timer to repeat mouse move up
*/
APP_TIMER_DEF(mouseMoveUpTimer);
/**
* @brief Timer to repeat mouse move to the left
*/
APP_TIMER_DEF(mouseMoveLeftTimer);
/**
* @brief Timer to repeat mouse move to the right
*/
APP_TIMER_DEF(mouseMoveRightTimer);
/**
* @brief Global HID mouse instance
*/
APP_USBD_HID_MOUSE_GLOBAL_DEF(appHidMouse,
APP_USBD_INTERFACE_MOUSE,
NRF_DRV_USBD_EPIN1,
CONFIG_MOUSE_BUTTON_COUNT,
hidMouseUserEvHandler,
APP_USBD_HID_SUBCLASS_BOOT
);
//--------------------- PUBLIC FUNCTIONS AND OBJECTS --------------------------
void hidGenericMouseProcessState(USB_DIR direction)
{
switch(direction)
{
case USB_DIR::UP:
{
hidGenericMouseStopState();
UNUSED_RETURN_VALUE(app_timer_start(mouseMoveUpTimer,
APP_TIMER_TICKS(CONFIG_MOUSE_MOVE_TIME_MS),
NULL));
break;
}
case USB_DIR::DOWN:
{
hidGenericMouseStopState();
UNUSED_RETURN_VALUE(app_timer_start(mouseMoveDownTimer,
APP_TIMER_TICKS(CONFIG_MOUSE_MOVE_TIME_MS),
NULL));
break;
}
case USB_DIR::LEFT:
{
hidGenericMouseStopState();
UNUSED_RETURN_VALUE(app_timer_start(mouseMoveLeftTimer,
APP_TIMER_TICKS(CONFIG_MOUSE_MOVE_TIME_MS),
NULL));
break;
}
case USB_DIR::RIGHT:
{
hidGenericMouseStopState();
UNUSED_RETURN_VALUE(app_timer_start(mouseMoveRightTimer,
APP_TIMER_TICKS(CONFIG_MOUSE_MOVE_TIME_MS),
NULL));
break;
}
default:
{
break;
}
}
}
void hidGenericMouseStopState(void)
{
UNUSED_RETURN_VALUE(app_timer_stop(mouseMoveDownTimer));
UNUSED_RETURN_VALUE(app_timer_stop(mouseMoveUpTimer));
UNUSED_RETURN_VALUE(app_timer_stop(mouseMoveLeftTimer));
UNUSED_RETURN_VALUE(app_timer_stop(mouseMoveRightTimer));
}
void usbSetup()
{
NRF_LOG_INFO("USB setup");
ret_code_t ret;
static const app_usbd_config_t usbdConfig = {
NULL,
usbdUserEvHandler
};
app_timer_create(&mouseMoveDownTimer, APP_TIMER_MODE_REPEATED,
mouseMoveDownTimerHandler);
app_timer_create(&mouseMoveUpTimer, APP_TIMER_MODE_REPEATED,
mouseMoveUpTimerHandler);
app_timer_create(&mouseMoveLeftTimer, APP_TIMER_MODE_REPEATED,
mouseMoveLeftTimerHandler);
app_timer_create(&mouseMoveRightTimer, APP_TIMER_MODE_REPEATED,
mouseMoveRightTimerHandler);
ret = app_usbd_init(&usbdConfig);
APP_ERROR_CHECK(ret);
app_usbd_class_inst_t const * classInstMouse;
classInstMouse = app_usbd_hid_mouse_class_inst_get(&appHidMouse);
ret = app_usbd_class_append(classInstMouse);
APP_ERROR_CHECK(ret);
NRF_LOG_INFO("No USB power detection enabled.");
NRF_LOG_INFO("Starting USB now.");
app_usbd_enable();
app_usbd_start();
}
//--------------------------- PRIVATE FUNCTIONS -------------------------------
static void mouseMoveDownTimerHandler(void * pContext)
{
UNUSED_PARAMETER(pContext);
UNUSED_RETURN_VALUE(app_usbd_hid_mouse_y_move(&appHidMouse,
CONFIG_MOUSE_MOVE_STEP));
}
static void mouseMoveUpTimerHandler(void * pContext)
{
UNUSED_PARAMETER(pContext);
UNUSED_RETURN_VALUE(app_usbd_hid_mouse_y_move(&appHidMouse,
-CONFIG_MOUSE_MOVE_STEP));
}
static void mouseMoveLeftTimerHandler(void * pContext)
{
UNUSED_PARAMETER(pContext);
UNUSED_RETURN_VALUE(app_usbd_hid_mouse_x_move(&appHidMouse,
-CONFIG_MOUSE_MOVE_STEP));
}
static void mouseMoveRightTimerHandler(void * pContext)
{
UNUSED_PARAMETER(pContext);
UNUSED_RETURN_VALUE(app_usbd_hid_mouse_x_move(&appHidMouse,
CONFIG_MOUSE_MOVE_STEP));
}
static void hidMouseUserEvHandler(app_usbd_class_inst_t const * pInst,
app_usbd_hid_user_event_t event)
{
UNUSED_PARAMETER(pInst);
switch (event) {
case APP_USBD_HID_USER_EVT_OUT_REPORT_READY:
/* No output report defined for HID mouse.*/
break;
case APP_USBD_HID_USER_EVT_IN_REPORT_DONE:
break;
case APP_USBD_HID_USER_EVT_SET_BOOT_PROTO:
UNUSED_RETURN_VALUE(hid_mouse_clear_buffer(pInst));
break;
case APP_USBD_HID_USER_EVT_SET_REPORT_PROTO:
UNUSED_RETURN_VALUE(hid_mouse_clear_buffer(pInst));
break;
default:
break;
}
}
static void usbdUserEvHandler(app_usbd_event_type_t event)
{
switch (event)
{
case APP_USBD_EVT_DRV_SOF:
break;
case APP_USBD_EVT_DRV_SUSPEND:
// Allow the library to put the peripheral into sleep mode
app_usbd_suspend_req();
break;
case APP_USBD_EVT_DRV_RESUME:
break;
case APP_USBD_EVT_STARTED:
break;
case APP_USBD_EVT_STOPPED:
app_usbd_disable();
break;
case APP_USBD_EVT_POWER_DETECTED:
NRF_LOG_INFO("USB power detected.");
if(!nrf_drv_usbd_is_enabled())
{
app_usbd_enable();
}
break;
case APP_USBD_EVT_POWER_REMOVED:
NRF_LOG_INFO("USB power removed.");
app_usbd_stop();
break;
case APP_USBD_EVT_POWER_READY:
NRF_LOG_INFO("USB ready.");
app_usbd_start();
break;
default:
break;
}
}
//--------------------------- INTERRUPT HANDLERS ------------------------------
#endif
+86
View File
@@ -0,0 +1,86 @@
/**
* @file mouse.h
* @author Odri (odri@aconno.de)
* @brief USB HID Mouse header file
* @version 0.1
* @date 2019-05-09
*
* @copyright Copyright (c) 2019
*
*/
#ifndef __ACONNO_USB_MOUSE_H__
#define __ACONNO_USB_MOUSE_H__
//------------------------------ INCLUDES -------------------------------------
#ifdef NRF52840_XXAA
#include "app_timer.h"
#include "app_usbd.h"
#include "app_usbd_core.h"
#include "app_usbd_hid_generic.h"
extern "C"
{
#include "app_usbd_hid_mouse.h"
}
#include "app_error.h"
//----------------------------- DATA TYPES ------------------------------------
/**
* @brief GPIO pull-up/down configuration
*
*/
enum class USB_DIR : uint8_t
{
LEFT = 0, //!< 0
RIGHT = 1, //!< 1
DOWN = 2, //!< 2
UP = 3 //!< 3
};
//-------------------------- CONSTANTS & MACROS -------------------------------
/**
* @brief Enable HID mouse class
*/
#define CONFIG_HAS_MOUSE 1
/**
* @brief Mouse button count
*/
#define CONFIG_MOUSE_BUTTON_COUNT 2
/**
* @brief Mouse speed (value sent via HID when board button is pressed).
*/
#define CONFIG_MOUSE_MOVE_STEP (3)
/**
* @brief Mouse move repeat time in milliseconds
*/
#define CONFIG_MOUSE_MOVE_TIME_MS (20)
/* HID report layout */
#define BTN_MOUSE_X_POS 0
#define BTN_MOUSE_Y_POS 1
/**
* @brief USB composite interfaces
*/
#define APP_USBD_INTERFACE_MOUSE 0
//----------------------------PUBLIC PROTOTYPES -------------------------------
/**
* @brief Setup USB HID Mouse
* @note It is assumed that the softdevice handler is enabled
*
*/
void usbSetup();
/**
* @brief Process the state of the mouse movement
*
* @param direction Direction of the mouse movement
*/
void hidGenericMouseProcessState(USB_DIR direction);
/**
* @brief Stop mouse activity
*
*/
void hidGenericMouseStopState(void);
#endif
#endif // __ACONNO_USB_MOUSE_H__
+277 -88
View File
@@ -8,7 +8,7 @@
* @copyright Copyright (c) 2019
*
*/
//------------------------------ INCLUDES -------------------------------------
#include <stdint.h>
#include <string.h>
@@ -22,6 +22,9 @@
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "settings.h"
#include "basicConfig.h"
#include "arbData.h"
#include "aconnoConfig.h"
#include "aconnoHelpers.h"
#include "aconnoTasks.h"
@@ -29,109 +32,209 @@
#include "aconnoBLE.h"
#include "aconnoTasks.h"
#include "aconnoBeeper.h"
#include "slots.h"
//-------------------------------- MACROS -------------------------------------
//----------------------------- DATA TYPES ------------------------------------
//--------------------- PRIVATE FUNCTION PROTOTYPES ---------------------------
//----------------------- STATIC DATA & CONSTANTS -----------------------------
//------------------------------ GLOBAL DATA ----------------------------------
/**
* @brief loger task handler
*
*/
TaskHandle_t initTask;
/**
* @brief State Machine menu task handler
*
*/
TaskHandle_t menuStateMachineTask;
/**
* @brief LDR example task
*
* @brief LDR example task handler
*/
TaskHandle_t LDRTask;
TaskHandle_t ldrTask;
/**
* @brief Joystick example task
*
* @brief Joystick example task handler
*/
TaskHandle_t joystickExampleTask;
TaskHandle_t joyTask;
/**
* @brief rgbLedExampleTask
*
* @brief Rgb led example task handler
*/
TaskHandle_t rgbLedExampleTask;
TaskHandle_t rgbTask;
/**
* @brief Handle of a task taking care of reading ioexpander over i2c in
* order to dertermine a source of the interrupt
*
* @brief Interrupt source pooler task
*/
TaskHandle_t getInterruptSourceTask;
/**
* @brief Sound example task
*
* @brief Sound example task handler
*/
TaskHandle_t soundExampleTask;
TaskHandle_t soundTask;
/**
* @brief Potentiometer example task handler
*/
TaskHandle_t potTask;
/**
* @brief Temperature example task handler
*/
TaskHandle_t tempTask;
/**
* @brief Gyroscope example task handler
*/
TaskHandle_t gyroTask;
/**
* @brief Ble beacon example task handler
*/
TaskHandle_t bleTask;
/**
* @brief Ble image example task handler
*/
TaskHandle_t bleImageTask;
/**
* @brief Infrared example task handler
*/
TaskHandle_t irTask;
/**
* @brief LEDs example task handler
*/
TaskHandle_t ledsTask;
/**
* @brief Relay example task handler
*/
TaskHandle_t relayTask;
/**
* @brief Servomotor example task handler
*/
TaskHandle_t servoTask;
#ifdef NRF52840_XXAA
/**
* @brief USB example task handler
*/
TaskHandle_t usbTask;
#endif
#if NRF_LOG_ENABLED
extern TaskHandle_t mLoggerThread;
#endif
TaskHandle_t potTask;
TaskHandle_t tempTask;
TaskHandle_t gyroTask;
TaskHandle_t bleTask;
TaskHandle_t bleImageTask;
TaskHandle_t irTask;
TaskHandle_t ledsTask;
TaskHandle_t relayTask;
TaskHandle_t servoTask;
/**
* @brief Semaphore to control the interrupt source task
*/
SemaphoreHandle_t getInterruptSourceSemaphore;
/**
* @brief A queue which buffers interrupt events
*/
QueueHandle_t interruptSourceQueue;
/**
* @brief secondary interrupt Source queue. To be used by examples that
* require interrupts
*/
QueueHandle_t interruptSourceQueueSecondary;
TimerHandle_t intFlagTimer;
/**
* @brief Mutex to protect writing on the e-paper display
*/
SemaphoreHandle_t epdWriteMutex;
/**
* @brief Mutex to protect the I2C
*/
SemaphoreHandle_t i2cWriteMutex;
/**
* @brief Object defining current state of the Master Example
*/
State *pMenuState;
/**
* @brief AconnoI2C instance which is used for i2c communication
*/
AconnoI2C i2c(PIN_EXP_SDA, PIN_EXP_SCL);
/**
* @brief AconnoSPI instance which is used for SPI communication
*/
AconnoSPI spi(PIN_EPD_MISO, PIN_EPD_MOSI, PIN_EPD_SCK);
AconnoSAADC adc;
AconnoGPIO ledRed(PIN_LED_RED, GPIO_DIR::GPIO_OUTPUT);
AconnoGPIO ledBlue(PIN_LED_BLUE, GPIO_DIR::GPIO_OUTPUT);
AconnoGPIO ledGreen(PIN_LED_GREEN, GPIO_DIR::GPIO_OUTPUT);
AconnoGPIO irLed(PIN_IRLED, GPIO_DIR::GPIO_OUTPUT);
AconnoGPIO sw1(PIN_BUTTON, GPIO_DIR::GPIO_INPUT);
AconnoGPIO ld1(PIN_LED, GPIO_DIR::GPIO_OUTPUT);
/**
* @brief E-paper display driver class instance
*/
GDEP015OC1 epd(spi, PIN_EPD_CS, PIN_EPD_DC, PIN_EPD_RST, PIN_EPD_BUSY);
MCP23017 expdr(i2c, TWI_EXPANDER_ADDR, EXPDR_A_INT, GPIO_DIR::GPIO_INTERRUPT,
GPIO_PULL::OFF, GPIO_EDGE::FALLING, interruptCallback);
/**
* @brief IO-expander driver class instance. Ioexpander is connected
* to the joystick, button2 and relays
*/
MCP23017 expdr(i2c,
TWI_EXPANDER_ADDR,
EXPDR_A_INT,
GPIO_DIR::GPIO_INTERRUPT,
GPIO_PULL::OFF,
GPIO_EDGE::FALLING,
interruptCallback);
/**
* @brief Gyro, acceleration and magnetometer sensor driver class instance
*/
LSM9DS1 mems(i2c);
/**
* @brief Successive approximation adc instance. Used by sensors whose
* analog outputs are connected directly to the chip
*/
AconnoSAADC adc;
/**
* @brief Light dependent resisor driver class instance
*/
LDR light(adc, ADC_LIGHT);
/**
* @brief Potentiometer driver class instance
*/
Potentiometer pot(adc, ADC_POT);
/**
* @brief Temperature sensor driver class instance
*/
MCP9700 ambientTemperature(adc, ADC_TEMP);
Servo servo(PIN_SERVO2, 2);
AconnoBeeper beeper(1, PIN_BUZZER);
// Must be global
/**
* @brief Servo driver class instance
*/
Servo servo(PIN_SERVO2, PWM_INSTANCE_ID(2));
/**
* @brief Beeper helper class instance
*/
AconnoBeeper beeper(PWM_INSTANCE_ID(1), PIN_BUZZER);
/**
* @brief GPIO driver class for the red led
*/
AconnoGPIO ledRed(PIN_LED_RED, GPIO_DIR::GPIO_OUTPUT);
/**
* @brief GPIO driver class for the blue led
*/
AconnoGPIO ledBlue(PIN_LED_BLUE, GPIO_DIR::GPIO_OUTPUT);
/**
* @brief GPIO driver class for the green led
*/
AconnoGPIO ledGreen(PIN_LED_GREEN, GPIO_DIR::GPIO_OUTPUT);
/**
* @brief GPIO driver class for the Infrared led
*/
AconnoGPIO irLed(PIN_IRLED, GPIO_DIR::GPIO_OUTPUT);
/**
* @brief GPIO driver class for button1
*/
AconnoGPIO sw1(PIN_BUTTON, GPIO_DIR::GPIO_INPUT);
/**
* @brief GPIO driver class for led1
*/
AconnoGPIO ld1(PIN_LED, GPIO_DIR::GPIO_OUTPUT);
/**
* @brief Aconno BLE service class instance.
*/
AconnoBLEService myService;
/**
* @brief Aconno BLE characteristic class instance
*/
AconnoBLEChar myChar;
//--------------------- PUBLIC FUNCTIONS AND OBJECTS --------------------------
/**
* @brief Function called at bluetooth disconnect event
*/
void disconnectionCallback(void)
{
// Nothing
NRF_LOG_INFO("APP disconnection callback.");
AconnoBLE &myBLE = *getAconnoBLEInstance();
myBLE.startAdvertising(APP_ADV_INTERVAL, APP_ADV_DURATION);
}
/** @brief Function for application main entry.
/**
* @brief Function for application main entry.
*/
int main(void)
{
@@ -150,58 +253,141 @@ int main(void)
bspInit();
// Create all semaphores that will be used
getInterruptSourceSemaphore = xSemaphoreCreateCounting(
INTERRUPT_SEMAPHORE_MAX_COUNT,
INTERRUPT_SEMAPHORE_INITIAL_COUNT);
getInterruptSourceSemaphore = xSemaphoreCreateBinary();
if (getInterruptSourceSemaphore == NULL)
{
NRF_LOG_ERROR("ERROR, not enough space available to create semaphore!");
}
epdWriteMutex = xSemaphoreCreateMutex();
i2cWriteMutex = xSemaphoreCreateMutex();
// Create all tasks that will be used
// getInterruptSource task needs higher priority to ensure prompt interrupt
// handling
xTaskCreate(getInterruptSourceFunction, "GetInterruptSourceTask", 256, NULL,
2, &getInterruptSourceTask);
xTaskCreate(menuStateMachineTaskFunction, "MenuStateMachine", 256, NULL, 1,
xTaskCreate(getInterruptSourceFunction,
"GetInterruptSourceTask",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(2),
&getInterruptSourceTask);
xTaskCreate(menuStateMachineTaskFunction,
"MenuStateMachine",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&menuStateMachineTask);
xTaskCreate(ldrFunction, "LDR", 256, NULL, 1, &LDRTask);
xTaskCreate(potentiometerFunction, "POT", 256, NULL, 1, &potTask);
xTaskCreate(temperatureFunction, "TEMP", 256, NULL, 1, &tempTask);
xTaskCreate(gyroFunction, "GYRO", 256, NULL, 1, &gyroTask);
xTaskCreate(bleBeaconFunction, "BEACON", 256, NULL, 1, &bleTask);
xTaskCreate(infraredFunction, "INFRARED", 256, NULL, 1, &irTask);
xTaskCreate(ledsFunction, "LEDS", 256, NULL, 1, &ledsTask);
xTaskCreate(relayFunction, "RELAYS", 256, NULL, 1, &relayTask);
xTaskCreate(joystickTaskFunction, "JoystickTask", 256, NULL, 1,
&joystickExampleTask);
xTaskCreate(rgbLedTaskFunction, "rgbTask", 256, NULL, 1, &rgbLedExampleTask);
xTaskCreate(servoFunction, "SERVO", 256, NULL, 1, &servoTask);
xTaskCreate(soundFunction, "SoundTask", 256, NULL, 1, &soundExampleTask);
xTaskCreate(ldrFunction,
"LDR",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&ldrTask);
// Todo: Consider creating a static instead queue via xQueueCreateStatic()
xTaskCreate(potentiometerFunction,
"POT",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&potTask);
xTaskCreate(temperatureFunction,
"TEMP",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&tempTask);
xTaskCreate(gyroFunction,
"GYRO",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&gyroTask);
xTaskCreate(bleBeaconFunction,
"BEACON",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&bleTask);
xTaskCreate(infraredFunction,
"INFRARED",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&irTask);
xTaskCreate(ledsFunction,
"LEDS",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&ledsTask);
xTaskCreate(relayFunction,
"RELAYS",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&relayTask);
xTaskCreate(joyFunction,
"JOYSTICK",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&joyTask);
xTaskCreate(rgbFunction,
"RGB",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&rgbTask);
xTaskCreate(servoFunction,
"SERVO",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&servoTask);
xTaskCreate(soundFunction,
"SOUND",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&soundTask);
#ifdef NRF52840_XXAA
xTaskCreate(usbFunction,
"USB",
TASK_STACK_DEPTH(256),
DEFAULT_TASK_PARAMETERS,
TASK_PRIORITY(1),
&usbTask);
#endif
// Create the queues which will be used
interruptSourceQueue = xQueueCreate(QUEUE_DEFAULT_SIZE,
sizeof(IOEXP_INT_SOURCE));
sizeof(INT_SOURCE));
interruptSourceQueueSecondary = xQueueCreate(QUEUE_DEFAULT_SIZE,
sizeof(IOEXP_INT_SOURCE));
sizeof(INT_SOURCE));
if(interruptSourceQueue == NULL ||interruptSourceQueueSecondary == NULL)
{
NRF_LOG_ERROR("ERROR, not enough space available to create queues!");
}
// TODO: This part of the code still needs to be done!
// Note by Jurica
//intFlagTimer = xTimerCreate("IoexpanderInterruptTimer",
// IOEXP_INTERRUPT_TIMER_PERIOD,
// pdFALSE, // do not loop infinitely
// (void *) 0, // timer id
// intFlagTimerCallback); //timer callback
// Initialize state machine
pMenuState = new Intro1State(State::EPD_WRITE_METHOD::FULL);
pMenuState->displayOnEpd();
// Activate deep sleep mode.
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
@@ -210,6 +396,7 @@ int main(void)
applicationTimerStart();
// Initialize aconno BLE module
AconnoBLE &myBLE = *getAconnoBLEInstance();
myBLE.initBLEStack();
uint16_t myUUID = BLE_EX_CHAR_UUID;
@@ -219,6 +406,7 @@ int main(void)
myChar.charInit(BLE_EX_CHAR_SIZE_B, WRITE, false, false, NULL, imageUpdate);
myService.addChar(&myChar);
myBLE.setTXPower(4);
// Create a FreeRTOS task for the BLE stack.
// The task will run advertising_start() before entering its loop.
@@ -271,3 +459,4 @@ extern "C"
}
}
#endif
//--------------------------- INTERRUPT HANDLERS ------------------------------
File diff suppressed because it is too large Load Diff
+1053
View File
File diff suppressed because it is too large Load Diff
+278 -198
View File
@@ -8,12 +8,31 @@
* @copyright Copyright (c) 2019
*
*/
//------------------------------ INCLUDES -------------------------------------
#include "aconnoTasks.h"
#include <typeinfo>
#include "timers.h"
#include "aconnoBeeper.h"
#ifdef NRF52840_XXAA
#include "aconnoUSBMouse.h"
#endif
//-------------------------------- MACROS -------------------------------------
//----------------------------- DATA TYPES ------------------------------------
//--------------------- PRIVATE FUNCTION PROTOTYPES ---------------------------
//----------------------- STATIC DATA & CONSTANTS -----------------------------
//------------------------------ GLOBAL DATA ----------------------------------
extern TaskHandle_t menuStateMachineTask;
extern SemaphoreHandle_t getInterruptSourceSemaphore;
extern SemaphoreHandle_t epdWriteMutex;
extern SemaphoreHandle_t i2cWriteMutex;
extern State *pMenuState;
extern QueueHandle_t interruptSourceQueue;
extern QueueHandle_t interruptSourceQueueSecondary;
uint8_t intSrcPin;
INT_SOURCE intSourceSend = INT_SOURCE::NOTHING;
INT_SOURCE intSourceRecv = INT_SOURCE::NOTHING;
INT_SOURCE intSourceRecvSecondary = INT_SOURCE::NOTHING;
extern AconnoSPI spi;
extern AconnoI2C i2c;
@@ -31,46 +50,24 @@ extern LDR light;
extern Potentiometer pot;
extern MCP9700 ambientTemperature;
extern Servo servo;
extern SemaphoreHandle_t getInterruptSourceSemaphore;
extern State *pMenuState;
extern uint8_t irFlag;
extern QueueHandle_t interruptSourceQueue;
IOEXP_INT_SOURCE intSourceSend = IOEXP_INT_SOURCE::NOTHING;
IOEXP_INT_SOURCE intSourceRecv = IOEXP_INT_SOURCE::NOTHING;
IOEXP_INT_SOURCE intSourceRecvSecondary = IOEXP_INT_SOURCE::NOTHING;
extern AconnoBeeper beeper;
extern bool gBleTaskSuspend;
/**
* @brief A flag to help with initial drawing of the joystick example
*
*/
extern uint8_t joyFlag;
/**
* @brief secondary interrupt Source queue meant to be used by tasks that
* require interrupts from ioexpander
*/
extern QueueHandle_t interruptSourceQueueSecondary;
/**
* @brief Flag which is used to prevent interrupts that are sent by ioexpander
* while a button is continuously pressed
*/
bool getInterruptSourceFlag = true;
extern TimerHandle_t intFlagTimer;
extern uint8_t gJoyFlag;
extern uint8_t gIrFlag;
extern uint8_t gLdrFlag;
extern uint8_t gTempFlag;
/**< Definition of Logger thread. */
#if NRF_LOG_ENABLED
TaskHandle_t mLoggerThread;
void loggerThread(void *arg);
#endif
//--------------------- PUBLIC FUNCTIONS AND OBJECTS --------------------------
void logTaskFunction(void *arg)
{
#if NRF_LOG_ENABLED
if(pdPASS != xTaskCreate(loggerThread, "LOGGER", 256, NULL, 1,
if(pdPASS != xTaskCreate(loggerThread, "LOGGER", 128, NULL, 1,
&mLoggerThread))
{
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
@@ -83,49 +80,38 @@ void logTaskFunction(void *arg)
}
}
void interruptCallback()
{
// resume task to get button
xSemaphoreGive(getInterruptSourceSemaphore);
}
void getInterruptSourceFunction(void *arg)
{
while(1)
{
if(xSemaphoreTake(getInterruptSourceSemaphore, portMAX_DELAY) == pdTRUE)
{
xSemaphoreTake(i2cWriteMutex, portMAX_DELAY);
expdr.interruptPinDisable();
uint8_t intSrcPin = expdr.getLastInterruptPin();
if(expdr.readGPIOBit(intSrcPin))
{
// last interrupt reads nothing pressed
intSourceSend = IOEXP_INT_SOURCE::NOTHING;
getInterruptSourceFlag = true;
}
// only send a message if this is the first interrupt after a while
else if(getInterruptSourceFlag)
{
getInterruptSourceFlag=false;
intSourceSend = (IOEXP_INT_SOURCE)intSrcPin;
intSourceSend = (INT_SOURCE)intSrcPin;
xQueueSendToBack(interruptSourceQueue,
(void *) &intSourceSend,
((TickType_t)TICKS_TO_BLOCK_DEFAULT) != pdPASS);
xQueueSendToBack(interruptSourceQueueSecondary,
(void *) &intSourceSend,
((TickType_t)TICKS_TO_BLOCK_DEFAULT) != pdPASS);
// TODO: This part of the code still needs to be done!
//xTimerReset(intFlagTimer, TICKS_TO_BLOCK_DEFAULT);
}
// give other code a chance to execute since we have a higher
// priority
vTaskDelay(GET_INTERRUPT_DELAY_MS);
xQueueSendToBack(interruptSourceQueue,
(void *) &intSourceSend,
((TickType_t)TICKS_TO_BLOCK_DEFAULT) != pdPASS);
//todo: Consider enclosing epd writing in a critical section
// as is done in the joystick example
xQueueSendToBack(interruptSourceQueueSecondary,
(void *) &intSourceSend,
((TickType_t)TICKS_TO_BLOCK_DEFAULT) != pdPASS);
// Wait until the button is not being pressed
while(expdr.readGPIOBit(intSrcPin) == 0)
{
//NRF_LOG_INFO("Waiting till the button is nto being pressed.");
}
NRF_LOG_INFO("Joystick interrupt.");
expdr.interruptPinEnable();
expdr.readRegister(MCP23017_INTCAP);
xSemaphoreGive(i2cWriteMutex);
}
}
}
void menuStateMachineTaskFunction(void *arg)
@@ -136,8 +122,7 @@ void menuStateMachineTaskFunction(void *arg)
&(intSourceRecv),
portMAX_DELAY))
{
/* Todo: delete could make problems if the same state is returned */
xSemaphoreTake(epdWriteMutex, portMAX_DELAY);
State *newMenuState = pMenuState->handleEvent(intSourceRecv);
if(typeid(*pMenuState) != typeid(*newMenuState))
{
@@ -145,20 +130,18 @@ void menuStateMachineTaskFunction(void *arg)
pMenuState = newMenuState;
pMenuState->displayOnEpd();
}
else
else
{
delete pMenuState;
delete pMenuState;
pMenuState = newMenuState;
}
xSemaphoreGive(epdWriteMutex);
}
/* todo: consider pre-creating all state objects instead of
dinamically creating and destroying objects */
/* todo: consider dynamically deleting tasks after a certain treshold
in case memory becomes a problem */
}
}
void ldrFunction(void *arg)
@@ -166,18 +149,20 @@ void ldrFunction(void *arg)
vTaskSuspend(NULL);
aconnoSensorData_t data;
//Leave this zero so the next if statement must be executed at the begining
float voltage = 0;
uint16_t x_coord;
uint16_t y_coord;
gLdrFlag = 0;
adc.calibrate();
vTaskDelay(25); // Small delay required by adc to calibrate
while(1)
{
{
light.updateData(&data);
if(data.light<voltage-0.05f || data.light>voltage+0.05f)
if(data.light < voltage - 0.05f || data.light > voltage + 0.05f || gLdrFlag == 1 )
{
gLdrFlag = 0;
voltage = data.light;
if (voltage<0.10f) { x_coord = 40; y_coord = 135; }
else if(voltage<0.20f) { x_coord = 43; y_coord = 130; }
@@ -190,9 +175,11 @@ void ldrFunction(void *arg)
else if(voltage<0.90f) { x_coord = 141; y_coord = 95; }
else { x_coord = 100; y_coord = 85; }
xSemaphoreTake(epdWriteMutex, portMAX_DELAY);
epd.drawImage(ldr1);
epd.drawLine(100,135,x_coord,y_coord,0);
epd.write();
xSemaphoreGive(epdWriteMutex);
}
vTaskDelay(EXAMPLE_DELAY_MS);
}
@@ -201,29 +188,32 @@ void ldrFunction(void *arg)
void potentiometerFunction(void *arg)
{
vTaskSuspend(NULL);
aconnoSensorData_t data;
static float voltage;
adc.calibrate();
vTaskDelay(25); // Small delay required by adc to calibrate
pot.updateData(&data);
voltage = data.voltage;
while(1)
{
xSemaphoreTake(epdWriteMutex, portMAX_DELAY);
pot.updateData(&data);
if(data.voltage>voltage+0.05f)
if(data.voltage > voltage + 0.02f)
{
epd.drawImage(potCW);
epd.write();
}
else if(data.voltage<voltage-0.05f)
else if(data.voltage < voltage - 0.02f)
{
epd.drawImage(potCCW);
epd.write();
}
voltage = data.voltage;
vTaskDelay(EXAMPLE_DELAY_MS);
xSemaphoreGive(epdWriteMutex);
vTaskDelay(POT_DELAY_MS);
}
}
@@ -232,20 +222,20 @@ void temperatureFunction(void *arg)
vTaskSuspend(NULL);
aconnoSensorData_t data;
float temperature=0;
float temperature = 0;
char buffer[10];
int n;
gTempFlag = 0;
adc.calibrate();
adc.updateData(); //to clear the ADC buffer
vTaskDelay(25); // Small delay required by adc to calibrate
while(1)
{
ambientTemperature.updateData(&data);
if(data.temperature>temperature+0.5f ||
data.temperature<temperature-0.5f)
if(data.temperature > temperature + 0.5f ||
data.temperature < temperature - 0.5f || gTempFlag == 1)
{
xSemaphoreTake(epdWriteMutex, portMAX_DELAY);
gTempFlag = 0;
// Erase previous data from the buffer
epd.writeString(buffer,110,100,1);
@@ -257,10 +247,11 @@ void temperatureFunction(void *arg)
int tmpInt1 = tmpVal; // Get the integer
float tmpFrac = tmpVal - tmpInt1; // Get fraction
int tmpInt2 = trunc(tmpFrac * 100); // Turn fraction into integer
n = sprintf(buffer, "%c%d.%d", tmpSign, tmpInt1, tmpInt2); //Create a string
sprintf(buffer, "%c%d.%d", tmpSign, tmpInt1, tmpInt2); //Create a string
epd.writeString(buffer,110,100,0); // Write new data to the buffer
epd.write();
epd.writeString(buffer, 110, 100, 0); // Write new data to the buffer
epd.write();
xSemaphoreGive(epdWriteMutex);
}
vTaskDelay(EXAMPLE_DELAY_MS);
}
@@ -269,7 +260,7 @@ void temperatureFunction(void *arg)
void gyroFunction(void *arg)
{
vTaskSuspend(NULL);
aconnoSensorData_t data;
aconnoSensorVec_t gyroVal;
i2c.enable();
@@ -283,10 +274,11 @@ void gyroFunction(void *arg)
gyroVal.y = data.gyro.y * (245.0f/32768.0f);
gyroVal.z = data.gyro.z * (245.0f/32768.0f);
if((gyroVal.x>50.0f) || (gyroVal.x<(-50.0f)) ||
(gyroVal.y>50.0f) || (gyroVal.y<(-50.0f)) ||
(gyroVal.z>50.0f) || (gyroVal.z<(-50.0f)))
if((gyroVal.x > 50.0f) || (gyroVal.x < (-50.0f)) ||
(gyroVal.y > 50.0f) || (gyroVal.y < (-50.0f)) ||
(gyroVal.z > 50.0f) || (gyroVal.z < (-50.0f)))
{
xSemaphoreTake(epdWriteMutex, portMAX_DELAY);
switch(rand()%6+1)
{
#define C(x) epd.fillCircle(100,100,10,x)
@@ -335,8 +327,9 @@ void gyroFunction(void *arg)
#undef CR
#undef CL
#undef C
}
}
}
xSemaphoreGive(epdWriteMutex);
}
vTaskDelay(EXAMPLE_DELAY_MS);
}
}
@@ -352,12 +345,13 @@ void bleBeaconFunction(void *arg)
static aconnoSensorData_t data;
advertisementPacket.settingsFlag = SETTINGS_SUPPORT_FLAG;
advertisementPacket.versionNumber = PRODUCT_VERSION;
adc.calibrate();
vTaskDelay(25); // Small delay required by adc to calibrate
while(1)
{
myBLE.startAdvertising(APP_ADV_INTERVAL, APP_ADV_DURATION);
NRF_LOG_INFO("Advertising started.");
while(!gBleTaskSuspend)
{
if(advertisementPacket.advType == FIRST_PACKET_ID)
@@ -398,7 +392,6 @@ void bleBeaconFunction(void *arg)
pot.updateData(&data);
advertisementPacket.pot = (uint8_t)(data.voltage*255);
}
myBLE.advRawUpdate((uint8_t*)&advertisementPacket,
sizeof(advertisementPacket_t));
advertisementPacket.advType = (advertisementPacket.advType+1)%2;
@@ -416,23 +409,24 @@ void imageUpdate(uint8_t const *data, size_t dataLen)
{
static uint16_t epdPointer = 0;
xSemaphoreTake(epdWriteMutex, portMAX_DELAY);
for(uint16_t x = 0; x < dataLen; x++)
{
epd.fill(data[x], epdPointer);
epdPointer++;
}
if(epdPointer == EPD_BUFFER_SIZE)
{
epdPointer = 0;
epd.writeFull();
NRF_LOG_INFO("Image updated.");
}
xSemaphoreGive(epdWriteMutex);
}
void infraredFunction(void *arg)
{
irFlag = 0;
gIrFlag = 0;
vTaskSuspend(NULL);
uint8_t SOS[] = {
0, 1, 0, 1, 0, 1, // S
@@ -445,13 +439,12 @@ void infraredFunction(void *arg)
while(1)
{
if(irFlag==1)
if(gIrFlag == 1)
{
irIndex = 0;
irFlag = 0;
gIrFlag = 0;
}
if(SOS[irIndex]==0)
if(SOS[irIndex] == 0)
{
irLed.write(GPIO_STATE::LOW);
}
@@ -460,7 +453,7 @@ void infraredFunction(void *arg)
irLed.write(GPIO_STATE::HIGH);
}
vTaskDelay(INFRARED_DELAY_MS);
irIndex = (irIndex+1)%sosSize;
irIndex = (irIndex + 1) % sosSize;
}
}
@@ -470,9 +463,10 @@ void ledsFunction(void *arg)
while(1)
{
if(expdr.readGPIOBit(MCP23017_SW2)==0)
xSemaphoreTake(i2cWriteMutex, portMAX_DELAY);
if(expdr.readGPIOBit(MCP23017_SW2) == 0)
{
if(expdr.readGPIOBit(MCP23017_LED2)==0)
if(expdr.readGPIOBit(MCP23017_LED2) == 0)
{
expdr.writeGPIOBit(1, MCP23017_LED2);
}
@@ -481,10 +475,11 @@ void ledsFunction(void *arg)
expdr.writeGPIOBit(0, MCP23017_LED2);
}
}
else if(sw1.read()==GPIO_STATE::LOW)
else if(sw1.read() == GPIO_STATE::LOW)
{
ld1.toggle();
}
xSemaphoreGive(i2cWriteMutex);
vTaskDelay(EXAMPLE_DELAY_MS);
}
}
@@ -493,11 +488,15 @@ void relayFunction(void *arg)
{
vTaskSuspend(NULL);
NRF_LOG_INFO("I'm in relay function.");
while(1)
{
xSemaphoreTake(i2cWriteMutex, portMAX_DELAY);
if(expdr.readGPIOBit(MCP23017_SW2) == 0)
{
if(expdr.readGPIOBit(MCP23017_REL2)==0)
if(expdr.readGPIOBit(MCP23017_REL2) == 0)
{
expdr.writeGPIOBit(1, MCP23017_REL2);
}
@@ -506,9 +505,9 @@ void relayFunction(void *arg)
expdr.writeGPIOBit(0, MCP23017_REL2);
}
}
else if(sw1.read()==GPIO_STATE::LOW)
else if(sw1.read() == GPIO_STATE::LOW)
{
if(expdr.readGPIOBit(MCP23017_REL1)==0)
if(expdr.readGPIOBit(MCP23017_REL1) == 0)
{
expdr.writeGPIOBit(1, MCP23017_REL1);
}
@@ -517,11 +516,14 @@ void relayFunction(void *arg)
expdr.writeGPIOBit(0, MCP23017_REL1);
}
}
xSemaphoreGive(i2cWriteMutex);
vTaskDelay(EXAMPLE_DELAY_MS);
}
}
void joystickTaskFunction(void *arg)
void joyFunction(void *arg)
{
//center coordinates
uint16_t xCoordCenter = 100;
@@ -540,36 +542,34 @@ void joystickTaskFunction(void *arg)
};
BALL_POSITION ballPosition = BALL_POSITION::CENTER;
BALL_POSITION ballPositionPrev = BALL_POSITION::CENTER;
vTaskSuspend(NULL);
while(1)
{
if(xQueueReceive(interruptSourceQueueSecondary,
&(intSourceRecvSecondary),
(TickType_t) 10))
{
if (joyFlag)
if (gJoyFlag)
{
joyFlag = 0;
xSemaphoreTake(epdWriteMutex, portMAX_DELAY);
gJoyFlag = 0;
epd.drawImage(joystick1);
epd.fillCircle(xCoordCenter,
yCoordCenter,
ballRadius,
color);
// do not allow task suspending while epd writing
vTaskSuspendAll();
epd.write();
xTaskResumeAll();
xSemaphoreGive(epdWriteMutex);
}
epd.drawImage(joystick1);
switch (intSourceRecvSecondary)
ballPositionPrev = ballPosition;
switch(intSourceRecvSecondary)
{
case IOEXP_INT_SOURCE::JOY_UP:
case INT_SOURCE::JOY_UP:
{
switch (ballPosition)
switch(ballPosition)
{
case BALL_POSITION::CENTER:
{
@@ -588,9 +588,9 @@ void joystickTaskFunction(void *arg)
}
break;
}
case IOEXP_INT_SOURCE::JOY_DOWN:
case INT_SOURCE::JOY_DOWN:
{
switch (ballPosition)
switch(ballPosition)
{
case BALL_POSITION::CENTER:
{
@@ -609,22 +609,20 @@ void joystickTaskFunction(void *arg)
}
break;
}
case IOEXP_INT_SOURCE::JOY_LEFT:
case INT_SOURCE::JOY_LEFT:
{
switch (ballPosition)
switch(ballPosition)
{
case BALL_POSITION::CENTER:
{
ballPosition = BALL_POSITION::LEFT;
break;
}
case BALL_POSITION::RIGHT:
{
ballPosition = BALL_POSITION::CENTER;
break;
}
default:
{
break;
@@ -632,9 +630,9 @@ void joystickTaskFunction(void *arg)
}
break;
}
case IOEXP_INT_SOURCE::JOY_RIGHT:
case INT_SOURCE::JOY_RIGHT:
{
switch (ballPosition)
switch(ballPosition)
{
case BALL_POSITION::CENTER:
{
@@ -653,7 +651,7 @@ void joystickTaskFunction(void *arg)
}
break;
}
case IOEXP_INT_SOURCE::JOY_CENTER:
case INT_SOURCE::JOY_CENTER:
{
ballPosition = BALL_POSITION::CENTER;
break;
@@ -663,75 +661,79 @@ void joystickTaskFunction(void *arg)
break;
}
}
vTaskSuspend(menuStateMachineTask);
switch (ballPosition)
if(ballPositionPrev != ballPosition)
{
case BALL_POSITION::UP:
xSemaphoreTake(epdWriteMutex, portMAX_DELAY);
epd.drawImage(joystick1);
switch(ballPosition)
{
epd.fillCircle(xCoordCenter,
yCoordCenter-centerOffset,
ballRadius,
color);
epd.write();
break;
}
case BALL_POSITION::DOWN:
{
epd.fillCircle(xCoordCenter,
yCoordCenter+centerOffset,
ballRadius,
color);
epd.write();
break;
}
case BALL_POSITION::LEFT:
{
epd.fillCircle(xCoordCenter-centerOffset,
yCoordCenter,
ballRadius,
color);
epd.write();
break;
}
case BALL_POSITION::RIGHT:
{
epd.fillCircle(xCoordCenter+centerOffset,
yCoordCenter,
ballRadius,
color);
epd.write();
break;
}
case BALL_POSITION::CENTER:
{
epd.fillCircle(xCoordCenter,
yCoordCenter,
ballRadius,
color);
epd.write();
break;
}
default:
{
break;
case BALL_POSITION::UP:
{
epd.fillCircle(xCoordCenter,
yCoordCenter-centerOffset,
ballRadius,
color);
epd.write();
break;
}
case BALL_POSITION::DOWN:
{
epd.fillCircle(xCoordCenter,
yCoordCenter+centerOffset,
ballRadius,
color);
epd.write();
break;
}
case BALL_POSITION::LEFT:
{
epd.fillCircle(xCoordCenter-centerOffset,
yCoordCenter,
ballRadius,
color);
epd.write();
break;
}
case BALL_POSITION::RIGHT:
{
epd.fillCircle(xCoordCenter+centerOffset,
yCoordCenter,
ballRadius,
color);
epd.write();
break;
}
case BALL_POSITION::CENTER:
{
epd.fillCircle(xCoordCenter,
yCoordCenter,
ballRadius,
color);
epd.write();
break;
}
default:
{
break;
}
}
xSemaphoreGive(epdWriteMutex);
}
vTaskResume(menuStateMachineTask);
}
}
}
void rgbLedTaskFunction(void *arg)
void rgbFunction(void *arg)
{
vTaskSuspend(NULL);
while(1)
{
uint8_t x = rand()%7;
ledRed.write((GPIO_STATE)((x>>2)&1));
ledGreen.write((GPIO_STATE)((x>>1)&1));
ledBlue.write((GPIO_STATE)((x>>0)&1));
vTaskDelay(rand()%250); // Wait some random time
{
// Randomly generate a state for the rgb leds to be in
uint8_t x = rand() % 7;
ledRed.write((GPIO_STATE)((x >> 2) & 1));
ledGreen.write((GPIO_STATE)((x >> 1) & 1));
ledBlue.write((GPIO_STATE)((x >> 0) & 1));
vTaskDelay(rand() % 250);
}
}
@@ -742,40 +744,46 @@ void servoFunction(void *arg)
servo.init();
servo.calibrate(0.00095, 90);
servo.enable();
servo.write(0.5f);
waitMs(SERVO_DELAY_MS);
servo.disable();
while(1)
{
switch (intSourceSend)
switch(intSourceSend)
{
case IOEXP_INT_SOURCE::JOY_LEFT:
case INT_SOURCE::JOY_LEFT:
{
if(servo.read()>0.1)
if(servo.read() > 0.1)
{
intSourceSend = INT_SOURCE::NOTHING;
servo.enable();
percentage = servo.read() - 0.1f;
servo.write(percentage);
waitMs(SERVO_DELAY_MS);
servo.disable();
}
break;
}
case IOEXP_INT_SOURCE::JOY_RIGHT:
}
case INT_SOURCE::JOY_RIGHT:
{
if(servo.read()<0.90)
if(servo.read() < 0.90)
{
intSourceSend = INT_SOURCE::NOTHING;
servo.enable();
percentage = servo.read() + 0.1f;
servo.write(percentage);
waitMs(SERVO_DELAY_MS);
servo.disable();
}
break;
}
default:
{
servo.write(servo.read());
waitMs(SERVO_DELAY_MS);
break;
break;
}
}
NRF_LOG_INFO("Percentage is" NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(percentage));
vTaskDelay(EXAMPLE_DELAY_MS);
}
}
@@ -789,3 +797,75 @@ void soundFunction(void *arg)
beeper.playRttl(song);
}
}
#ifdef NRF52840_XXAA
void usbFunction(void *arg)
{
vTaskSuspend(NULL);
ret_code_t ret;
usbSetup();
while(1)
{
while(1)
{
while (app_usbd_event_queue_process())
{
/* Nothing to do */
}
if(xQueueReceive(interruptSourceQueueSecondary,
&(intSourceRecvSecondary),
(TickType_t) 10))
{
switch(intSourceRecvSecondary)
{
case INT_SOURCE::JOY_UP:
{
NRF_LOG_INFO("INT_SOURCE::JOY_UP");
hidGenericMouseProcessState(USB_DIR::UP);
break;
}
case INT_SOURCE::JOY_DOWN:
{
NRF_LOG_INFO("INT_SOURCE::JOY_DOWN");
hidGenericMouseProcessState(USB_DIR::DOWN);
break;
}
case INT_SOURCE::JOY_LEFT:
{
NRF_LOG_INFO("INT_SOURCE::JOY_LEFT");
hidGenericMouseProcessState(USB_DIR::LEFT);
break;
}
case INT_SOURCE::JOY_RIGHT:
{
NRF_LOG_INFO("INT_SOURCE::JOY_RIGHT");
hidGenericMouseProcessState(USB_DIR::RIGHT);
break;
}
default:
{
break;
}
}
}
else if(sw1.read() == GPIO_STATE::LOW)
{
hidGenericMouseStopState();
}
UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
}
}
};
#endif
//--------------------------- INTERRUPT HANDLERS ------------------------------
void interruptCallback()
{
xSemaphoreGiveFromISR(getInterruptSourceSemaphore, NULL);
}
+22 -17
View File
@@ -8,20 +8,20 @@
* @copyright Copyright (c) 2019
*
*/
#ifndef __ACONNO_TASKS_H__
#define __ACONNO_TASKS_H__
//------------------------------ INCLUDES -------------------------------------
//----------------------------- DATA TYPES ------------------------------------
//-------------------------- CONSTANTS & MACROS -------------------------------
#include "FreeRTOS.h"
#include "aconnoBLE.h"
#include "aconnoConfig.h"
#include "nrf_gpio.h"
#include "semphr.h"
#include "aconnoHelpers.h"
#include "acd52832Bsp.h"
#include "aconnoBsp.h"
#include "pictures.h"
#include <math.h>
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
@@ -29,14 +29,13 @@
#define EXAMPLE_DELAY_MS (201)
#define BEACON_DELAY_MS (250)
#define INFRARED_DELAY_MS (150)
#define INTERRUPT_SEMAPHORE_MAX_COUNT (10)
#define INTERRUPT_SEMAPHORE_INITIAL_COUNT (0)
#define IOEXP_INTERRUPT_TIMER_PERIOD (500)
#define QUEUE_DEFAULT_SIZE (10)
#define TICKS_TO_BLOCK_DEFAULT (10)
#define GET_INTERRUPT_DELAY_MS (1)
#define SERVO_DELAY_MS (50)
#define SERVO_DELAY_MS (100)
#define POT_DELAY_MS (500)
//----------------------------PUBLIC PROTOTYPES -------------------------------
/**
* @brief Function logger
*
@@ -72,13 +71,7 @@ void jumperTaskFunction(void *arg);
*
* @param arg
*/
void joystickTaskFunction(void *arg);
/**
* @brief A callback for mainMenu button joystick press
*
*/
void interruptCallback();
void joyFunction(void *arg);
/**
* @brief
@@ -152,7 +145,7 @@ void relayFunction(void *arg);
*
* @param arg
*/
void rgbLedTaskFunction(void *arg);
void rgbFunction(void *arg);
/**
* @brief Servo example task
*
@@ -167,5 +160,17 @@ void servoFunction(void *arg);
*/
void soundFunction(void *arg);
/**
* @brief USB example task function
*
* @param arg
*/
void usbFunction(void *arg);
#endif // __ACONNO_TASKS_H__
/**
* @brief A callback for mainMenu button joystick press
*
*/
void interruptCallback();
#endif // __ACONNO_TASKS_H__