Arduino Core for STM32  1.0
ftoa.h
Go to the documentation of this file.
1 
36 #ifndef STM32TPL_FTOA_H_INCLUDED
37 #define STM32TPL_FTOA_H_INCLUDED
38 
39 #include <type_traits>
40 #include <math.h>
41 
49 template<typename T> typename std::enable_if<std::is_floating_point<T>::value, char*>::type ftoa(T f, char * buf, int precision){
50  char * ptr = buf;
51  char * p = ptr;
52  char * p1;
53  char c;
54  long intPart;
55 
56  #define MAX_PRECISION (10)
57  static const double rounders[MAX_PRECISION + 1] =
58  {
59  0.5, // 0
60  0.05, // 1
61  0.005, // 2
62  0.0005, // 3
63  0.00005, // 4
64  0.000005, // 5
65  0.0000005, // 6
66  0.00000005, // 7
67  0.000000005, // 8
68  0.0000000005, // 9
69  0.00000000005 // 10
70  };
71 
72  if(isinf(f)){
73  buf[0] = 'i';
74  buf[1] = 'n';
75  buf[2] = 'f';
76  buf[3] = '\0';
77 
78  }
79  else if(isnan(f)){
80  buf[0] = 'n';
81  buf[1] = 'a';
82  buf[2] = 'n';
83  buf[3] = '\0';
84 
85  }
86  else if(!isnormal(f)){
87  buf[0] = 's';
88  buf[1] = 'u';
89  buf[2] = 'b';
90  buf[3] = 'n';
91  buf[4] = 'o';
92  buf[5] = 'r';
93  buf[6] = 'm';
94  buf[7] = 'a';
95  buf[8] = 'l';
96  buf[9] = '\0';
97 
98  }
99 
100  // check precision bounds
101  if (precision > MAX_PRECISION)
102  precision = MAX_PRECISION;
103 
104  // sign stuff
105  if (f < 0)
106  {
107  f = -f;
108  *ptr++ = '-';
109  }
110 
111  if (precision < 0) // negative precision == automatic precision guess
112  {
113  if (f < 1.0) precision = 6;
114  else if (f < 10.0) precision = 5;
115  else if (f < 100.0) precision = 4;
116  else if (f < 1000.0) precision = 3;
117  else if (f < 10000.0) precision = 2;
118  else if (f < 100000.0) precision = 1;
119  else precision = 0;
120  }
121 
122  // round value according the precision
123  if (precision){
124  f += rounders[precision];
125  }
126 
127  // integer part...
128  intPart = f;
129  f -= intPart;
130 
131  if (!intPart)
132  *ptr++ = '0';
133  else
134  {
135  // save start pointer
136  p = ptr;
137 
138  // convert (reverse order)
139  while (intPart)
140  {
141  *p++ = '0' + intPart % 10;
142  intPart /= 10;
143  }
144 
145  // save end pos
146  p1 = p;
147 
148  // reverse result
149  while (p > ptr)
150  {
151  c = *--p;
152  *p = *ptr;
153  *ptr++ = c;
154  }
155 
156  // restore end pos
157  ptr = p1;
158  }
159 
160  // decimal part
161  if (precision)
162  {
163  // place decimal point
164  *ptr++ = '.';
165 
166  // convert
167  while (precision--)
168  {
169  f *= 10.0;
170  c = f;
171  //TODO Niekedy vypisuje //////////// (pretečenie)
172  *ptr++ = '0' + c;
173  f -= c;
174  }
175  }
176 
177  // terminating zero
178  *ptr = 0;
179 
180  return buf;
181 }
182 
183 
184 #endif // STM32TPL_FTOA_H_INCLUDED
HardwareCRC::end
void end()
Disables hardware CRC calculation unit.
Definition: HardwareCRC.cpp:501
HardwareSerial.h
This file contains class with methods to handle UART, USART and LPUART periphery.
HardwareSPI::WriteHalfCallback
void(* WriteHalfCallback)()
Definition: HardwareSPI.h:1037
HAL_SPI_TxCpltCallback
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
Tx Transfer completed callback.
Definition: HardwareSPI.cpp:1229
IRQLine::handler
std::function< void(void)> handler
Definition: wirish.cpp:394
NUM_IRQ_LINES
#define NUM_IRQ_LINES
Definition: wirish.cpp:456
HardwareSerial::HardwareSerial
HardwareSerial(UART_HandleTypeDef &uart)
Constructor.
min
#define min(a, b)
Definition: HardwareTimer.h:79
TIMER_32BIT_MAX_PERIOD
#define TIMER_32BIT_MAX_PERIOD
Definition: HardwareTimer.h:89
HardwareSPI::timeout
uint32_t timeout
Timeout interval in ms.
Definition: HardwareSPI.h:1027
HardwareSPI::receive32
virtual uint32_t receive32(bool lastByte=false)
Receives data from SPI periphery.
Definition: HardwareSPI.cpp:943
HardwareSPI::handleWriteDoneCallback
static void handleWriteDoneCallback(SPI_TypeDef *instance)
Handles WriteDone callback function.
Definition: HardwareSPI.cpp:1151
HardwareSerial::isTxEnabled
bool isTxEnabled(void)
Checks if transmitting mode is enabled.
Definition: HardwareSerial.h:486
HardwareSPI::getFrequency
uint32_t getFrequency()
Calculates SPI frequency from APB frequency and Clock Divider.
Definition: HardwareSPI.cpp:516
RISING
#define RISING
GPIO interrupt will be triggered when pin state change from LOW to HIGH.
Definition: wirish.h:1030
HardwareTimer::_tim
TIM_HandleTypeDef & _tim
Timer structure (which include timer instance) that we will use to handle timer.
Definition: HardwareTimer.h:603
HardwareSPI::getCRCPolynomial
uint32_t getCRCPolynomial()
Gets CRC polynomial.
Definition: HardwareSPI.cpp:737
HCRC_16BIT_POLYSIZE
#define HCRC_16BIT_POLYSIZE
Definition: HardwareCRC.h:132
HardwareSPI::receiveBytesNonBlocking
virtual bool receiveBytesNonBlocking(uint8_t *data, uint32_t size, bool lastByte=false)
Receives data from SPI periphery in non-blocking mode using DMA or IT (interrupt) mode.
Definition: HardwareSPI.cpp:1091
HardwareSPI::isHwCS
bool isHwCS()
Gets, if Chip Select is handled by hardware.
Definition: HardwareSPI.cpp:338
HardwareSPI::getSPIIndex
static uint32_t getSPIIndex(SPI_TypeDef *instance)
Gets SPI instance index.
Definition: HardwareSPI.cpp:1313
INPUT_PULLUP
@ INPUT_PULLUP
The state of the pin in this mode is reported the same way as with INPUT, but the pin voltage is gent...
Definition: wirish.h:500
HAL_SPI_RxCpltCallback
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)
Rx Transfer completed callback.
Definition: HardwareSPI.cpp:1240
HardwareSerial::available
int available(void) override
Gets the count of bytes (characters) available for reading from the Rx buffer.
SerialConfig
UART_InitTypeDef SerialConfig
HAL library configuration structure.
Definition: HardwareSerial.h:79
EEPROMClass::read
uint8_t read(int const address)
Definition: EEPROM.cpp:53
HardwareI2C::onReceive
void onReceive(void(*function)(int))
Definition: HardwareI2C.cpp:539
SPI_MODE0
const uint8_t SPI_MODE0
CPOL: 0 CPHA: 0.
Definition: HardwareSPI.h:86
HardwareSPI::beginTransaction
virtual SPI_Status beginTransaction(SPISettings settings)
Sets some settings to SPI periphery before transaction.
Definition: HardwareSPI.cpp:348
HardwareSPI::transfer
virtual uint16_t transfer(uint16_t data, bool lastByte=false)
SPI transfer is based on a simultaneous send and receive data.
Definition: HardwareSPI.cpp:755
HardwareTimer::haveLockedSettings
bool haveLockedSettings()
Checks if settings registers are locked.
HardwareTimer::isAutoReloadPreloadEnabled
bool isAutoReloadPreloadEnabled(void)
Checks if autoReloadPreload is enabled.
HardwareSerial::handleRxFullCallback
static void handleRxFullCallback(USART_TypeDef *instance)
Handles RxFull callback function.
HardwareSPI::write16
virtual bool write16(uint16_t data, bool lastByte=false)
Sends data using SPI periphery.
Definition: HardwareSPI.cpp:865
HardwareSPI::begin
bool begin()
Initialize SPI periphery and it's pins.
Definition: HardwareSPI.cpp:34
HardwareTimer::getTimerInstances
static HardwareTimer ** getTimerInstances()
Gets array of all created timers instances (just from this class, not timer structure).
HardwareSPI::handleTransferDoneCallback
static void handleTransferDoneCallback(SPI_TypeDef *instance)
Handles TransferDone callback function.
Definition: HardwareSPI.cpp:1161
crc
HardwareCRC crc
Definition: HardwareCRC.cpp:539
randomSeed
void randomSeed(unsigned long seed)
Initializes the pseudo-random number generator, causing it to start at an arbitrary point in its rand...
Definition: wirish.cpp:1029
HardwareSerial::rxBufOVFCNT
volatile uint16_t rxBufOVFCNT
Rx buffer overflow count, restarts when read() was called.
Definition: HardwareSerial.h:669
HardwareTimer::getPrescaler
uint16_t getPrescaler(void)
Basic settings methods applied in real time Those setting methods can be called every time,...
HardwareI2C::onRequest
void onRequest(void(*)(void))
Definition: HardwareI2C.cpp:547
enableGPIO
bool enableGPIO(GPIO_TypeDef *GPIOx, bool enable)
Enables/Disables GPIO port periphery.
Definition: wirish.cpp:309
TimerState
TimerState
This is enum of all possible timer states.
Definition: HardwareTimer.h:150
HardwareSerial::UART_RxFullCallback
void UART_RxFullCallback()
This method is called when Rx Buffer is full.
HardwareTimer::start
bool start(void)
Starts timer.
HardwareSPI::getSPIClockFreq
uint32_t getSPIClockFreq(void)
Gets periphery SPI Clock Frequency in Hz.
Definition: HardwareSPI.cpp:454
RESET_CAUSE_POWER_ON_POWER_DOWN_RESET
#define RESET_CAUSE_POWER_ON_POWER_DOWN_RESET
Power-ON reset, Power-DOWN reset cause.
Definition: wirish.h:1036
HardwareTimer::getTimerIndex
static uint32_t getTimerIndex(TIM_TypeDef *instance)
Gets timer instance index, that is used in methods/attributes: handleCallback(TIM_TypeDef* instance),...
HardwareSPI::setClockDivider
bool setClockDivider(uint32_t clockDiv)
Sets SPI clock divider.
Definition: HardwareSPI.cpp:530
HardwareSerial::begin
bool begin()
Initialize and enable UART periphery and it's clock.
millis
#define millis()
Returns the number of milliseconds passed since the STM board began running the current program.
Definition: wirish.h:851
isInterruptSetOnPin
bool isInterruptSetOnPin(uint8_t Pin)
Checks Pin is used as interrupt.
Definition: wirish.cpp:557
EEPROMClass::readFromFlash
static bool readFromFlash(uint32_t pageIndex, uint32_t offset, uint8_t bank, uint8_t *data, uint32_t dataLenght)
Definition: EEPROM.cpp:93
HardwareSerial::bufferOverflowed
bool bufferOverflowed()
Returns true when Rx buffer has overflowed.
HardwareSPI::handleWriteHalfCallback
static void handleWriteHalfCallback(SPI_TypeDef *instance)
Handles WriteHalf callback function.
Definition: HardwareSPI.cpp:1182
HardwareSerial::flush
void flush(uint32_t timeout=0)
Waits for the transmission of outgoing serial data to complete.
HardwareTimer::enableAutoReloadPreload
void enableAutoReloadPreload(bool enable)
When autoReloadPreload is enabled, timer is running and period was changed, the new value of period w...
LSBFIRST
#define LSBFIRST
Least Significant Bit First.
Definition: wirish.h:1007
HardwareSPI_O::write32
bool write32(uint32_t data, bool lastByte=false) override
Sends data using SPI periphery.
HardwareSPI::ReceiveDoneCallback
void(* ReceiveDoneCallback)()
Definition: HardwareSPI.h:1036
EEPROMClass::begin
void begin(size_t size)
Definition: EEPROM.cpp:12
SPI3_INDEX
#define SPI3_INDEX
HardwareCRC::getCheckValue
uint32_t getCheckValue(uint32_t initValue=DEFAULT_HCRC_INITVAL, uint32_t finalXOR=0x00)
Calculates CRC check value.
Definition: HardwareCRC.cpp:432
HardwareSPI::getError
SPI_ErrorCode getError(void)
Gets error, that happens during begin, end or transaction.
Definition: HardwareSPI.h:861
rst_cs
ResetCause rst_cs
Definition: wirish.cpp:1134
HardwareSerial::widthCheck
size_t widthCheck(size_t width_) override
Overriden width check function from Stream class.
HardwareTimer::initDone
bool initDone
This flag is true when init(void) method was successfully called.
Definition: HardwareTimer.h:611
HardwareSPI_O::receiveBytes
bool receiveBytes(uint8_t *data, uint32_t size, bool lastByte=false) override
Receives data from SPI periphery in blocking mode.
HardwareSPI_O::write
bool write(uint16_t data, bool lastByte=false) override
Sends data using SPI periphery.
HardwareSPI::handleReceiveDoneCallback
static void handleReceiveDoneCallback(SPI_TypeDef *instance)
Handles ReceiveDone callback function.
Definition: HardwareSPI.cpp:1172
OUTPUT_OPEN_DRAIN
@ OUTPUT_OPEN_DRAIN
In open drain mode, the pin indicates "low" by accepting current flow to ground and "high" by providi...
Definition: wirish.h:471
HardwareTimer::setIntervalItLimit
uint32_t setIntervalItLimit
Maximum iterations limit for interval calculation, that is done in method setInterval().
Definition: HardwareTimer.h:587
HardwareSPI::isSending
bool isSending()
Checks if data are sending or transferring right now using DMA or IT and if periphery is busy.
Definition: HardwareSPI.h:271
HardwareSPI::flush
bool flush()
Waits until DMA or IT (nonblocking transaction methods) are timed out and then aborts them.
Definition: HardwareSPI.cpp:1136
HAL_SPI_TxRxCpltCallback
void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
Tx and Rx Transfer completed callback.
Definition: HardwareSPI.cpp:1251
HardwareCRC::setInputReverseSize
void setInputReverseSize(uint32_t reverse)
Sets input reverse size to CR register.
Definition: HardwareCRC.cpp:532
HardwareTimer::setClockDivision
bool setClockDivision(uint8_t division)
Sets timer clock division.
HardwareSerial::updateBaudRate
bool updateBaudRate(unsigned long baud)
Updates baud rate at runtime.
SPISettings
Class, that holds SPI settings.
Definition: HardwareSPI.h:181
HardwareTimer::CalculateTimer
TimerSettings CalculateTimer(uint64_t ticks, uint32_t maxPrescaler, uint64_t maxPeriod, uint32_t minPeriod, uint32_t timerFreq, bool divEnabled, uint32_t maxIterations=UINT32_MAX)
Calculates prescaler, period and timer clock division.
HCRC_OUT_REVERSE_DISABLED
#define HCRC_OUT_REVERSE_DISABLED
Definition: HardwareCRC.h:140
PIN_TO_PORT
#define PIN_TO_PORT(Pin)
Converts Arduino like pin number (Pin) to GPIO port.
Definition: wirish.h:564
HardwareSerial::isDMAconnectedToRx
bool isDMAconnectedToRx(void)
Checks if DMA channel is connected to UART Rx and can be used for data receiving.
INPUT
@ INPUT
Basic digital input.
Definition: wirish.h:487
HardwareTimer::resume
bool resume(void)
Resumes timer.
RESET_CAUSE_UNKNOWN
@ RESET_CAUSE_UNKNOWN
Unknown reset cause.
Definition: wirish.h:1044
HardwareSerial::UART_EndRxTransfer
void UART_EndRxTransfer(UART_HandleTypeDef *huart)
Aborts Rx IT Transfer.
TS_RUNNING
@ TS_RUNNING
Timer is running.
Definition: HardwareTimer.h:152
HardwareSPI::handleReceiveHalfCallback
static void handleReceiveHalfCallback(SPI_TypeDef *instance)
Handles ReceiveHalf callback function.
Definition: HardwareSPI.cpp:1202
RESET_CAUSE_INDEPENDENT_WATCHDOG_RESET
@ RESET_CAUSE_INDEPENDENT_WATCHDOG_RESET
Independent watchdog reset cause.
Definition: wirish.h:1050
HardwareSPI::endTransaction
virtual SPI_Status endTransaction(void)
This method don't have to be called at the end of the transaction when using HardwareSPI class,...
Definition: HardwareSPI.cpp:366
TS_STOPPED
@ TS_STOPPED
Timer is stopped, counter register was restarted.
Definition: HardwareTimer.h:156
HardwareCRC
Calculate CRC simply and fast using this class. Calculation is done using hardware CRC calculation un...
Definition: HardwareCRC.h:190
HardwareSPI::oldSettings
SPISettings oldSettings
Old SPI setting - to speed up begin transaction.
Definition: HardwareSPI.h:1032
HardwareSPI::transfer32
virtual uint32_t transfer32(uint32_t data, bool lastByte=false)
SPI transfer is based on a simultaneous send and receive data.
Definition: HardwareSPI.cpp:797
HardwareSPI::setTimeout
void setTimeout(uint32_t Timeout)
Sets timeout in milliseconds.
Definition: HardwareSPI.cpp:747
HardwareSPI::enableCRC
bool enableCRC(bool enable)
Enables CRC.
Definition: HardwareSPI.cpp:655
HardwareI2C::available
int available(void) override
Checks how many bytes are available in receiving buffer.
Definition: HardwareI2C.cpp:507
HardwareCRC::setOutputReverse
bool setOutputReverse(bool reverse)
Sets, if output CRC data bits will be reversed(reflected) or not.
Definition: HardwareCRC.cpp:491
HardwareTimer::getPeriod
uint32_t getPeriod()
Gets period that was set.
HardwareTimer::availableTimersCount
static uint8_t availableTimersCount
Available timer instances count.
Definition: HardwareTimer.h:696
SPI_Status
SPI_Status
Enumerations of SPI status codes.
Definition: HardwareSPI.h:110
HardwareCRC::reset
void reset(uint32_t initValue=DEFAULT_HCRC_INITVAL)
Resets calculation and sets initial value.
Definition: HardwareCRC.cpp:92
HardwareCRC::compute
uint32_t compute(const uint8_t *data, uint32_t dataLength, uint32_t initValue=DEFAULT_HCRC_INITVAL, uint32_t finalXOR=0x00)
Resets and computes CRC value of the whole array.
Definition: HardwareCRC.cpp:255
HardwareCRC::setPolynomial32
bool setPolynomial32(uint32_t polynomial=CRC32_POLY)
Sets CRC-32 polynomial.
Definition: HardwareCRC.cpp:63
INPUT_ANALOG
@ INPUT_ANALOG
This is a special mode for when the pin will be used for analog (not digital) reads.
Definition: wirish.h:495
HardwareCRC::lastCR
uint8_t lastCR
Definition: HardwareCRC.h:659
HCRC_IN_REVERSE_DISABLED
#define HCRC_IN_REVERSE_DISABLED
Definition: HardwareCRC.h:148
RESET_CAUSE_WINDOW_WATCHDOG_RESET
@ RESET_CAUSE_WINDOW_WATCHDOG_RESET
Window watchdog reset cause.
Definition: wirish.h:1048
SPISettings::_dataMode
uint8_t _dataMode
Definition: HardwareSPI.h:187
TIMER_16BIT_MAX_PRESCALER
#define TIMER_16BIT_MAX_PRESCALER
Definition: HardwareTimer.h:88
HardwareCRC::getPolynomialLength
uint8_t getPolynomialLength()
Gets polynomial length in bits.
Definition: HardwareCRC.cpp:74
HardwareSPI::receive16
virtual uint16_t receive16(bool lastByte=false)
Receives data from SPI periphery.
Definition: HardwareSPI.cpp:924
HardwareTimer::TIMPeriodElapsedCallback
void(* TIMPeriodElapsedCallback)()
Pointer to callback function, that is called on timer interrupt(overflow or underflow event).
Definition: HardwareTimer.h:686
EEPROMClass::EEPROMClass
EEPROMClass(void)
Definition: EEPROM.cpp:5
HardwareSPI::transferBytes
virtual bool transferBytes(const uint8_t *out, uint8_t *in, uint32_t size, bool lastByte=false)
Transfers data using SPI periphery in blocking mode, it is sending and receiving data simultaneously.
Definition: HardwareSPI.cpp:971
_Randomseed
unsigned long _Randomseed
Definition: wirish.cpp:1010
HardwareSPI::write
virtual bool write(uint16_t data, bool lastByte=false)
Sends data using SPI periphery.
Definition: HardwareSPI.cpp:849
HardwareI2C::endTransmission
uint8_t endTransmission(void)
Definition: HardwareI2C.cpp:411
HardwareTimer::availableChannelsCount
uint8_t availableChannelsCount()
Get count of available channels.
HardwareTimer::getClockDivision
uint8_t getClockDivision(void)
Gets clock division value.
HCRC_POLYSIZE_MASK
#define HCRC_POLYSIZE_MASK
Definition: HardwareCRC.h:129
detachInterrupt
int8_t detachInterrupt(uint8_t Pin, bool disableEXTIwhenNotUsed)
Detaches interrupt from selected pin and sets pin mode to INPUT.
Definition: wirish.cpp:738
TimerSettings::period
uint32_t period
Calculated period.
Definition: HardwareTimer.h:132
HardwareSPI::flushRX
void flushRX()
Clears RX FIFO buffer.
Definition: HardwareSPI.cpp:1128
HardwareCRC::append
uint32_t append(const uint8_t data, uint32_t finalXOR=0x00)
Appends another data to previous CRC calculation and calculates new CRC value.
Definition: HardwareCRC.cpp:100
HardwareCRC::getLastCRC
uint32_t getLastCRC(uint32_t finalXOR=0x00)
Gets last calculated CRC result.
Definition: HardwareCRC.h:267
HardwareTimer::stop
void stop(void)
Stops timer.
HCRC_32BIT_POLYSIZE
#define HCRC_32BIT_POLYSIZE
Definition: HardwareCRC.h:131
HardwareSPI::receiveBytes
virtual bool receiveBytes(uint8_t *data, uint32_t size, bool lastByte=false)
Receives data from SPI periphery in blocking mode.
Definition: HardwareSPI.cpp:1075
HardwareSerial::RxBufferReadPos
uint16_t RxBufferReadPos
Rading position in Rx Buffer.
Definition: HardwareSerial.h:675
HardwareTimer::setCallback
void setCallback(void(*PeriodElapsedCallback_)())
Sets callback function, that is called when timer period elapsed (interrupt).
CTS_OK_JUST_PERIOD
@ CTS_OK_JUST_PERIOD
Value was established just with period (prescaler value is 0)
Definition: HardwareTimer.h:106
HardwareTimer::instanceExists
bool instanceExists(void)
Checks if timer instance really exists and is based on real timer.
EEPROMClass::page_index
const uint16_t page_index
Definition: EEPROM.h:144
CTS_TOO_HIGH_RESULT
@ CTS_TOO_HIGH_RESULT
Value (duration_100ns) is higher than maximum available time that can be set using this timer with cu...
Definition: HardwareTimer.h:100
pinExists
bool pinExists(GPIO_TypeDef *GPIOx, uint16_t PPin)
Checks if pin is available on MCU.
Definition: wirish.cpp:73
HardwareSerial::connectDMAtoTx
bool connectDMAtoTx(DMA_HandleTypeDef &DMA_handle)
Use this method to connect DMA channel to UART Tx programmatically.
HardwareSPI_O::endTransaction
SPI_Status endTransaction() override
Disables SPI periphery and checks or sends CRC if enabled.
HardwareSPI_O::write16
bool write16(uint16_t data, bool lastByte=false) override
Sends data using SPI periphery.
HardwareI2C::errorCode
uint32_t errorCode(void)
Definition: HardwareI2C.h:126
HardwareSPI::isRxEnabled
bool isRxEnabled()
Checks, if SPI periphery can receive data.
Definition: HardwareSPI.cpp:443
HardwareSPI::setFrequency
bool setFrequency(uint32_t freq)
Calculates SPI clock divider from frequency and sets it.
Definition: HardwareSPI.cpp:479
EEPROMClass::_size
size_t _size
Definition: EEPROM.h:147
getPinSpeedSetting
uint32_t getPinSpeedSetting(GPIO_TypeDef *GPIOx, uint8_t INTPin)
This should return actual pin toggle speed setting.
Definition: wirish.cpp:628
HardwareSerial::WriteDoneCallback
void(* WriteDoneCallback)()
User callback function, that can be set using setWriteDoneCallback().
Definition: HardwareSerial.h:723
YIELD
#define YIELD
Definition: HardwareSerial.h:24
HardwareSPI::ErrorCallback
void(* ErrorCallback)(SPI_ErrorCode)
Definition: HardwareSPI.h:1040
SPISettings::_clock
uint32_t _clock
Definition: HardwareSPI.h:185
HAL_SPI_TxHalfCpltCallback
void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi)
Tx Half Transfer completed callback.
Definition: HardwareSPI.cpp:1262
HardwareSPI::isTImodeEnabled
bool isTImodeEnabled()
Gets if TI mode is enabled.
Definition: HardwareSPI.cpp:646
EEPROM
EEPROMClass EEPROM
Definition: EEPROM.cpp:208
HardwareSPI::setMode
bool setMode(uint32_t mode)
Sets Master or Slave mode.
Definition: HardwareSPI.cpp:297
AdvSerialConfig
UART_AdvFeatureInitTypeDef AdvSerialConfig
HAL library advanced configuration structure.
Definition: HardwareSerial.h:94
HardwareCRC::setPolynomial16
bool setPolynomial16(uint32_t polynomial=CRC16_POLY)
Sets CRC-16 polynomial.
Definition: HardwareCRC.cpp:50
HardwareSPI_O::receive
uint16_t receive(bool lastByte=false) override
Receives data from SPI periphery.
HardwareSPI_O::writeBytes
bool writeBytes(const uint8_t *data, uint32_t size, bool lastByte=false) override
Sends data using SPI periphery in blocking mode.
HardwareSPI_O::receive32
uint32_t receive32(bool lastByte=false) override
Receives data from SPI periphery.
interrupt.h
This file contains override weak GPIO interrupt functions.
CHANGE
#define CHANGE
GPIO interrupt will be triggered when pin state change.
Definition: wirish.h:1018
RESET_CAUSE_LOW_POWER_RESET
@ RESET_CAUSE_LOW_POWER_RESET
Low power reset cause.
Definition: wirish.h:1046
HardwareSPI::isCRCenabled
bool isCRCenabled()
Gets if CRC is enabled.
Definition: HardwareSPI.cpp:671
HardwareSerial::setWriteDoneCallback
void setWriteDoneCallback(void(*WriteDoneCallback_)())
Sets callback function, that will be called when all data using writeNonBlocking() method were send.
HardwareSPI::isTxEnabled
bool isTxEnabled()
Checks, if SPI periphery can transmit data.
Definition: HardwareSPI.cpp:448
HardwareSPI::WriteDoneCallback
void(* WriteDoneCallback)()
Definition: HardwareSPI.h:1034
ResetCause
enum reset_cause_e ResetCause
Possible STM32 system reset causes.
HardwareSPI::writeBytes
virtual bool writeBytes(const uint8_t *data, uint32_t size, bool lastByte=false)
Sends data using SPI periphery in blocking mode.
Definition: HardwareSPI.cpp:1023
CTS_IS_OK
#define CTS_IS_OK(state)
Checks if setInterval calculation was OK.
Definition: HardwareTimer.h:122
HardwareSPI::setHwCS
bool setHwCS(bool HardwareCS, bool OutputCS=true)
Sets if Chip Select pin is handled by hardware or by software (calling digitalWrite()).
Definition: HardwareSPI.cpp:327
getPinPullSetting
uint32_t getPinPullSetting(GPIO_TypeDef *GPIOx, uint8_t INTPin)
This function should return actual pin pull setting (GPIO_NOPULL, GPIO_PULLUP, GPIO_PULLDOWN)
Definition: wirish.cpp:581
HardwareSerial::getUARTIndex
static uint32_t getUARTIndex(USART_TypeDef *instance)
Gets UART instance index.
HCRC_OUT_REVERSE_MASK
#define HCRC_OUT_REVERSE_MASK
Definition: HardwareCRC.h:137
HardwareSerial::isSending
bool isSending()
Checks if data are sending right now and if periphery is busy.
HCRC_IN_REVERSE_ENABLED_BYTE
#define HCRC_IN_REVERSE_ENABLED_BYTE
Definition: HardwareCRC.h:145
SPI_TIMEOUT
@ SPI_TIMEOUT
SPI timeout was reached.
Definition: HardwareSPI.h:118
CTS_OK_ROUNDED_DOWN
@ CTS_OK_ROUNDED_DOWN
Value was established with the best possible accuracy, but is slightly lower than expected value.
Definition: HardwareTimer.h:114
SPI_ERR
@ SPI_ERR
Error, that happened during ending of transaction.
Definition: HardwareSPI.h:114
HardwareSPI::handleErrorCallback
static void handleErrorCallback(SPI_TypeDef *instance)
Handles Error callback function.
Definition: HardwareSPI.cpp:1212
HardwareTimer::setCounterMode
bool setCounterMode(uint32_t mode)
Sets timer Counter Mode.
HardwareSerial::instanceExists
bool instanceExists()
Checks if UART instance exists.
Definition: HardwareSerial.h:468
HardwareSerial::availableUARTsCount
static uint8_t availableUARTsCount
Available UART instances count.
Definition: HardwareSerial.h:750
HardwareTimer::lockSettings
void lockSettings()
Locks settings registers.
HardwareSPI::writeBytesNonBlocking
virtual bool writeBytesNonBlocking(const uint8_t *data, uint32_t size, bool lastByte=false)
Sends data using SPI periphery using DMA or IT (interrupt) mode.
Definition: HardwareSPI.cpp:1039
SPI_OK
@ SPI_OK
Transaction was without known error.
Definition: HardwareSPI.h:112
HardwareSerial::disconnectDMAfromTx
bool disconnectDMAfromTx()
Disconnects DMA channel from UART Tx.
pinMode
uint8_t pinMode(GPIO_TypeDef *GPIOx, uint16_t PPin, WiringPinMode mode, uint32_t speed)
Sets mode of selected pin.
Definition: wirish.cpp:250
InterruptHandler
void InterruptHandler(uint8_t lineFrom, uint8_t lineTo)
Include this in every EXTI interrupt handler for lines 0-15.
Definition: wirish.cpp:908
HardwareI2C::peek
int peek(void) override
Reads one byte from receiving buffer and without removing it from buffer.
Definition: HardwareI2C.cpp:523
min
#define min(a, b)
Compares 2 values and returns lower one.
Definition: HardwareSerial.cpp:65
HardwareSerial::rxBuf
uint8_t rxBuf[HS_RX_BUF_SIZE]
DMA or IT receiving buffer.
Definition: HardwareSerial.h:663
HardwareCRC::inputReverse
uint8_t inputReverse
Definition: HardwareCRC.h:679
HardwareSPI::isFullDuplex
bool isFullDuplex()
Check, if full duplex mode is enabled for this periphery.
Definition: HardwareSPI.cpp:438
HardwareSPI::HardwareSPI
HardwareSPI(SPI_HandleTypeDef &hspi)
Constructor.
Definition: HardwareSPI.cpp:21
getInterruptGPIOfromPin
GPIO_TypeDef * getInterruptGPIOfromPin(uint16_t Pin)
Gets, what GPIO is attached to EXTI line, that belongs to PPin.
Definition: wirish.cpp:471
HardwareCRC::lastFXOR
uint32_t lastFXOR
Definition: HardwareCRC.h:666
IRQLine::extiirqn
IRQn_Type extiirqn
Definition: wirish.cpp:393
HS_UART_AbortReceive_IT
void HS_UART_AbortReceive_IT(UART_HandleTypeDef *huart)
Copied from HAL UART library.
HardwareSPI::instances
static HardwareSPI * instances[]
Array of all created SPI instances (just from this class, not SPI structure).
Definition: HardwareSPI.h:1091
HardwareSPI::getMode
uint32_t getMode()
Gets, if periphery mode is Master or Slave.
Definition: HardwareSPI.cpp:309
HardwareSPI::removeThisFromInstArr
void removeThisFromInstArr()
Removes this instance from instances array.
Definition: HardwareSPI.cpp:1306
HardwareSPI_O::transfer32
uint32_t transfer32(uint32_t data, bool lastByte=false) override
SPI transfer is based on a simultaneous send and receive data.
HardwareTimer::getInterval
uint64_t getInterval(void)
Calculates interval from period, prescaler and timer clock division.
SPI_CRC_DATAWIDTH
@ SPI_CRC_DATAWIDTH
CRC size will be automatically aligned to data width, but data width have to be set to 8 or 16.
Definition: HardwareSPI.h:165
HardwareSPI::enableTImode
bool enableTImode(bool enable)
Enables or disabled TI mode.
Definition: HardwareSPI.cpp:624
HardwareTimer::getInterval_ns
uint64_t getInterval_ns(void)
Calculates interval from period, prescaler and timer clock division.
InterruptHandler
void InterruptHandler(uint8_t lineFrom, uint8_t lineTo)
Include this in every EXTI interrupt handler for lines 0-15.
Definition: wirish.cpp:908
EEPROMClass::_data
uint8_t * _data
Definition: EEPROM.h:146
HardwareSPI::isDMAconnectedToTx
bool isDMAconnectedToTx(void)
Checks if DMA channel is connected to SPI Tx and can be used for data writing/transferring.
Definition: HardwareSPI.cpp:289
HardwareSPI::isHwOutputCS
bool isHwOutputCS()
Gets, if Chip Select handled by hardware is set to output mode.
Definition: HardwareSPI.cpp:343
HardwareSerial::addThisToInstArr
void addThisToInstArr()
Writes new class instance to array of all timer instances.
EEPROMClass::getDataPtr
uint8_t * getDataPtr()
Definition: EEPROM.cpp:198
TimerSettings::prescaler
uint16_t prescaler
Calculated prescaler.
Definition: HardwareTimer.h:130
HardwareTimer::setPeriod
void setPeriod(uint32_t val)
Sets period that was set.
HardwareSPI::isReceiving
bool isReceiving()
Checks if data are receiving or transferring right now using DMA or IT and if periphery is busy.
Definition: HardwareSPI.h:279
HardwareSPI::availableSPIsCount
static uint8_t availableSPIsCount
Available SPI instances count.
Definition: HardwareSPI.h:1096
HardwareTimer::supportsSelectionCounterMode
bool supportsSelectionCounterMode()
Setup methods Those methods have to be called before init(void) method to apply settings.
HardwareSerial::read
int read(void) override
Reads incoming serial data.
HardwareSerial::abortDMARx
void abortDMARx()
Aborts Rx DMA Transfer.
HS_RX_BUF_SIZE
#define HS_RX_BUF_SIZE
Rx buffer size.
Definition: HardwareSerial.h:53
HardwareTimer::getCounterMode
uint32_t getCounterMode(void)
Gets timer Counter Mode.
Stream::_startMillis
unsigned long _startMillis
Used for timeout measurement.
Definition: Stream.h:66
HardwareTimer::getAvailableTimersCount
static uint8_t getAvailableTimersCount()
Gets available timer instances count.
HardwareSPI::end
bool end()
Deinitialization and disabling SPI periphery, it can be used for "sleep mode".
Definition: HardwareSPI.cpp:52
HardwareTimer::init
bool init(void)
Initialize timer instance.
HardwareSPI::getCRClength
SPI_CRCLength getCRClength()
Gets CRC length.
Definition: HardwareSPI.cpp:714
HardwareTimer::getDivTimerClockFreq
uint32_t getDivTimerClockFreq(void)
Gets timer clock frequency after clock division.
RESET_CAUSE_SOFTWARE_RESET
@ RESET_CAUSE_SOFTWARE_RESET
Software reset cause.
Definition: wirish.h:1052
HAL_SPI_RxHalfCpltCallback
void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi)
Rx Half Transfer completed callback.
Definition: HardwareSPI.cpp:1273
HardwareSPI::isTransacting
bool isTransacting()
Checks if data are sending, receiving, transferring right now using DMA or IT and if periphery is bus...
Definition: HardwareSPI.h:295
HardwareSPI::getDataMode
uint8_t getDataMode()
Gets, what data mode is set.
Definition: HardwareSPI.cpp:399
SerialMode
SerialMode
Enumeration of 3 UART direction modes.
Definition: HardwareSerial.h:67
SPI6_INDEX
#define SPI6_INDEX
HardwareSerial::end
void end()
Deinitialization and disabling UART periphery, it can be used for "sleep mode".
HardwareSPI
This class is for handling SPI periphery.
Definition: HardwareSPI.h:220
TS_ERROR
@ TS_ERROR
There is some error with timer.
Definition: HardwareTimer.h:158
OUTPUT
@ OUTPUT
Basic digital output: when the pin is HIGH, the voltage is held at +3.3v (Vcc) and when it is LOW,...
Definition: wirish.h:467
HardwareSPI::transfer16
virtual uint16_t transfer16(uint16_t data, bool lastByte=false)
SPI transfer is based on a simultaneous send and receive data.
Definition: HardwareSPI.cpp:776
EEPROMClass::_dirty
bool _dirty
Definition: EEPROM.h:148
HardwareTimer::setPrescaler
void setPrescaler(uint16_t factor)
Sets prescaler that was set.
HardwareSPI.h
This file contains class with methods to handle SPI periphery.
HardwareSPI::disconnectDMAfromTx
bool disconnectDMAfromTx()
Disconnects DMA channel from SPI Tx.
Definition: HardwareSPI.cpp:267
SPI4_INDEX
#define SPI4_INDEX
HardwareCRC::setPolynomial8
bool setPolynomial8(uint32_t polynomial=CRC8_POLY)
Sets CRC-8 polynomial.
Definition: HardwareCRC.cpp:37
HardwareSPI::setDataBits
bool setDataBits(uint16_t bits)
Sets SPI data width in bits.
Definition: HardwareSPI.cpp:550
HardwareI2C::begin
bool begin()
Definition: HardwareI2C.cpp:13
HAL_SPI_ErrorCallback
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi)
SPI error callback.
Definition: HardwareSPI.cpp:1295
HardwareI2C::requestFrom
uint8_t requestFrom(uint8_t address, size_t size, bool sendStop)
Definition: HardwareI2C.cpp:69
HardwareTimer::unlockSettings
void unlockSettings()
Advanced settings methods applied in real time Those setting methods can be called every time,...
SPI_BUSY_ERR
@ SPI_BUSY_ERR
SPI periphery is busy.
Definition: HardwareSPI.h:116
INPUT_FLOATING
@ INPUT_FLOATING
Synonym for INPUT.
Definition: wirish.h:516
TimerSettings::divider
uint8_t divider
Timer clock division.
Definition: HardwareTimer.h:134
HardwareSPI_O::receive16
uint16_t receive16(bool lastByte=false) override
Receives data from SPI periphery.
WirishInit
bool WirishInit(void)
Initializes some wirish functions.
Definition: wirish.cpp:931
attachInterrupt
int8_t attachInterrupt(uint8_t Pin, std::function< void(void)> handler, int mode)
Attaches interrupt to selected pin.
Definition: wirish.cpp:669
HardwareCRC::setInputReverse
bool setInputReverse(bool reverse)
Sets, if input data bits will be reversed(reflected) or not.
Definition: HardwareCRC.cpp:481
HardwareTimer::setInterval_ns
TimerSettings setInterval_ns(uint64_t interval_ns)
Easiest settings methods applied in real time.
HardwareTimer::CalculateTime_ns
uint64_t CalculateTime_ns(uint32_t prescaler, uint32_t period, uint32_t timerFreq, uint8_t clockDiv)
Calculates interval from period and prescaler and clock division.
Definition: HardwareTimer.h:622
HardwareTimer::deInit
void deInit(void)
Deinitialization of timer.
MAX_PRECISION
#define MAX_PRECISION
HCRC_8BIT_POLYSIZE
#define HCRC_8BIT_POLYSIZE
Definition: HardwareCRC.h:133
HardwareSerial::getClockInstFrequency
uint32_t getClockInstFrequency()
Gets UART periphery clock frequency.
__attribute__
void __attribute__((optimize("Ofast"))) delayMicroseconds(int32_t microseconds)
Definition: wirish.cpp:997
HardwareSPI_O::transferBytes
bool transferBytes(const uint8_t *out, uint8_t *in, uint32_t size, bool lastByte=false) override
Transfers data using SPI periphery in blocking mode, it is sending and receiving data simultaneously.
SPI_CRC_ERR
@ SPI_CRC_ERR
SPI CRC calculation error (see enableCRC())
Definition: HardwareSPI.h:124
HardwareSerial::connectDMAtoRx
bool connectDMAtoRx(DMA_HandleTypeDef &DMA_handle)
Use this method to connect DMA channel to UART Rx programmatically.
I2C_TIMEOUT_STOPF
#define I2C_TIMEOUT_STOPF
Definition: HardwareI2C.h:66
canSetInterruptOnPin
bool canSetInterruptOnPin(uint8_t Pin)
Checks if EXTI line, that belongs to Pin is not used by other pin's interrupt.
Definition: wirish.cpp:459
SPISettings::_bitOrder
uint8_t _bitOrder
Definition: HardwareSPI.h:186
SPI5_INDEX
#define SPI5_INDEX
TS_PAUSED
@ TS_PAUSED
Timer is paused, counter register is unchanged.
Definition: HardwareTimer.h:154
HardwareSerial::disconnectDMAfromRx
bool disconnectDMAfromRx()
Disconnects DMA channel from UART Rx.
Definition: HardwareSerial.h:152
HardwareCRC::lastCRCCheckValue
uint32_t lastCRCCheckValue
Definition: HardwareCRC.h:667
EEPROMClass::commit
bool commit()
Definition: EEPROM.cpp:81
INPUT_PULLDOWN
@ INPUT_PULLDOWN
The state of the pin in this mode is reported the same way as with INPUT, but the pin voltage is gent...
Definition: wirish.h:508
HardwareCRC::computeAndWriteToEnd
uint32_t computeAndWriteToEnd(uint8_t *data, uint32_t dataLength, uint32_t initValue=DEFAULT_HCRC_INITVAL, uint32_t finalXOR=0x00)
Resets, computes CRC value of the whole array and attaches calculated CRC value at the end of the arr...
Definition: HardwareCRC.cpp:270
HCRC_IN_REVERSE_ENABLED_HALFWORD
#define HCRC_IN_REVERSE_ENABLED_HALFWORD
Definition: HardwareCRC.h:146
HardwareI2C::write
size_t write(uint8_t) override
Writes one unsigned byte (character).
Definition: HardwareI2C.cpp:469
HardwareI2C::isMaster
bool isMaster(void)
Definition: HardwareI2C.h:118
HardwareCRC::setPolynomial7
bool setPolynomial7(uint32_t polynomial=CRC7_POLY)
Sets CRC-7 polynomial.
Definition: HardwareCRC.cpp:24
SPI_CRCLength
SPI_CRCLength
Enumerations of SPI CRC lengths.
Definition: HardwareSPI.h:160
wirish.h
This file contains basic (Arduino like) GPIO manipulation functions, delay, random,...
HCRC_IN_REVERSE_MASK
#define HCRC_IN_REVERSE_MASK
Definition: HardwareCRC.h:143
HardwareSerial::handleTxDoneCallback
static void handleTxDoneCallback(USART_TypeDef *instance)
Handles TxDone callback function.
HardwareTimer::isInitDone
bool isInitDone(void)
Checks if timer was initialized.
HardwareSPI::isDMAconnectedToRx
bool isDMAconnectedToRx(void)
Checks if DMA channel is connected to SPI Rx and can be used for data receiving/transferring.
Definition: HardwareSPI.cpp:280
HCRC_OUT_REVERSE_ENABLED
#define HCRC_OUT_REVERSE_ENABLED
Definition: HardwareCRC.h:139
HardwareI2C::setClock
void setClock(uint32_t)
Definition: HardwareI2C.cpp:59
HardwareTimer::HardwareTimer
HardwareTimer(TIM_HandleTypeDef &tim)
Hardware timer constructor.
FALLING
#define FALLING
GPIO interrupt will be triggered when pin state change from HIGH to LOW.
Definition: wirish.h:1024
PIN_TO_PORT_PIN
#define PIN_TO_PORT_PIN(Pin)
Converts Arduino like pin number (Pin) to Pin of port (PPin).
Definition: wirish.h:557
HardwareSPI::connectDMAtoTx
bool connectDMAtoTx(DMA_HandleTypeDef &DMA_handle)
Use this method to connect DMA channel to SPI Tx programmatically.
Definition: HardwareSPI.cpp:163
W_BAD_ARG
#define W_BAD_ARG
Wirish status Bad Arguments.
Definition: wirish.h:119
FLASH_PAGES_COUNT
#define FLASH_PAGES_COUNT
Flash page count (127 pages for STM32L432KC)
Definition: EEPROM.h:30
HardwareTimer::createdTim
TIM_HandleTypeDef createdTim
We need this structure when calling HardwareTimer(TIM_TypeDef* instance) constructor,...
Definition: HardwareTimer.h:598
MAX_NBYTE_SIZE
#define MAX_NBYTE_SIZE
Definition: HardwareI2C.h:64
HardwareSPI::transactionError
SPI_Status transactionError
Last transaction status.
Definition: HardwareSPI.h:1045
HardwareSPI::setBitOrder
bool setBitOrder(uint8_t bitOrder)
Sets bit order to LSB or MSB.
Definition: HardwareSPI.cpp:415
HardwareSPI::setCRCPolynomial
bool setCRCPolynomial(uint32_t polynomial)
Sets CRC polynomial.
Definition: HardwareSPI.cpp:723
HardwareSerial::getUARTInstances
static HardwareSerial ** getUARTInstances()
Gets array of all created UART instances (just from this class, not UART structure).
HardwareSPI::instanceExists
bool instanceExists(void)
Checks if SPI instance exists.
Definition: HardwareSPI.h:303
IRQLine
Definition: wirish.cpp:391
CTS_BAD_ARGUMENT
@ CTS_BAD_ARGUMENT
Check if values maxPrescaler, maxCounter, minPeriod are correct.
Definition: HardwareTimer.h:98
CTS_OK_JUST_PRESCALER
@ CTS_OK_JUST_PRESCALER
Value was established just with prescaler (period value is 0) - This should never happens when you ha...
Definition: HardwareTimer.h:108
HardwareSerial::~HardwareSerial
~HardwareSerial()
Destructor.
HardwareTimer::handleCallback
static void handleCallback(TIM_TypeDef *instance)
Expert methods Those methods you probably don't need to call in basic timer operation.
HardwareSPI::addThisToInstArr
void addThisToInstArr()
Writes new class instance to array of all timer instances.
Definition: HardwareSPI.cpp:1300
HardwareI2C::instanceExists
bool instanceExists(void)
Checks if I2C instance exists.
Definition: HardwareI2C.h:114
HardwareI2C::status
uint8_t status()
Definition: HardwareI2C.cpp:50
HardwareSerial::peek
int peek(void) override
Returns the next byte (character) of incoming serial data without removing it from the Rx buffer.
HardwareCRC.h
This file contains class, that provides hardware CRC calculation.
TimerSettings::state
CalculateTimerState state
Calculation state.
Definition: HardwareTimer.h:136
RESET_CAUSE_BROWNOUT_RESET
@ RESET_CAUSE_BROWNOUT_RESET
Brownout reset cause.
Definition: wirish.h:1060
HardwareSPI::lastTransactionStatus
virtual SPI_Status lastTransactionStatus()
Checks last transaction status.
Definition: HardwareSPI.h:878
HardwareTimer::getCount
uint32_t getCount(void)
Gets current value in counter register.
HardwareSerial::isDMAconnectedToTx
bool isDMAconnectedToTx(void)
Checks if DMA channel is connected to UART Tx and can be used for data transmitting.
HardwareSPI::receive
virtual uint16_t receive(bool lastByte=false)
Receives data from SPI periphery.
Definition: HardwareSPI.cpp:908
HardwareTimer::getTimerClockFreq
uint32_t getTimerClockFreq(void)
Gets timer clock frequency before clock division.
CTS_OK_BEST_ACCURACY
@ CTS_OK_BEST_ACCURACY
Value was established with the best possible accuracy.
Definition: HardwareTimer.h:110
I2C_BUFFER_LENGTH
#define I2C_BUFFER_LENGTH
Definition: HardwareI2C.h:55
HardwareSerial::removeThisFromInstArr
void removeThisFromInstArr()
Removes this instance from instances array.
HardwareTimer::setCount
void setCount(uint32_t val)
Sets new value to counter register.
HCRC_IN_REVERSE_ENABLED_WORD
#define HCRC_IN_REVERSE_ENABLED_WORD
Definition: HardwareCRC.h:147
irqlines
IRQLine irqlines[]
Definition: wirish.cpp:400
HardwareSPI::setDataMode
bool setDataMode(uint8_t dataMode)
Sets data mode.
Definition: HardwareSPI.cpp:372
HardwareSerial::_uart
UART_HandleTypeDef * _uart
UART periphery handle structure.
Definition: HardwareSerial.h:642
HAL_SPI_TxRxHalfCpltCallback
void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi)
Tx and Rx Half Transfer callback.
Definition: HardwareSPI.cpp:1284
HardwareSPI::write32
virtual bool write32(uint32_t data, bool lastByte=false)
Sends data using SPI periphery.
Definition: HardwareSPI.cpp:884
HCRC_7BIT_POLYSIZE
#define HCRC_7BIT_POLYSIZE
Definition: HardwareCRC.h:134
HardwareTimer::removeThisFromInstArr
void removeThisFromInstArr()
Removes this instance from instances array.
TimerSettings
Structure, those data was calculated in setInterval method.
Definition: HardwareTimer.h:128
HardwareTimer::~HardwareTimer
~HardwareTimer()
Class destructor.
HardwareTimer::setInterval
TimerSettings setInterval(uint64_t interval_ms)
Calculates period and prescaler and clock division from set interval.
HardwareSPI::TransferDoneCallback
void(* TransferDoneCallback)()
Definition: HardwareSPI.h:1035
HardwareTimer::pause
void pause(void)
Timer control functions Those methods can be called just after init(void) method.
SPI_CRC_2BYTES
@ SPI_CRC_2BYTES
CRC will be 16 bits wide.
Definition: HardwareSPI.h:169
HardwareSerial::UART_EndTxTransfer
void UART_EndTxTransfer(UART_HandleTypeDef *huart)
Aborts Tx IT Transfer.
HardwareI2C::flush
void flush(void)
Definition: HardwareI2C.cpp:533
HardwareCRC::check
bool check(const uint8_t *data, uint32_t dataLength, uint32_t initValue=DEFAULT_HCRC_INITVAL, uint32_t finalXOR=0x00)
Checks if the array (with CRC attached at the end) is valid.
Definition: HardwareCRC.cpp:354
SPI_CRC_1BYTE
@ SPI_CRC_1BYTE
CRC will be 8 bits wide.
Definition: HardwareSPI.h:167
MSBFIRST
#define MSBFIRST
Most Significant Bit First.
Definition: wirish.h:1012
random
unsigned long random(unsigned long from, unsigned long to)
The random function generates pseudo-random numbers.
Definition: wirish.cpp:1013
HardwareI2C::setClockStretchLimit
void setClockStretchLimit(uint32_t)
Definition: HardwareI2C.cpp:64
HardwareSerial::writeNonBlocking
size_t writeNonBlocking(const uint8_t *buffer, size_t size)
Writes binary data to the serial port.
SPI1_INDEX
#define SPI1_INDEX
HardwareSerial::getAvailableUARTsCount
static uint8_t getAvailableUARTsCount()
Gets available UARTs instances count.
HardwareTimer::addThisToInstArr
void addThisToInstArr()
Writes new class instance to array of all timer instances.
HardwareSerial::abortDMATx
void abortDMATx()
Aborts Tx DMA Transfer.
EEPROM.h
max
#define max(a, b)
Definition: HardwareTimer.h:82
EEPROMClass
Definition: EEPROM.h:33
PortAndPinToPinNum
uint8_t PortAndPinToPinNum(GPIO_TypeDef *GPIOx, uint16_t PPin)
Converts GPIOx port and it's pin to Arduino like pin number.
Definition: wirish.cpp:176
HardwareTimer.h
This file contains HardwareTimer class, that you can use to easy timer handling.
HardwareSPI::_hspi
SPI_HandleTypeDef * _hspi
Pointer to SPI handle structure.
Definition: HardwareSPI.h:1017
HardwareSPI::getDataBits
uint16_t getDataBits()
Gets set data width in bits.
Definition: HardwareSPI.cpp:613
HardwareTimer::is32BitTimer
bool is32BitTimer()
Checks if timer is 32bit or 16bit.
HardwareSPI::connectDMAtoRx
bool connectDMAtoRx(DMA_HandleTypeDef &DMA_handle)
Use this method to connect DMA channel to SPI Rx programmatically.
Definition: HardwareSPI.cpp:75
HardwareSPI::ReceiveHalfCallback
void(* ReceiveHalfCallback)()
Definition: HardwareSPI.h:1039
WirishInitDone
bool WirishInitDone
Definition: wirish.cpp:975
HardwareSPI::setCRClength
bool setCRClength(SPI_CRCLength length)
Sets CRC length.
Definition: HardwareSPI.cpp:676
HardwareSPI::handleTransferHalfCallback
static void handleTransferHalfCallback(SPI_TypeDef *instance)
Handles TransferHalf callback function.
Definition: HardwareSPI.cpp:1192
HardwareI2C::beginTransmission
bool beginTransmission(uint16_t address, uint32_t bytesCountToSend)
Definition: HardwareI2C.cpp:261
HardwareSPI::disconnectDMAfromRx
bool disconnectDMAfromRx()
Disconnects DMA channel from SPI Rx.
Definition: HardwareSPI.cpp:252
CTS_OK_ROUNDED_UP
@ CTS_OK_ROUNDED_UP
Value was established with the best possible accuracy, but is slightly higher than expected value.
Definition: HardwareTimer.h:112
EEPROMClass::writeToFlash
static uint32_t writeToFlash(uint32_t pageIndex, uint8_t bank, const uint8_t *data, uint32_t dataLenght)
Definition: EEPROM.cpp:130
HardwareSerial
This class is for handling UART periphery.
Definition: HardwareSerial.h:109
HardwareSPI::getClockDivider
uint32_t getClockDivider()
Gets clock divider.
Definition: HardwareSPI.cpp:545
CTS_TOO_LOW_RES
@ CTS_TOO_LOW_RES
Value (duration_100ns) is lower than minumum available time that can be set using this timer with cur...
Definition: HardwareTimer.h:102
HardwareTimer::instances
static HardwareTimer * instances[]
Array of all created timers instances (just from this class, not timer structure).
Definition: HardwareTimer.h:691
ftoa
std::enable_if< std::is_floating_point< T >::value, char * >::type ftoa(T f, char *buf, int precision)
Converts floating point number to char array.
Definition: ftoa.h:49
HardwareI2C.h
HardwareTimer::CalculateTime_ms
uint64_t CalculateTime_ms(uint32_t prescaler, uint32_t period, uint32_t timerFreq, uint8_t clockDiv)
Calculates interval from period and prescaler and clock division.
Definition: HardwareTimer.h:638
HardwareSPI::TransferHalfCallback
void(* TransferHalfCallback)()
Definition: HardwareSPI.h:1038
HardwareSerial::readBytes
size_t readBytes(char *buffer, size_t size) override
@Reads characters from the Rx buffer into your buffer.
HardwareSPI::_startMillis
uint32_t _startMillis
Start time of transferring/receiving/sending data non-blocking.
Definition: HardwareSPI.h:1022
Stream::_timeout
unsigned long _timeout
Number of milliseconds to wait for the next char before aborting timed read.
Definition: Stream.h:61
HardwareI2C::read
int read(void) override
Reads one byte from receiving buffer and removes it from buffer.
Definition: HardwareI2C.cpp:512
HardwareTimer
Handle timers in interrupt mode really easy using this class. In table below, you can see methods se...
Definition: HardwareTimer.h:211
HardwareCRC::begin
bool begin()
Enables CRC hardware calculation unit.
Definition: HardwareCRC.cpp:11
HardwareSPI::getBitOrder
uint8_t getBitOrder()
Gets, if bit order is set to LSB or MSB.
Definition: HardwareSPI.cpp:430
HardwareSPI::~HardwareSPI
~HardwareSPI()
Destructor.
Definition: HardwareSPI.cpp:25
TIMER_16BIT_MAX_PERIOD
#define TIMER_16BIT_MAX_PERIOD
Definition: HardwareTimer.h:90
SPI2_INDEX
#define SPI2_INDEX
HardwareSPI_O::beginTransaction
SPI_Status beginTransaction(SPISettings settings) override
Enables SPI periphery and sets some settings.
HardwareI2C::end
bool end()
Definition: HardwareI2C.cpp:41
W_OK
#define W_OK
Wirish status OK.
Definition: wirish.h:114
HardwareSPI::transferBytesNonBlocking
virtual bool transferBytesNonBlocking(const uint8_t *out, uint8_t *in, uint32_t size, bool lastByte=false)
Transfers data using SPI periphery using DMA or IT (interrupt) mode, it is sending and receiving data...
Definition: HardwareSPI.cpp:987
HardwareSerial::write
size_t write(uint8_t c) override
Writes binary data to the serial port.
getResetCauseName
const char * getResetCauseName()
Gets the system reset cause as an ASCII-printable name string from a reset cause type.
Definition: wirish.cpp:1088
WiringPinMode
WiringPinMode
Pin mode enumerations.
Definition: wirish.h:466
HardwareTimer::supportsClockDivision
bool supportsClockDivision()
Checks if timer supports clock division.
HardwareSPI_O::transfer16
uint16_t transfer16(uint16_t data, bool lastByte=false) override
SPI transfer is based on a simultaneous send and receive data.
RESET_CAUSE_EXTERNAL_RESET_PIN_RESET
@ RESET_CAUSE_EXTERNAL_RESET_PIN_RESET
External reset pin reset cause.
Definition: wirish.h:1058
EEPROMClass::end
bool end()
Definition: EEPROM.cpp:34
I2C_TIMEOUT_BUSY
#define I2C_TIMEOUT_BUSY
Definition: HardwareI2C.h:67
HardwareSPI::getTimeout
uint32_t getTimeout()
Gets timeout in milliseconds.
Definition: HardwareSPI.cpp:751
SPI_GEN_ERR
@ SPI_GEN_ERR
SPI generic error.
Definition: HardwareSPI.h:120
HardwareSPI_O::transfer
uint16_t transfer(uint16_t data, bool lastByte=false) override
SPI transfer is based on a simultaneous send and receive data.
SPI_ERR_LOCKED
@ SPI_ERR_LOCKED
SPI periphery is locked already.
Definition: HardwareSPI.h:122
HardwareSerial::instances
static HardwareSerial * instances[]
Array of all created UART instances (just from this class, not UART structure).
Definition: HardwareSerial.h:745
SPI0_INDEX
#define SPI0_INDEX
GPIO_Conversion_Table
GPIO_TypeDef * GPIO_Conversion_Table[]
Definition: wirish.cpp:13
W_ERR
#define W_ERR
Wirish status Error.
Definition: wirish.h:124
EEPROMClass::write
void write(int const address, uint8_t const value)
Definition: EEPROM.cpp:64
EEPROMClass::getConstDataPtr
const uint8_t * getConstDataPtr() const
Definition: EEPROM.cpp:203
HardwareTimer::state
TimerState state(void)
Checks timer state.