- обновлен elbear_fw_bootloader - добавлена проверка контрольной суммы каждой строки hex файла. - в модуль работы с АЦП добавлена функция analogReadResolution(). Функция analogRead() теперь возвращает усредненное по 10 измерениям значение. - общая функция обработки прерываний перенесена в память RAM. Обработчики прерываний модулей External Interrupts и Advanced I/O (функция tone()) так же перенесены в память RAM для увеличения скорости выполнения кода. - в пакет добавлены библиотеки EEPROM, Servo, SoftSerial, NeoPixel, MFRC522 адаптированные для работы с платой Elbear Ace-Uno. - добавлено описание особенностей работы с пакетом
45 lines
991 B
C++
45 lines
991 B
C++
#include "board.h"
|
|
#include "mik32_hal_pcc.h"
|
|
#include "mik32_hal_irq.h"
|
|
#include "Arduino.h"
|
|
|
|
// --------------------- init --------------------- //
|
|
// called before setup()
|
|
void pre_init(void)
|
|
{
|
|
// set irq vector to ram region
|
|
write_csr(mtvec, 0x02000000);
|
|
|
|
HAL_Init();
|
|
|
|
// gpio clock
|
|
__HAL_PCC_GPIO_0_CLK_ENABLE();
|
|
__HAL_PCC_GPIO_1_CLK_ENABLE();
|
|
__HAL_PCC_GPIO_2_CLK_ENABLE();
|
|
__HAL_PCC_GPIO_IRQ_CLK_ENABLE();
|
|
|
|
// for delays
|
|
SysTick_Init();
|
|
}
|
|
|
|
// called after setup()
|
|
void post_init(void)
|
|
{
|
|
// enable global interrupts by default
|
|
interrupts();
|
|
}
|
|
|
|
// --------------------- other --------------------- //
|
|
volatile bool use_error_messages = true;
|
|
// print error message to Serial
|
|
extern "C" void ErrorMsgHandler(const char * msg)
|
|
{
|
|
// function works if Serial is used in sketch and user doesn't turn it off
|
|
#ifdef HardwareSerial_h
|
|
if(use_error_messages&&Serial)
|
|
Serial.println(msg);
|
|
#endif
|
|
}
|
|
|
|
|