forked from Elron_dev/elbear_arduino_bsp
добавила возможность отключать сообщения об ошибках. убрала лишнее подтягивание этой функции
This commit is contained in:
parent
e77ae5935b
commit
0d8fb21261
@ -6,8 +6,6 @@
|
|||||||
#include "WInterrupts.h"
|
#include "WInterrupts.h"
|
||||||
#include "wiring_LL.h"
|
#include "wiring_LL.h"
|
||||||
|
|
||||||
extern void ErrorMsgHandler(const char * msg);
|
|
||||||
|
|
||||||
typedef void (*voidFuncPtr)(void);
|
typedef void (*voidFuncPtr)(void);
|
||||||
|
|
||||||
// empty irq handler
|
// empty irq handler
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wrestrict" // для GCC и Clang
|
#pragma GCC diagnostic ignored "-Wrestrict" // for GCC and Clang
|
||||||
|
|
||||||
#include "WString.h"
|
#include "WString.h"
|
||||||
#include "itoa.h"
|
#include "itoa.h"
|
||||||
|
|||||||
@ -30,13 +30,15 @@ void post_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --------------------- other --------------------- //
|
// --------------------- other --------------------- //
|
||||||
// print text if Serial is enabled
|
volatile bool use_error_messages = true;
|
||||||
|
// print error message to Serial
|
||||||
extern "C" void ErrorMsgHandler(const char * msg)
|
extern "C" void ErrorMsgHandler(const char * msg)
|
||||||
{
|
{
|
||||||
#ifdef HardwareSerial_h
|
// function works if Serial is used in sketch and user doesn't turn it off
|
||||||
if(Serial)
|
#ifdef HardwareSerial_h
|
||||||
|
if(use_error_messages&&Serial)
|
||||||
Serial.println(msg);
|
Serial.println(msg);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
#ifndef _BOARD_H_
|
#ifndef _BOARD_H_
|
||||||
#define _BOARD_H_
|
#define _BOARD_H_
|
||||||
|
|
||||||
|
extern volatile bool use_error_messages;
|
||||||
|
#define DISABLE_ERROR_MESSAGES() (use_error_messages = false)
|
||||||
|
#define ENABLE_ERROR_MESSAGES() (use_error_messages = true)
|
||||||
|
|
||||||
// functions for init called before and after setup()
|
// functions for init called before and after setup()
|
||||||
void pre_init(void) ;
|
void pre_init(void) ;
|
||||||
void post_init(void);
|
void post_init(void);
|
||||||
|
|||||||
@ -8,7 +8,6 @@ extern "C" {
|
|||||||
#include "mik32_hal_gpio.h"
|
#include "mik32_hal_gpio.h"
|
||||||
#include "mik32_hal_timer32.h"
|
#include "mik32_hal_timer32.h"
|
||||||
|
|
||||||
extern void ErrorMsgHandler(const char * msg);
|
|
||||||
|
|
||||||
// -------------------------- Analog read -------------------------- //
|
// -------------------------- Analog read -------------------------- //
|
||||||
#define ADC_SAMPLES_QTY 10 // samples quantity for averaging adc results
|
#define ADC_SAMPLES_QTY 10 // samples quantity for averaging adc results
|
||||||
|
|||||||
@ -24,8 +24,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void ErrorMsgHandler(const char * msg);
|
|
||||||
|
|
||||||
// initialization
|
// initialization
|
||||||
void pinMode(uint32_t PinNumber, uint32_t PinMode)
|
void pinMode(uint32_t PinNumber, uint32_t PinMode)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,14 +16,6 @@
|
|||||||
#include "wiring_analog.h"
|
#include "wiring_analog.h"
|
||||||
#include "wiring_LL.h"
|
#include "wiring_LL.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
void ErrorMsgHandler(const char * msg);
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool spiNssPinIsBlocked = false;
|
bool spiNssPinIsBlocked = false;
|
||||||
|
|
||||||
// list of pin numbers from both ports with pins inside the port
|
// list of pin numbers from both ports with pins inside the port
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user