Обновлены пины в проекте PY32F002A и в принципе описание всех пинов для B и A контроллера
This commit is contained in:
@@ -22,8 +22,14 @@
|
||||
#include "onewire.h"
|
||||
|
||||
/* I/O Port ------------------------------------------------------------------*/
|
||||
#ifdef PY32F002Bx5
|
||||
#define DS_Pin GPIO_PIN_0
|
||||
#define DS_GPIO_Port GPIOB
|
||||
#endif
|
||||
#ifdef PY32F002Ax5
|
||||
#define DS_Pin GPIO_PIN_3
|
||||
#define DS_GPIO_Port GPIOA
|
||||
#endif
|
||||
|
||||
/* Data Structure ------------------------------------------------------------*/
|
||||
#define DS18B20_DEVICE_AMOUNT 30
|
||||
|
||||
@@ -8,6 +8,13 @@
|
||||
#include "onewire.h"
|
||||
#include "tim.h"
|
||||
|
||||
#ifdef PY32F002Bx5
|
||||
#define PIN_NUMB 0
|
||||
#endif
|
||||
#ifdef PY32F002Ax5
|
||||
#define PIN_NUMB 3
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The internal function is used as gpio pin mode
|
||||
* @param OW OneWire HandleTypedef
|
||||
@@ -18,11 +25,11 @@ void OneWire_Pin_Mode(OneWire_t* OW, PinMode Mode)
|
||||
#ifdef CMSIS_Driver
|
||||
if(Mode == Input)
|
||||
{
|
||||
OW->DataPort->MODER &= ~((GPIO_MODER_MODE0_Msk) << 0);
|
||||
OW->DataPort->MODER |= (GPIO_MODE_INPUT << (0+2));
|
||||
OW->DataPort->MODER &= ~((GPIO_MODER_MODE0_Msk) << PIN_NUMB);
|
||||
OW->DataPort->MODER |= (GPIO_MODE_INPUT << (PIN_NUMB));
|
||||
}else{
|
||||
OW->DataPort->MODER &= ~((GPIO_MODER_MODE0_Msk) << 0);
|
||||
OW->DataPort->MODER |= (GPIO_MODE_OUTPUT_PP << 0);
|
||||
OW->DataPort->MODER &= ~((GPIO_MODER_MODE0_Msk) << PIN_NUMB);
|
||||
OW->DataPort->MODER |= (GPIO_MODE_OUTPUT_PP << PIN_NUMB);
|
||||
}
|
||||
#else
|
||||
#ifdef LL_Driver
|
||||
|
||||
Reference in New Issue
Block a user