Browse Source

Шаблон инита MKS, прерывание на IO0

pull/1/head
Sergey 5 years ago
parent
commit
4bbb839cac
  1. 13
      Marlin/src/MarlinCore.cpp
  2. 15
      Marlin/src/module/mks_wifi/mks_wifi.cpp
  3. 13
      Marlin/src/module/mks_wifi/mks_wifi.h

13
Marlin/src/MarlinCore.cpp

@ -181,6 +181,11 @@
#include "libs/L64XX/L64XX_Marlin.h"
#endif
#ifdef MKS_WIFI
#include "module/mks_wifi/mks_wifi.h"
#endif
const char NUL_STR[] PROGMEM = "",
M112_KILL_STR[] PROGMEM = "M112 Shutdown",
G28_STR[] PROGMEM = "G28",
@ -926,7 +931,7 @@ void setup() {
SERIAL_ECHOLNPGM("start");
SERIAL_ECHO_START();
#if HAS_TMC_SPI
#if HAS_TMC_SPI
#if DISABLED(TMC_USE_SW_SPI)
SPI.begin();
#endif
@ -975,7 +980,7 @@ void setup() {
};
#define SETUP_LOG(M) log_current_ms(PSTR(M))
#else
#define SETUP_LOG(...) NOOP
#define SETUP_LOG(C) DEBUG(C)
#endif
#define SETUP_RUN(C) do{ SETUP_LOG(STRINGIFY(C)); C; }while(0)
@ -1183,6 +1188,10 @@ void setup() {
SETUP_RUN(max7219.init());
#endif
#if ENABLED(MKS_WIFI)
mks_wifi_init();
#endif
marlin_state = MF_RUNNING;
SETUP_LOG("setup() completed.");

15
Marlin/src/module/mks_wifi/mks_wifi.cpp

@ -0,0 +1,15 @@
#include "mks_wifi.h"
void mks_wifi_init(void){
DEBUG("Init MKS WIFI");
SET_INPUT_PULLUP(MKS_WIFI_IO0);
attachInterrupt(MKS_WIFI_IO0, mks_wifi_io0_irq, FALLING);
}
void mks_wifi_io0_irq(void){
INFO("IO0 Irq");
}

13
Marlin/src/module/mks_wifi/mks_wifi.h

@ -0,0 +1,13 @@
#ifndef MKS_WIFI_H
#define MKS_WIFI_H
#include "../../MarlinCore.h"
#include "../../inc/MarlinConfig.h"
#include "../../libs/Segger/log.h"
void mks_wifi_init(void);
void mks_wifi_io0_irq(void);
#endif
Loading…
Cancel
Save