mirror of
https://github.com/AlexGyver/GyverCore.git
synced 2025-07-03 04:22:31 +03:00
add
This commit is contained in:
45
GyverCore/cores/arduino/Client.h
Normal file
45
GyverCore/cores/arduino/Client.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Client.h - Base class that provides Client
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef client_h
|
||||||
|
#define client_h
|
||||||
|
#include "Print.h"
|
||||||
|
#include "Stream.h"
|
||||||
|
#include "IPAddress.h"
|
||||||
|
|
||||||
|
class Client : public Stream {
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual int connect(IPAddress ip, uint16_t port) =0;
|
||||||
|
virtual int connect(const char *host, uint16_t port) =0;
|
||||||
|
virtual size_t write(uint8_t) =0;
|
||||||
|
virtual size_t write(const uint8_t *buf, size_t size) =0;
|
||||||
|
virtual int available() = 0;
|
||||||
|
virtual int read() = 0;
|
||||||
|
virtual int read(uint8_t *buf, size_t size) = 0;
|
||||||
|
virtual int peek() = 0;
|
||||||
|
virtual void flush() = 0;
|
||||||
|
virtual void stop() = 0;
|
||||||
|
virtual uint8_t connected() = 0;
|
||||||
|
virtual operator bool() = 0;
|
||||||
|
protected:
|
||||||
|
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
114
GyverCore/cores/arduino/IPAddress.cpp
Normal file
114
GyverCore/cores/arduino/IPAddress.cpp
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
IPAddress.cpp - Base class that provides IPAddress
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <IPAddress.h>
|
||||||
|
|
||||||
|
IPAddress::IPAddress()
|
||||||
|
{
|
||||||
|
_address.dword = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
|
||||||
|
{
|
||||||
|
_address.bytes[0] = first_octet;
|
||||||
|
_address.bytes[1] = second_octet;
|
||||||
|
_address.bytes[2] = third_octet;
|
||||||
|
_address.bytes[3] = fourth_octet;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress::IPAddress(uint32_t address)
|
||||||
|
{
|
||||||
|
_address.dword = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress::IPAddress(const uint8_t *address)
|
||||||
|
{
|
||||||
|
memcpy(_address.bytes, address, sizeof(_address.bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPAddress::fromString(const char *address)
|
||||||
|
{
|
||||||
|
uint16_t acc = 0; // Accumulator
|
||||||
|
uint8_t dots = 0;
|
||||||
|
|
||||||
|
while (*address)
|
||||||
|
{
|
||||||
|
char c = *address++;
|
||||||
|
if (c >= '0' && c <= '9')
|
||||||
|
{
|
||||||
|
acc = acc * 10 + (c - '0');
|
||||||
|
if (acc > 255) {
|
||||||
|
// Value out of [0..255] range
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c == '.')
|
||||||
|
{
|
||||||
|
if (dots == 3) {
|
||||||
|
// Too much dots (there must be 3 dots)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_address.bytes[dots++] = acc;
|
||||||
|
acc = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Invalid char
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dots != 3) {
|
||||||
|
// Too few dots (there must be 3 dots)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_address.bytes[3] = acc;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress& IPAddress::operator=(const uint8_t *address)
|
||||||
|
{
|
||||||
|
memcpy(_address.bytes, address, sizeof(_address.bytes));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress& IPAddress::operator=(uint32_t address)
|
||||||
|
{
|
||||||
|
_address.dword = address;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPAddress::operator==(const uint8_t* addr) const
|
||||||
|
{
|
||||||
|
return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t IPAddress::printTo(Print& p) const
|
||||||
|
{
|
||||||
|
size_t n = 0;
|
||||||
|
for (int i =0; i < 3; i++)
|
||||||
|
{
|
||||||
|
n += p.print(_address.bytes[i], DEC);
|
||||||
|
n += p.print('.');
|
||||||
|
}
|
||||||
|
n += p.print(_address.bytes[3], DEC);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
78
GyverCore/cores/arduino/IPAddress.h
Normal file
78
GyverCore/cores/arduino/IPAddress.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
IPAddress.h - Base class that provides IPAddress
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef IPAddress_h
|
||||||
|
#define IPAddress_h
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "Printable.h"
|
||||||
|
#include "WString.h"
|
||||||
|
|
||||||
|
// A class to make it easier to handle and pass around IP addresses
|
||||||
|
|
||||||
|
class IPAddress : public Printable {
|
||||||
|
private:
|
||||||
|
union {
|
||||||
|
uint8_t bytes[4]; // IPv4 address
|
||||||
|
uint32_t dword;
|
||||||
|
} _address;
|
||||||
|
|
||||||
|
// Access the raw byte array containing the address. Because this returns a pointer
|
||||||
|
// to the internal structure rather than a copy of the address this function should only
|
||||||
|
// be used when you know that the usage of the returned uint8_t* will be transient and not
|
||||||
|
// stored.
|
||||||
|
uint8_t* raw_address() { return _address.bytes; };
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Constructors
|
||||||
|
IPAddress();
|
||||||
|
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
|
||||||
|
IPAddress(uint32_t address);
|
||||||
|
IPAddress(const uint8_t *address);
|
||||||
|
|
||||||
|
bool fromString(const char *address);
|
||||||
|
bool fromString(const String &address) { return fromString(address.c_str()); }
|
||||||
|
|
||||||
|
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
|
||||||
|
// to a four-byte uint8_t array is expected
|
||||||
|
operator uint32_t() const { return _address.dword; };
|
||||||
|
bool operator==(const IPAddress& addr) const { return _address.dword == addr._address.dword; };
|
||||||
|
bool operator==(const uint8_t* addr) const;
|
||||||
|
|
||||||
|
// Overloaded index operator to allow getting and setting individual octets of the address
|
||||||
|
uint8_t operator[](int index) const { return _address.bytes[index]; };
|
||||||
|
uint8_t& operator[](int index) { return _address.bytes[index]; };
|
||||||
|
|
||||||
|
// Overloaded copy operators to allow initialisation of IPAddress objects from other types
|
||||||
|
IPAddress& operator=(const uint8_t *address);
|
||||||
|
IPAddress& operator=(uint32_t address);
|
||||||
|
|
||||||
|
virtual size_t printTo(Print& p) const;
|
||||||
|
|
||||||
|
friend class EthernetClass;
|
||||||
|
friend class UDP;
|
||||||
|
friend class Client;
|
||||||
|
friend class Server;
|
||||||
|
friend class DhcpClass;
|
||||||
|
friend class DNSClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
const IPAddress INADDR_NONE(0,0,0,0);
|
||||||
|
|
||||||
|
#endif
|
30
GyverCore/cores/arduino/Server.h
Normal file
30
GyverCore/cores/arduino/Server.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
Server.h - Base class that provides Server
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef server_h
|
||||||
|
#define server_h
|
||||||
|
|
||||||
|
#include "Print.h"
|
||||||
|
|
||||||
|
class Server : public Print {
|
||||||
|
public:
|
||||||
|
virtual void begin() =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
89
GyverCore/cores/arduino/Udp.h
Normal file
89
GyverCore/cores/arduino/Udp.h
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Udp.cpp: Library to send/receive UDP packets.
|
||||||
|
*
|
||||||
|
* NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
|
||||||
|
* 1) UDP does not guarantee the order in which assembled UDP packets are received. This
|
||||||
|
* might not happen often in practice, but in larger network topologies, a UDP
|
||||||
|
* packet can be received out of sequence.
|
||||||
|
* 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
|
||||||
|
* aware of it. Again, this may not be a concern in practice on small local networks.
|
||||||
|
* For more information, see http://www.cafeaulait.org/course/week12/35.html
|
||||||
|
*
|
||||||
|
* MIT License:
|
||||||
|
* Copyright (c) 2008 Bjoern Hartmann
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* bjoern@cs.stanford.edu 12/30/2008
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef udp_h
|
||||||
|
#define udp_h
|
||||||
|
|
||||||
|
#include <Stream.h>
|
||||||
|
#include <IPAddress.h>
|
||||||
|
|
||||||
|
class UDP : public Stream {
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
|
||||||
|
virtual uint8_t beginMulticast(IPAddress, uint16_t) { return 0; } // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure
|
||||||
|
virtual void stop() =0; // Finish with the UDP socket
|
||||||
|
|
||||||
|
// Sending UDP packets
|
||||||
|
|
||||||
|
// Start building up a packet to send to the remote host specific in ip and port
|
||||||
|
// Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
|
||||||
|
virtual int beginPacket(IPAddress ip, uint16_t port) =0;
|
||||||
|
// Start building up a packet to send to the remote host specific in host and port
|
||||||
|
// Returns 1 if successful, 0 if there was a problem resolving the hostname or port
|
||||||
|
virtual int beginPacket(const char *host, uint16_t port) =0;
|
||||||
|
// Finish off this packet and send it
|
||||||
|
// Returns 1 if the packet was sent successfully, 0 if there was an error
|
||||||
|
virtual int endPacket() =0;
|
||||||
|
// Write a single byte into the packet
|
||||||
|
virtual size_t write(uint8_t) =0;
|
||||||
|
// Write size bytes from buffer into the packet
|
||||||
|
virtual size_t write(const uint8_t *buffer, size_t size) =0;
|
||||||
|
|
||||||
|
// Start processing the next available incoming packet
|
||||||
|
// Returns the size of the packet in bytes, or 0 if no packets are available
|
||||||
|
virtual int parsePacket() =0;
|
||||||
|
// Number of bytes remaining in the current packet
|
||||||
|
virtual int available() =0;
|
||||||
|
// Read a single byte from the current packet
|
||||||
|
virtual int read() =0;
|
||||||
|
// Read up to len bytes from the current packet and place them into buffer
|
||||||
|
// Returns the number of bytes read, or 0 if none are available
|
||||||
|
virtual int read(unsigned char* buffer, size_t len) =0;
|
||||||
|
// Read up to len characters from the current packet and place them into buffer
|
||||||
|
// Returns the number of characters read, or 0 if none are available
|
||||||
|
virtual int read(char* buffer, size_t len) =0;
|
||||||
|
// Return the next byte from the current packet without moving on to the next byte
|
||||||
|
virtual int peek() =0;
|
||||||
|
virtual void flush() =0; // Finish reading the current packet
|
||||||
|
|
||||||
|
// Return the IP address of the host who sent the current incoming packet
|
||||||
|
virtual IPAddress remoteIP() =0;
|
||||||
|
// Return the port of the host who sent the current incoming packet
|
||||||
|
virtual uint16_t remotePort() =0;
|
||||||
|
protected:
|
||||||
|
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,6 +1,6 @@
|
|||||||
/* Главный цикл программы */
|
/* Главный цикл программы */
|
||||||
#pragma message "Нас тут заперли, вызовите 911!"
|
#pragma message "Нас тут заперли, вызовите 911!"
|
||||||
#pragma message "GyverCore v1.10.0 inside. Enjoy"
|
#pragma message "GyverCore v1.10.2 inside. Enjoy"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
static uint8_t a_ref = DEFAULT; // глобальная переменная для хранения опорного напряжения АЦП
|
static uint8_t a_ref = DEFAULT; // глобальная переменная для хранения опорного напряжения АЦП
|
||||||
// ============= DIGITAL =============
|
// ============= DIGITAL =============
|
||||||
|
|
||||||
|
/*
|
||||||
// service func
|
// service func
|
||||||
uint8_t getOutputRegister(uint8_t pin) {
|
uint8_t getOutputRegister(uint8_t pin) {
|
||||||
if (pin < 8) return &PORTD;
|
if (pin < 8) return &PORTD;
|
||||||
@ -31,10 +32,10 @@ uint8_t getBitMask(uint8_t pin) {
|
|||||||
else if (pin < 14) return (1 << (pin - 8));
|
else if (pin < 14) return (1 << (pin - 8));
|
||||||
else return (1 << (pin - 14));
|
else return (1 << (pin - 14));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
void pinMode(uint8_t pin, uint8_t mode) {
|
void pinMode(uint8_t pin, uint8_t mode) {
|
||||||
/*uint8_t oldSREG = SREG; // запомнинаем были ли включены прерывания
|
//uint8_t oldSREG = SREG; // запомнинаем были ли включены прерывания
|
||||||
cli();//выключаем прерывания
|
//cli();//выключаем прерывания
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 0: // input
|
case 0: // input
|
||||||
if (pin < 8) bitWrite(DDRD, pin, 0); // расставляем нули в DDRn
|
if (pin < 8) bitWrite(DDRD, pin, 0); // расставляем нули в DDRn
|
||||||
@ -61,8 +62,8 @@ void pinMode(uint8_t pin, uint8_t mode) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SREG = oldSREG; // если прерывания не были включены - не включаем и наоборот*/
|
//SREG = oldSREG; // если прерывания не были включены - не включаем и наоборот*/
|
||||||
|
/*
|
||||||
uint8_t *modeReg = getModeRegister(pin);
|
uint8_t *modeReg = getModeRegister(pin);
|
||||||
uint8_t *outputReg = getOutputRegister(pin);
|
uint8_t *outputReg = getOutputRegister(pin);
|
||||||
uint8_t mask = getBitMask(pin);
|
uint8_t mask = getBitMask(pin);
|
||||||
@ -77,12 +78,12 @@ void pinMode(uint8_t pin, uint8_t mode) {
|
|||||||
*modeReg &= ~ mask;
|
*modeReg &= ~ mask;
|
||||||
*outputReg |= mask;
|
*outputReg |= mask;
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void digitalWrite(uint8_t pin, uint8_t x) {
|
void digitalWrite(uint8_t pin, uint8_t x) {
|
||||||
uint8_t oldSREG = SREG; // запомнинаем были ли включены прерывания
|
//uint8_t oldSREG = SREG; // запомнинаем были ли включены прерывания
|
||||||
cli();//выключаем прерывания
|
//cli();//выключаем прерывания
|
||||||
switch (pin) { // откл pwm
|
switch (pin) { // откл pwm
|
||||||
case 3: // 2B
|
case 3: // 2B
|
||||||
TCCR2A &= ~(1 << COM2B1);
|
TCCR2A &= ~(1 << COM2B1);
|
||||||
@ -106,7 +107,7 @@ void digitalWrite(uint8_t pin, uint8_t x) {
|
|||||||
if (pin < 8) bitWrite(PORTD, pin, x);
|
if (pin < 8) bitWrite(PORTD, pin, x);
|
||||||
else if (pin < 14) bitWrite(PORTB, (pin - 8), x);
|
else if (pin < 14) bitWrite(PORTB, (pin - 8), x);
|
||||||
else if (pin < 20) bitWrite(PORTC, (pin - 14), x);
|
else if (pin < 20) bitWrite(PORTC, (pin - 14), x);
|
||||||
SREG = oldSREG; // если прерывания не были включены - не включаем и наоборот
|
//SREG = oldSREG; // если прерывания не были включены - не включаем и наоборот
|
||||||
|
|
||||||
/*uint8_t *outputReg = getOutputRegister(pin);
|
/*uint8_t *outputReg = getOutputRegister(pin);
|
||||||
uint8_t mask = getBitMask(pin);
|
uint8_t mask = getBitMask(pin);
|
||||||
@ -115,13 +116,13 @@ void digitalWrite(uint8_t pin, uint8_t x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void digitalToggle(uint8_t pin){
|
void digitalToggle(uint8_t pin){
|
||||||
uint8_t oldSREG = SREG; // запомнинаем были ли включены прерывания
|
//uint8_t oldSREG = SREG; // запомнинаем были ли включены прерывания
|
||||||
cli();//выключаем прерывания
|
//cli();//выключаем прерывания
|
||||||
if (pin < 8) bitToggle(PORTD, pin);
|
if (pin < 8) bitToggle(PORTD, pin);
|
||||||
else if (pin < 14) bitToggle(PORTB, pin - 8);
|
else if (pin < 14) bitToggle(PORTB, pin - 8);
|
||||||
else if (pin < 20) bitToggle(PORTC, pin - 14);
|
else if (pin < 20) bitToggle(PORTC, pin - 14);
|
||||||
|
|
||||||
SREG = oldSREG; // если прерывания не были включены - не включаем и наоборот
|
//SREG = oldSREG; // если прерывания не были включены - не включаем и наоборот
|
||||||
|
|
||||||
/*uint8_t *outputReg = getOutputRegister(pin);
|
/*uint8_t *outputReg = getOutputRegister(pin);
|
||||||
uint8_t mask = getBitMask(pin);
|
uint8_t mask = getBitMask(pin);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
|
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
|
||||||
|
|
||||||
name=GyverCore
|
name=GyverCore
|
||||||
version=1.8.4
|
version=1.10.2
|
||||||
|
|
||||||
# AVR compile variables
|
# AVR compile variables
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
@ -269,3 +269,6 @@ parseFloat | 1070 | 246 | 824
|
|||||||
- Ускорен IO
|
- Ускорен IO
|
||||||
- 1.10.1
|
- 1.10.1
|
||||||
- IO откатили назад из за непонятных багов
|
- IO откатили назад из за непонятных багов
|
||||||
|
- 1.10.2
|
||||||
|
- Пара багфиксов с IO
|
||||||
|
- Вернули заголовочные для WiFi
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -288,6 +288,20 @@
|
|||||||
{"name": "ATmega328 based boards"}
|
{"name": "ATmega328 based boards"}
|
||||||
],
|
],
|
||||||
"toolsDependencies": []
|
"toolsDependencies": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "GyverCore",
|
||||||
|
"architecture": "avr",
|
||||||
|
"version": "1.10.2",
|
||||||
|
"category": "Contributed",
|
||||||
|
"url": "https://github.com/AlexGyver/GyverCore/releases/download/GyverCore-1.10.2/GyverCore.zip",
|
||||||
|
"archiveFileName": "GyverCore.zip",
|
||||||
|
"checksum": "MD5:dd4bb5fe199eaed4c11fe9f5df47cf04",
|
||||||
|
"size": "59027456",
|
||||||
|
"boards": [
|
||||||
|
{"name": "ATmega328 based boards"}
|
||||||
|
],
|
||||||
|
"toolsDependencies": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tools": []
|
"tools": []
|
||||||
|
Reference in New Issue
Block a user