Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#41 from shadow578/pio-arduino-core-…
Browse files Browse the repository at this point in the history
…rewrite

arduino core rewrite / HAL refactor
  • Loading branch information
shadow578 authored Oct 6, 2023
2 parents cdde079 + a495aa3 commit fdcc491
Show file tree
Hide file tree
Showing 33 changed files with 861 additions and 2,590 deletions.
17 changes: 16 additions & 1 deletion Marlin/src/HAL/HC32F46x/HAL.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "HAL.h"
#include <core_hooks.h>
#include <drivers/panic/panic.h>

//
// Emergency Parser
//
#if ENABLED(EMERGENCY_PARSER)
extern "C" void usart_rx_irq_hook(uint8_t ch, uint8_t usart)
extern "C" void core_hook_usart_rx_irq(uint8_t ch, uint8_t usart)
{
// only handle receive on host serial ports
if (false
Expand All @@ -27,3 +29,16 @@ extern "C" void usart_rx_irq_hook(uint8_t ch, uint8_t usart)
emergency_parser.update(MYSERIAL1.emergency_state, ch);
}
#endif

//
// panic hook
//
extern "C" void core_hook_panic_end()
{
// print '!!' to signal error to host
// do it 10x so it's not missed
for (int i = 0; i < 10; i++)
{
panic_printf("\n!!\n");
}
}
8 changes: 5 additions & 3 deletions Marlin/src/HAL/HC32F46x/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
*
*/

/**
* HAL for stm32duino.com based on Libmaple and compatible (HC32F46x based on STM32F1)
/**
* HAL for HC32F46x based boards
*
* Note: MarlinHAL class is in MarlinHAL.h/cpp
*/

#define CPU_32_BIT
Expand Down Expand Up @@ -103,7 +105,6 @@ extern "C" void usart_rx_irq_hook(uint8_t ch, uint8_t usart);
//
// Misc. Defines
//
#define STM32_FLASH_SIZE 256
#define square(x) ((x) * (x))

#ifndef strncpy_P
Expand All @@ -117,6 +118,7 @@ extern "C" void usart_rx_irq_hook(uint8_t ch, uint8_t usart);
#define analogInputToDigitalPin(p) (p)
#endif

//TODO: digitalPinHasPWM is not implemented
#ifndef digitalPinHasPWM
#define digitalPinHasPWM(P) (P) //(PIN_MAP[P].timer_device != nullptr)
#endif
Expand Down
199 changes: 0 additions & 199 deletions Marlin/src/HAL/HC32F46x/HAL_SPI.cpp

This file was deleted.

Loading

0 comments on commit fdcc491

Please sign in to comment.