вернула проверку прерываний, все еще работает
This commit is contained in:
1 parent
5d5ec4de22
commit
04f2e12ecc
2 files changed
+17
-12
No files matched your search
@@ -26,17 +26,17 @@ void trap_handler(void)
|
||||
if (EPIC_CHECK_TIMER16_1())
|
||||
tone_interrupt_handler();
|
||||
|
||||
// // uart0 interrupt
|
||||
// if (EPIC_CHECK_UART_0())
|
||||
// serial_handler_wrapper(0);
|
||||
// uart0 interrupt
|
||||
if (EPIC_CHECK_UART_0())
|
||||
serial_handler_wrapper(0);
|
||||
|
||||
// // uart1 interrupt
|
||||
// if (EPIC_CHECK_UART_1())
|
||||
// serial_handler_wrapper(1);
|
||||
// uart1 interrupt
|
||||
if (EPIC_CHECK_UART_1())
|
||||
serial_handler_wrapper(1);
|
||||
|
||||
// // i2c interrupt
|
||||
// if (EPIC_CHECK_I2C_1())
|
||||
// wire_handler_wrapper();
|
||||
// i2c interrupt
|
||||
if (EPIC_CHECK_I2C_1())
|
||||
wire_handler_wrapper();
|
||||
|
||||
// reset all interrupts
|
||||
HAL_EPIC_Clear(0xFFFFFFFF);
|
||||
|
||||
@@ -29,12 +29,17 @@ http://arduiniana.org.
|
||||
// --------- TO LL ---------
|
||||
// get ticks from systick
|
||||
#define SYSTICK_GET_TICKS() ((uint64_t)(SCR1_TIMER->MTIMEH)<<32 | SCR1_TIMER->MTIME)
|
||||
|
||||
#define GPIO_SET_PIN(GPIO_x, pin) ((GPIO_x)->SET = (pin))
|
||||
#define GPIO_CLEAR_PIN(GPIO_x, pin) ((GPIO_x)->CLEAR = (pin))
|
||||
#define GPIO_READ_PIN(GPIO_x, pin) (((GPIO_x)->SET & (pin)) != (uint32_t)GPIO_PIN_LOW ? GPIO_PIN_HIGH : GPIO_PIN_LOW)
|
||||
|
||||
#define GPIO_IRQ_LINE_ENABLE(lineMask) ( GPIO_IRQ->ENABLE_SET = (1 << (lineMask >> GPIO_IRQ_LINE_S)) )
|
||||
#define GPIO_IRQ_LINE_DISABLE(lineMask) ( GPIO_IRQ->ENABLE_CLEAR = (1 << (lineMask >> GPIO_IRQ_LINE_S)) )
|
||||
#define GPIO_IRQ_CLEAR_ALL() (GPIO_IRQ->CLEAR = 0b11111111)
|
||||
#define GLOBAL_IRQ_DISABLE() (clear_csr(mie, MIE_MEIE))
|
||||
#define GLOBAL_IRQ_ENABLE() set_csr(mstatus, MSTATUS_MIE); \
|
||||
set_csr(mie, MIE_MEIE)
|
||||
// --------- TO LL ---------
|
||||
|
||||
|
||||
@@ -288,6 +293,7 @@ void SoftwareSerial::begin(long speed)
|
||||
|
||||
tunedDelay(_tx_delay); // if we were low this establishes the end
|
||||
|
||||
// todo убрать
|
||||
HAL_GPIO_PinConfig(GPIO_0, GPIO_PIN_8, HAL_GPIO_MODE_GPIO_OUTPUT, HAL_GPIO_PULL_NONE, HAL_GPIO_DS_2MA);
|
||||
HAL_GPIO_PinConfig(GPIO_0, GPIO_PIN_1, HAL_GPIO_MODE_GPIO_OUTPUT, HAL_GPIO_PULL_NONE, HAL_GPIO_DS_2MA);
|
||||
|
||||
@@ -318,7 +324,7 @@ size_t SoftwareSerial::write(uint8_t byte)
|
||||
if (_inverse_logic)
|
||||
byte = ~byte;
|
||||
|
||||
clear_csr(mie, MIE_MEIE); // turn off interrupts for a clean txmit
|
||||
GLOBAL_IRQ_DISABLE(); // turn off interrupts for a clean txmit
|
||||
|
||||
// Write the start bit
|
||||
if (_inverse_logic)
|
||||
@@ -345,8 +351,7 @@ size_t SoftwareSerial::write(uint8_t byte)
|
||||
GPIO_SET_PIN((GPIO_TypeDef *)_transmitPortRegister, (HAL_PinsTypeDef)_transmitBitMask);
|
||||
|
||||
// enable interrupts
|
||||
set_csr(mstatus, MSTATUS_MIE);
|
||||
set_csr(mie, MIE_MEIE);
|
||||
GLOBAL_IRQ_ENABLE();
|
||||
|
||||
tunedDelay(_tx_delay); // wait stop bit
|
||||
|
||||
|
||||
Reference in new issue
Block a user