mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-30 17:41:54 +08:00
refactoring
This commit is contained in:
@@ -21,8 +21,9 @@
|
||||
|
||||
|
||||
#include "spi.h"
|
||||
|
||||
#ifdef CMD_SPI
|
||||
#include <SPI.h>
|
||||
|
||||
|
||||
static volatile uint8_t _spi_in[8] = {0};
|
||||
static volatile uint8_t _spi_in_index = 0;
|
||||
@@ -30,6 +31,7 @@ static volatile uint8_t _spi_in_index = 0;
|
||||
static volatile uint8_t _spi_out[8] = {0};
|
||||
static volatile uint8_t _spi_out_index = 0;
|
||||
|
||||
|
||||
namespace DRIVERS {
|
||||
void Spi::begin() {
|
||||
pinMode(MISO, OUTPUT);
|
||||
@@ -77,4 +79,5 @@ ISR(SPI_STC_vect) {
|
||||
SPDR = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "connection.h"
|
||||
|
||||
|
||||
namespace DRIVERS {
|
||||
struct Spi : public Connection {
|
||||
Spi() : Connection(CONNECTION) {}
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
#include "driver.h"
|
||||
#include "stdint.h"
|
||||
|
||||
|
||||
namespace DRIVERS {
|
||||
typedef void(*DataHandler)(const uint8_t * data, size_t len);
|
||||
typedef void(*TimeoutHandler)();
|
||||
typedef void (*DataHandler)(const uint8_t *data, size_t size);
|
||||
typedef void (*TimeoutHandler)();
|
||||
|
||||
struct Connection : public Driver {
|
||||
using Driver::Driver;
|
||||
|
||||
@@ -21,12 +21,14 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef CMD_SERIAL
|
||||
#include "connection.h"
|
||||
|
||||
|
||||
namespace DRIVERS {
|
||||
#ifdef Serial
|
||||
#undef Serial
|
||||
# undef Serial
|
||||
#endif
|
||||
struct Serial : public Connection {
|
||||
Serial() : Connection(CONNECTION) {}
|
||||
|
||||
Reference in New Issue
Block a user