текучка

This commit is contained in:
klassents committed 2024-10-09 11:27:37 +07:00
1 parent b920713163
commit 47ff1ce4eb
7 files changed
+141 -86

No files matched your search

+6 -9
View File
@@ -14,6 +14,7 @@
#include "pins_arduino.h"
#include "mik32_hal_adc.h"
#include "wiring_analog.h"
#include "wiring_LL.h"
#ifdef __cplusplus
extern "C" {
@@ -107,10 +108,6 @@ volatile uint32_t* portInputRegister(GPIO_TypeDef* GPIO_x)
return &GPIO_x->STATE;
}
// return config of pin with pinShift(0...16) in portReg (config, pupd, ds for ports 0...2)
#define PIN_PAD_CONFIG(portReg, pinShift) ((PAD_CONFIG->portReg >> (pinShift<<1)) & 0b11)
// ---------------------- ADC ---------------------- //
// determines the ADC channel number by the board pin number
uint32_t analogInputToChannelNumber(uint32_t PinNumber)
@@ -168,9 +165,9 @@ bool digitalPinPwmIsOn(uint8_t digitalPin)
uint8_t pinShift = pwmPinToGpioPinShift(digitalPin);
if (PWM_PIN_TO_PORT_NUMBER(digitalPin) == 0)
config = PIN_PAD_CONFIG(PORT_0_CFG, pinShift);
config = PIN_GET_PAD_CONFIG(PORT_0_CFG, pinShift);
else
config = PIN_PAD_CONFIG(PORT_1_CFG, pinShift);
config = PIN_GET_PAD_CONFIG(PORT_1_CFG, pinShift);
if (config == 2)
return true;
@@ -216,9 +213,9 @@ HAL_TIMER32_CHANNEL_IndexTypeDef pwmPinToTimerChannel(uint32_t digPinNumber)
}
// ---------------------- interrupts ---------------------- //
// interrupt table
// interrupt table is stored in ram to improve performance
// index = interrupt number. In each row {digitalPinNumber, IntLineValue, IntMuxValue}
const uint8_t interruptInfo[EXTERNAL_NUM_INTERRUPTS][3] =
uint8_t interruptInfo[EXTERNAL_NUM_INTERRUPTS][3] =
{
{ 2, GPIO_LINE_2, GPIO_MUX_LINE_2_PORT0_10}, // INT0
{ 3, GPIO_LINE_0, GPIO_MUX_LINE_0_PORT0_0}, // INT1
@@ -281,7 +278,7 @@ void spi_onBegin(void)
// because spi needs pin 1.3 for correct work
// replace config from 1.3 to 1.4
uint8_t config = PIN_PAD_CONFIG(PORT_1_CFG, PIN_3_SHIFT);
uint8_t config = PIN_GET_PAD_CONFIG(PORT_1_CFG, PIN_3_SHIFT);
if (config == 0) // common gpio
{
// get info from pin gpio1.3 and set config to gpio1.4