mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Allman now (#6080)
* switch restyle script for CI * remove confirmation * restyle with allman
This commit is contained in:
committed by
david gauchard
parent
625c3a62c4
commit
98125f8860
@ -1,22 +1,22 @@
|
||||
/*
|
||||
SPI.h - SPI library for esp8266
|
||||
/*
|
||||
SPI.h - SPI library for esp8266
|
||||
|
||||
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
|
||||
This file is part of the esp8266 core for Arduino environment.
|
||||
|
||||
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.
|
||||
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
|
||||
This file is part of the esp8266 core for Arduino environment.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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
|
||||
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 _SPI_H_INCLUDED
|
||||
#define _SPI_H_INCLUDED
|
||||
@ -41,46 +41,48 @@ const uint8_t SPI_MODE1 = 0x01; ///< CPOL: 0 CPHA: 1
|
||||
const uint8_t SPI_MODE2 = 0x10; ///< CPOL: 1 CPHA: 0
|
||||
const uint8_t SPI_MODE3 = 0x11; ///< CPOL: 1 CPHA: 1
|
||||
|
||||
class SPISettings {
|
||||
class SPISettings
|
||||
{
|
||||
public:
|
||||
SPISettings() :_clock(1000000), _bitOrder(LSBFIRST), _dataMode(SPI_MODE0){}
|
||||
SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) :_clock(clock), _bitOrder(bitOrder), _dataMode(dataMode){}
|
||||
uint32_t _clock;
|
||||
uint8_t _bitOrder;
|
||||
uint8_t _dataMode;
|
||||
SPISettings() : _clock(1000000), _bitOrder(LSBFIRST), _dataMode(SPI_MODE0) {}
|
||||
SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) : _clock(clock), _bitOrder(bitOrder), _dataMode(dataMode) {}
|
||||
uint32_t _clock;
|
||||
uint8_t _bitOrder;
|
||||
uint8_t _dataMode;
|
||||
};
|
||||
|
||||
class SPIClass {
|
||||
class SPIClass
|
||||
{
|
||||
public:
|
||||
SPIClass();
|
||||
bool pins(int8_t sck, int8_t miso, int8_t mosi, int8_t ss);
|
||||
void begin();
|
||||
void end();
|
||||
void setHwCs(bool use);
|
||||
void setBitOrder(uint8_t bitOrder);
|
||||
void setDataMode(uint8_t dataMode);
|
||||
void setFrequency(uint32_t freq);
|
||||
void setClockDivider(uint32_t clockDiv);
|
||||
void beginTransaction(SPISettings settings);
|
||||
uint8_t transfer(uint8_t data);
|
||||
uint16_t transfer16(uint16_t data);
|
||||
void transfer(void *buf, uint16_t count);
|
||||
void write(uint8_t data);
|
||||
void write16(uint16_t data);
|
||||
void write16(uint16_t data, bool msb);
|
||||
void write32(uint32_t data);
|
||||
void write32(uint32_t data, bool msb);
|
||||
void writeBytes(const uint8_t * data, uint32_t size);
|
||||
void writePattern(const uint8_t * data, uint8_t size, uint32_t repeat);
|
||||
void transferBytes(const uint8_t * out, uint8_t * in, uint32_t size);
|
||||
void endTransaction(void);
|
||||
SPIClass();
|
||||
bool pins(int8_t sck, int8_t miso, int8_t mosi, int8_t ss);
|
||||
void begin();
|
||||
void end();
|
||||
void setHwCs(bool use);
|
||||
void setBitOrder(uint8_t bitOrder);
|
||||
void setDataMode(uint8_t dataMode);
|
||||
void setFrequency(uint32_t freq);
|
||||
void setClockDivider(uint32_t clockDiv);
|
||||
void beginTransaction(SPISettings settings);
|
||||
uint8_t transfer(uint8_t data);
|
||||
uint16_t transfer16(uint16_t data);
|
||||
void transfer(void *buf, uint16_t count);
|
||||
void write(uint8_t data);
|
||||
void write16(uint16_t data);
|
||||
void write16(uint16_t data, bool msb);
|
||||
void write32(uint32_t data);
|
||||
void write32(uint32_t data, bool msb);
|
||||
void writeBytes(const uint8_t * data, uint32_t size);
|
||||
void writePattern(const uint8_t * data, uint8_t size, uint32_t repeat);
|
||||
void transferBytes(const uint8_t * out, uint8_t * in, uint32_t size);
|
||||
void endTransaction(void);
|
||||
private:
|
||||
bool useHwCs;
|
||||
uint8_t pinSet;
|
||||
void writeBytes_(const uint8_t * data, uint8_t size);
|
||||
void transferBytes_(const uint8_t * out, uint8_t * in, uint8_t size);
|
||||
void transferBytesAligned_(const uint8_t * out, uint8_t * in, uint8_t size);
|
||||
inline void setDataBits(uint16_t bits);
|
||||
bool useHwCs;
|
||||
uint8_t pinSet;
|
||||
void writeBytes_(const uint8_t * data, uint8_t size);
|
||||
void transferBytes_(const uint8_t * out, uint8_t * in, uint8_t size);
|
||||
void transferBytesAligned_(const uint8_t * out, uint8_t * in, uint8_t size);
|
||||
inline void setDataBits(uint16_t bits);
|
||||
};
|
||||
|
||||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SPI)
|
||||
|
Reference in New Issue
Block a user