![]() |
Arduino Core for STM32
1.0
|
#include "wirish.h"
Classes | |
struct | IRQLine |
Macros | |
#define | NUM_IRQ_LINES (sizeof(irqlines) / sizeof(IRQLine)) |
Functions | |
bool | pinExists (GPIO_TypeDef *GPIOx, uint16_t PPin) |
Checks if pin is available on MCU. More... | |
bool | pinExists (uint8_t Pin) |
Checks if pin is available on MCU. More... | |
uint8_t | PortAndPinToPinNum (GPIO_TypeDef *GPIOx, uint16_t PPin) |
Converts GPIOx port and it's pin to Arduino like pin number. More... | |
uint8_t | pinMode (GPIO_TypeDef *GPIOx, uint16_t PPin, WiringPinMode mode, uint32_t speed) |
Sets mode of selected pin. More... | |
bool | enableGPIO (GPIO_TypeDef *GPIOx, bool enable) |
Enables/Disables GPIO port periphery. More... | |
uint8_t | pinMode (uint8_t Pin, WiringPinMode mode, uint32_t speed) |
Sets mode of selected pin. More... | |
bool | canSetInterruptOnPin (uint8_t Pin) |
Checks if EXTI line, that belongs to Pin is not used by other pin's interrupt. More... | |
GPIO_TypeDef * | getInterruptGPIOfromPin (uint16_t Pin) |
Gets, what GPIO is attached to EXTI line, that belongs to PPin. More... | |
bool | isInterruptSetOnPin (uint8_t Pin) |
Checks Pin is used as interrupt. More... | |
uint32_t | getPinPullSetting (GPIO_TypeDef *GPIOx, uint8_t INTPin) |
This function should return actual pin pull setting (GPIO_NOPULL, GPIO_PULLUP, GPIO_PULLDOWN) More... | |
uint32_t | getPinSpeedSetting (GPIO_TypeDef *GPIOx, uint8_t INTPin) |
This should return actual pin toggle speed setting. More... | |
int8_t | attachInterrupt (uint8_t Pin, std::function< void(void)> handler, int mode) |
Attaches interrupt to selected pin. More... | |
int8_t | detachInterrupt (uint8_t Pin, bool disableEXTIwhenNotUsed) |
Detaches interrupt from selected pin and sets pin mode to INPUT. More... | |
void | InterruptHandler (uint8_t lineFrom, uint8_t lineTo) |
Include this in every EXTI interrupt handler for lines 0-15. More... | |
bool | WirishInit (void) |
Initializes some wirish functions. More... | |
void | __attribute__ ((optimize("Ofast"))) delayMicroseconds(int32_t microseconds) |
unsigned long | random (unsigned long from, unsigned long to) |
The random function generates pseudo-random numbers. More... | |
unsigned long | random (unsigned long to) |
The random function generates pseudo-random numbers. More... | |
void | randomSeed (unsigned long seed) |
Initializes the pseudo-random number generator, causing it to start at an arbitrary point in its random sequence. More... | |
const char * | getResetCauseName () |
Gets the system reset cause as an ASCII-printable name string from a reset cause type. More... | |
Variables | |
GPIO_TypeDef * | GPIO_Conversion_Table [] |
IRQLine | irqlines [] |
bool | WirishInitDone = true |
unsigned long | _Randomseed = 1 |
ResetCause | rst_cs = reset_cause_read() |
bool pinExists | ( | GPIO_TypeDef * | GPIOx, |
uint16_t | PPin | ||
) |
Checks if pin is available on MCU.
GPIOx | GPIO port periphery. |
PPin | Pin of that port to convert (GPIO_PIN_0, GPIO_PIN_1, ...). Do not use combined pins (e.g. GPIO_PIN_0 | GPIO_PIN_1) |
bool pinExists | ( | uint8_t | Pin | ) |
Checks if pin is available on MCU.
Pin | Arduino like pin number. |
uint8_t PortAndPinToPinNum | ( | GPIO_TypeDef * | GPIOx, |
uint16_t | PPin | ||
) |
Converts GPIOx port and it's pin to Arduino like pin number.
GPIOx | GPIO port. |
PPin | Pin of that port to convert (GPIO_PIN_0, GPIO_PIN_1, ...). Do not use combined pins (e.g. GPIO_PIN_0 | GPIO_PIN_1) |
uint8_t pinMode | ( | GPIO_TypeDef * | GPIOx, |
uint16_t | PPin, | ||
WiringPinMode | mode, | ||
uint32_t | speed | ||
) |
Sets mode of selected pin.
GPIOx | GPIO port. |
PPin | Pin of that port (GPIO_PIN_0, GPIO_PIN_1, ...). |
mode | Pin mode that will be set. |
speed | Toggle speed of pin. Available values: GPIO_SPEED_FREQ_LOW, GPIO_SPEED_FREQ_MEDIUM, GPIO_SPEED_FREQ_HIGH, GPIO_SPEED_FREQ_VERY_HIGH (only some MCUs supports this speed setting)) |
bool enableGPIO | ( | GPIO_TypeDef * | GPIOx, |
bool | enable | ||
) |
Enables/Disables GPIO port periphery.
GPIOx | GPIO port periphery. |
enable | If true, periphery will be enabled, else disabled. |
uint8_t pinMode | ( | uint8_t | Pin, |
WiringPinMode | mode, | ||
uint32_t | speed | ||
) |
Sets mode of selected pin.
Pin | Arduino like pin number. |
mode | Pin mode that will be set. |
speed | Toggle speed of pin. Available values: GPIO_SPEED_FREQ_LOW, GPIO_SPEED_FREQ_MEDIUM, GPIO_SPEED_FREQ_HIGH, GPIO_SPEED_FREQ_VERY_HIGH (only some MCUs supports this speed setting)) |
bool canSetInterruptOnPin | ( | uint8_t | Pin | ) |
Checks if EXTI line, that belongs to Pin is not used by other pin's interrupt.
Pin | Arduino like pin number. |
GPIO_TypeDef* getInterruptGPIOfromPin | ( | uint16_t | Pin | ) |
Gets, what GPIO is attached to EXTI line, that belongs to PPin.
Pin | Arduino like pin number. |
bool isInterruptSetOnPin | ( | uint8_t | Pin | ) |
Checks Pin is used as interrupt.
Pin | Arduino like pin number. |
uint32_t getPinPullSetting | ( | GPIO_TypeDef * | GPIOx, |
uint8_t | INTPin | ||
) |
This function should return actual pin pull setting (GPIO_NOPULL, GPIO_PULLUP, GPIO_PULLDOWN)
GPIOx | GPIO port. |
INTPin | Interrupt pin number (0-15). |
uint32_t getPinSpeedSetting | ( | GPIO_TypeDef * | GPIOx, |
uint8_t | INTPin | ||
) |
This should return actual pin toggle speed setting.
GPIOx | GPIO port. |
INTPin | Interrupt pin number (0-15). |
int8_t attachInterrupt | ( | uint8_t | Pin, |
std::function< void(void)> | , | ||
int | mode | ||
) |
Attaches interrupt to selected pin.
Pin | Arduino like pin. |
handler | Function, that will be called when interrupt is triggered. |
mode | Mode of interrupt (RISING, FALLING, CHANGE). |
int8_t detachInterrupt | ( | uint8_t | Pin, |
bool | disableEXTIwhenNotUsed = false |
||
) |
Detaches interrupt from selected pin and sets pin mode to INPUT.
Pin | Arduino like pin number. |
disableEXTIwhenNotUsed | True if you want to disable group of EXTI lines when they are not used yet. It can save energy, but it can also disable GPIO interrupt, that is set using .ioc file. |
void InterruptHandler | ( | uint8_t | lineFrom, |
uint8_t | lineTo | ||
) |
Include this in every EXTI interrupt handler for lines 0-15.
lineFrom | Specify first handler line |
lineTo | Specify last handler line |
bool WirishInit | ( | void | ) |
Initializes some wirish functions.
void __attribute__ | ( | (optimize("Ofast")) | ) |
unsigned long random | ( | unsigned long | from, |
unsigned long | to | ||
) |
The random function generates pseudo-random numbers.
from | Lower bound of the random value, inclusive (optional). |
to | Upper bound of the random value, exclusive. |
unsigned long random | ( | unsigned long | to | ) |
The random function generates pseudo-random numbers.
to | Upper bound of the random value, exclusive. |
void randomSeed | ( | unsigned long | seed | ) |
Initializes the pseudo-random number generator, causing it to start at an arbitrary point in its random sequence.
This sequence, while very long, and random, is always the same.
seed | Number to initialize the pseudo-random sequence. |
const char* getResetCauseName | ( | ) |
Gets the system reset cause as an ASCII-printable name string from a reset cause type.
reset_cause | The previously-obtained system reset cause |
GPIO_TypeDef* GPIO_Conversion_Table[] |
IRQLine irqlines[] |
bool WirishInitDone = true |
unsigned long _Randomseed = 1 |
ResetCause rst_cs = reset_cause_read() |