forked from Elron_dev/elbear_arduino_bsp
Обновление до версии 0.3.0
- обновлен elbear_fw_bootloader - добавлена проверка контрольной суммы каждой строки hex файла. - в модуль работы с АЦП добавлена функция analogReadResolution(). Функция analogRead() теперь возвращает усредненное по 10 измерениям значение. - общая функция обработки прерываний перенесена в память RAM. Обработчики прерываний модулей External Interrupts и Advanced I/O (функция tone()) так же перенесены в память RAM для увеличения скорости выполнения кода. - в пакет добавлены библиотеки EEPROM, Servo, SoftSerial, NeoPixel, MFRC522 адаптированные для работы с платой Elbear Ace-Uno. - добавлено описание особенностей работы с пакетом
This commit is contained in:
1 parent
2044614aba
commit
7261b03ea1
114 files changed
+11064
-666
No files matched your search
@@ -4,8 +4,7 @@
|
||||
#include "pins_arduino.h"
|
||||
#include "wiring_digital.h"
|
||||
#include "WInterrupts.h"
|
||||
|
||||
extern void ErrorMsgHandler(const char * msg);
|
||||
#include "wiring_LL.h"
|
||||
|
||||
typedef void (*voidFuncPtr)(void);
|
||||
|
||||
@@ -18,13 +17,13 @@ static void nothing(void)
|
||||
// enable global interrupts
|
||||
void interrupts(void)
|
||||
{
|
||||
HAL_IRQ_EnableInterrupts();
|
||||
GLOBAL_IRQ_ENABLE();
|
||||
}
|
||||
|
||||
// disable global interrupts
|
||||
void noInterrupts(void)
|
||||
{
|
||||
HAL_IRQ_DisableInterrupts();
|
||||
GLOBAL_IRQ_DISABLE();
|
||||
}
|
||||
|
||||
// we can provide no more than 8 interrupts on gpio at the same time
|
||||
@@ -100,33 +99,26 @@ void detachInterrupt(uint8_t interruptNum)
|
||||
void disableInterrupt(uint8_t interruptNum)
|
||||
{
|
||||
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
|
||||
{
|
||||
int irq_line_num = interruptToGpioIntLine(interruptNum) >> GPIO_IRQ_LINE_S;
|
||||
// disable gpio interrupt line
|
||||
GPIO_IRQ->ENABLE_CLEAR = (1 << irq_line_num);
|
||||
}
|
||||
GPIO_IRQ_LINE_DISABLE(interruptToGpioIntLine(interruptNum));
|
||||
}
|
||||
|
||||
// enable single interrupt
|
||||
void enableInterrupt(uint8_t interruptNum)
|
||||
{
|
||||
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
|
||||
{
|
||||
int irq_line_num = interruptToGpioIntLine(interruptNum) >> GPIO_IRQ_LINE_S;
|
||||
// enable gpio interrupt line
|
||||
GPIO_IRQ->ENABLE_SET = (1 << irq_line_num);
|
||||
}
|
||||
GPIO_IRQ_LINE_ENABLE(interruptToGpioIntLine(interruptNum));
|
||||
}
|
||||
|
||||
// common gpio interrupt handler
|
||||
void gpio_interrupts_handler(void)
|
||||
void __attribute__((noinline, section(".ram_text"), optimize("O3"))) gpio_interrupt_handler(void)
|
||||
{
|
||||
// go through all the interrupts and call the handler for the triggered line
|
||||
for (uint8_t i = 0; i < EXTERNAL_NUM_INTERRUPTS; i++)
|
||||
{
|
||||
if (HAL_GPIO_LineInterruptState(interruptToGpioIntLine(i)))
|
||||
if (GPIO_IRQ_LINE_STATE(interruptToGpioIntLine(i)))
|
||||
intFunc[i]();
|
||||
}
|
||||
|
||||
HAL_GPIO_ClearInterrupts();
|
||||
GPIO_IRQ_CLEAR_ALL();
|
||||
}
|
||||
Reference in new issue
Block a user