My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wifiSerial_STM32.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include <inttypes.h>
  24. #include "Stream.h"
  25. #include "uart.h"
  26. class WifiSerial {
  27. protected:
  28. // Has any byte been written to the UART since begin()
  29. bool _written;
  30. serial_t _serial;
  31. public:
  32. uint8_t wifiRxBuf[WIFI_RX_BUF_SIZE];
  33. uint8_t wifiTxBuf[WIFI_TX_BUF_SIZE];
  34. WifiSerial(void *peripheral);
  35. // Set up / tear down
  36. void begin(uint32_t baud);
  37. void begin(uint32_t baud, uint8_t config);
  38. void end();
  39. int available();
  40. int read();
  41. int write(uint8_t);
  42. // Interrupt handlers
  43. static int _tx_complete_irq(serial_t *obj);
  44. static void _rx_complete_irq(serial_t *obj);
  45. void flush();
  46. bool isHalfDuplex() const;
  47. void enableHalfDuplexRx();
  48. private:
  49. void setRx(uint32_t _rx);
  50. void setTx(uint32_t _tx);
  51. void setRx(PinName _rx);
  52. void setTx(PinName _tx);
  53. void init(PinName _rx, PinName _tx);
  54. bool _rx_enabled;
  55. uint8_t _config;
  56. unsigned long _baud;
  57. };