feat: added PicoW_Sensor code template
Credits to @ext-erich.styger that provided the template
This commit is contained in:
committed by
Sylvan Arnold
parent
b2e9eab44e
commit
6cd510e749
537
TSM_PicoW_Sensor/McuLib/HD44780/DB01.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/DB01.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB01.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB01
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB01_GetDir(void);
|
||||
** SetDir - void DB01_SetDir(bool Dir);
|
||||
** SetInput - void DB01_SetInput(void);
|
||||
** SetOutput - void DB01_SetOutput(void);
|
||||
** GetVal - bool DB01_GetVal(void);
|
||||
** PutVal - void DB01_PutVal(bool Val);
|
||||
** ClrVal - void DB01_ClrVal(void);
|
||||
** SetVal - void DB01_SetVal(void);
|
||||
** NegVal - void DB01_NegVal(void);
|
||||
** Init - void DB01_Init(void);
|
||||
** Deinit - void DB01_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB01.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB01_module DB01 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE DB01. */
|
||||
|
||||
#include "DB01.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB01_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t DB01_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
DB01_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t DB01_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
DB01_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t DB01_OutputConfig[] = {
|
||||
{
|
||||
.pinName = DB01_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = DB01_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t DB01_InputConfig[] = {
|
||||
{
|
||||
.pinName = DB01_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if DB01_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if DB01_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool DB01_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PORT_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(DB01_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(DB01_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PORT_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(DB01_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(DB01_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PORT_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(DB01_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(DB01_CONFIG_PORT_NAME);
|
||||
if (val&(1<<DB01_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(DB01_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB01_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(DB01_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(DB01_CONFIG_PORT_NAME)&(1<<DB01_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(DB01_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB01_GetDir(void)
|
||||
{
|
||||
return DB01_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
DB01_SetOutput();
|
||||
} else {
|
||||
DB01_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, &DB01_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PIN_NUMBER, &DB01_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB01_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB01_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<DB01_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(DB01_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(DB01_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
DB01_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, &DB01_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PIN_NUMBER, &DB01_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB01_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB01_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<DB01_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(DB01_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(DB01_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
DB01_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PORT_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB01_CONFIG_GPIO_NAME, DB01_CONFIG_PORT_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB01_CONFIG_GPIO_NAME, 1<<DB01_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(DB01_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB01_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(DB01_CONFIG_PORT_NAME, DB01_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(DB01_InputConfig, DB01_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = DB01_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if DB01_CONFIG_INIT_PIN_DIRECTION == DB01_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
DB01_SetInput();
|
||||
#elif DB01_CONFIG_INIT_PIN_DIRECTION == DB01_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
DB01_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB01_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END DB01. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/DB01.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/DB01.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB01.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB01
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB01_GetDir(void);
|
||||
** SetDir - void DB01_SetDir(bool Dir);
|
||||
** SetInput - void DB01_SetInput(void);
|
||||
** SetOutput - void DB01_SetOutput(void);
|
||||
** GetVal - bool DB01_GetVal(void);
|
||||
** PutVal - void DB01_PutVal(bool Val);
|
||||
** ClrVal - void DB01_ClrVal(void);
|
||||
** SetVal - void DB01_SetVal(void);
|
||||
** NegVal - void DB01_NegVal(void);
|
||||
** Init - void DB01_Init(void);
|
||||
** Deinit - void DB01_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB01.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB01_module DB01 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __DB01_H
|
||||
#define __DB01_H
|
||||
|
||||
/* MODULE DB01. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "DB01config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define DB01_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum DB01_pinNames{
|
||||
DB01_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(DB01_GPIO_IDX, DB01_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t DB01_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t DB01_InputConfig[];
|
||||
#endif
|
||||
|
||||
void DB01_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB01_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB01_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB01_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB01_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB01_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB01_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB01_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB01_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB01_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB01_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END DB01. */
|
||||
|
||||
#endif
|
||||
/* ifndef __DB01_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/DB01config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/DB01config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __DB01_CONFIG_H
|
||||
#define __DB01_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_DB01_PIN)
|
||||
#define DB01_CONFIG_PIN_NUMBER BOARD_INITPINS_DB01_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB01_GPIO)
|
||||
#define DB01_CONFIG_GPIO_NAME BOARD_INITPINS_DB01_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB01_PORT)
|
||||
#define DB01_CONFIG_PORT_NAME BOARD_INITPINS_DB01_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DB01_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB01_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB01_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define DB01_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef DB01_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB01_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB01_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define DB01_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define DB01_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define DB01_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef DB01_CONFIG_PIN_NUMBER
|
||||
#define DB01_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef DB01_CONFIG_PIN_SYMBOL
|
||||
#define DB01_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef DB01_CONFIG_INIT_PIN_VALUE
|
||||
#define DB01_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define DB01_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define DB01_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define DB01_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef DB01_CONFIG_INIT_PIN_DIRECTION
|
||||
#define DB01_CONFIG_INIT_PIN_DIRECTION DB01_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef DB01_CONFIG_DO_PIN_MUXING
|
||||
#define DB01_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef DB01_CONFIG_PULL_RESISTOR
|
||||
#define DB01_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __DB01_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/DB11.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/DB11.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB11.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB11
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB11_GetDir(void);
|
||||
** SetDir - void DB11_SetDir(bool Dir);
|
||||
** SetInput - void DB11_SetInput(void);
|
||||
** SetOutput - void DB11_SetOutput(void);
|
||||
** GetVal - bool DB11_GetVal(void);
|
||||
** PutVal - void DB11_PutVal(bool Val);
|
||||
** ClrVal - void DB11_ClrVal(void);
|
||||
** SetVal - void DB11_SetVal(void);
|
||||
** NegVal - void DB11_NegVal(void);
|
||||
** Init - void DB11_Init(void);
|
||||
** Deinit - void DB11_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB11.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB11_module DB11 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE DB11. */
|
||||
|
||||
#include "DB11.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB11_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t DB11_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
DB11_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t DB11_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
DB11_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t DB11_OutputConfig[] = {
|
||||
{
|
||||
.pinName = DB11_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = DB11_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t DB11_InputConfig[] = {
|
||||
{
|
||||
.pinName = DB11_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if DB11_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if DB11_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool DB11_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PORT_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(DB11_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(DB11_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PORT_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(DB11_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(DB11_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PORT_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(DB11_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(DB11_CONFIG_PORT_NAME);
|
||||
if (val&(1<<DB11_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(DB11_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB11_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(DB11_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(DB11_CONFIG_PORT_NAME)&(1<<DB11_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(DB11_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB11_GetDir(void)
|
||||
{
|
||||
return DB11_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
DB11_SetOutput();
|
||||
} else {
|
||||
DB11_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, &DB11_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PIN_NUMBER, &DB11_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB11_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB11_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<DB11_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(DB11_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(DB11_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
DB11_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, &DB11_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PIN_NUMBER, &DB11_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB11_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB11_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<DB11_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(DB11_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(DB11_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
DB11_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PORT_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB11_CONFIG_GPIO_NAME, DB11_CONFIG_PORT_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB11_CONFIG_GPIO_NAME, 1<<DB11_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(DB11_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB11_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(DB11_CONFIG_PORT_NAME, DB11_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(DB11_InputConfig, DB11_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = DB11_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if DB11_CONFIG_INIT_PIN_DIRECTION == DB11_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
DB11_SetInput();
|
||||
#elif DB11_CONFIG_INIT_PIN_DIRECTION == DB11_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
DB11_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB11_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END DB11. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/DB11.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/DB11.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB11.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB11
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB11_GetDir(void);
|
||||
** SetDir - void DB11_SetDir(bool Dir);
|
||||
** SetInput - void DB11_SetInput(void);
|
||||
** SetOutput - void DB11_SetOutput(void);
|
||||
** GetVal - bool DB11_GetVal(void);
|
||||
** PutVal - void DB11_PutVal(bool Val);
|
||||
** ClrVal - void DB11_ClrVal(void);
|
||||
** SetVal - void DB11_SetVal(void);
|
||||
** NegVal - void DB11_NegVal(void);
|
||||
** Init - void DB11_Init(void);
|
||||
** Deinit - void DB11_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB11.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB11_module DB11 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __DB11_H
|
||||
#define __DB11_H
|
||||
|
||||
/* MODULE DB11. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "DB11config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define DB11_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum DB11_pinNames{
|
||||
DB11_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(DB11_GPIO_IDX, DB11_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t DB11_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t DB11_InputConfig[];
|
||||
#endif
|
||||
|
||||
void DB11_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB11_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB11_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB11_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB11_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB11_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB11_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB11_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB11_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB11_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB11_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END DB11. */
|
||||
|
||||
#endif
|
||||
/* ifndef __DB11_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/DB11config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/DB11config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __DB11_CONFIG_H
|
||||
#define __DB11_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_DB11_PIN)
|
||||
#define DB11_CONFIG_PIN_NUMBER BOARD_INITPINS_DB11_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB11_GPIO)
|
||||
#define DB11_CONFIG_GPIO_NAME BOARD_INITPINS_DB11_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB11_PORT)
|
||||
#define DB11_CONFIG_PORT_NAME BOARD_INITPINS_DB11_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DB11_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB11_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB11_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define DB11_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef DB11_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB11_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB11_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define DB11_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define DB11_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define DB11_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef DB11_CONFIG_PIN_NUMBER
|
||||
#define DB11_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef DB11_CONFIG_PIN_SYMBOL
|
||||
#define DB11_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef DB11_CONFIG_INIT_PIN_VALUE
|
||||
#define DB11_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define DB11_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define DB11_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define DB11_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef DB11_CONFIG_INIT_PIN_DIRECTION
|
||||
#define DB11_CONFIG_INIT_PIN_DIRECTION DB11_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef DB11_CONFIG_DO_PIN_MUXING
|
||||
#define DB11_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef DB11_CONFIG_PULL_RESISTOR
|
||||
#define DB11_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __DB11_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/DB21.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/DB21.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB21.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB21
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB21_GetDir(void);
|
||||
** SetDir - void DB21_SetDir(bool Dir);
|
||||
** SetInput - void DB21_SetInput(void);
|
||||
** SetOutput - void DB21_SetOutput(void);
|
||||
** GetVal - bool DB21_GetVal(void);
|
||||
** PutVal - void DB21_PutVal(bool Val);
|
||||
** ClrVal - void DB21_ClrVal(void);
|
||||
** SetVal - void DB21_SetVal(void);
|
||||
** NegVal - void DB21_NegVal(void);
|
||||
** Init - void DB21_Init(void);
|
||||
** Deinit - void DB21_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB21.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB21_module DB21 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE DB21. */
|
||||
|
||||
#include "DB21.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB21_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t DB21_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
DB21_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t DB21_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
DB21_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t DB21_OutputConfig[] = {
|
||||
{
|
||||
.pinName = DB21_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = DB21_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t DB21_InputConfig[] = {
|
||||
{
|
||||
.pinName = DB21_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if DB21_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if DB21_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool DB21_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PORT_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(DB21_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(DB21_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PORT_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(DB21_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(DB21_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PORT_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(DB21_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(DB21_CONFIG_PORT_NAME);
|
||||
if (val&(1<<DB21_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(DB21_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB21_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(DB21_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(DB21_CONFIG_PORT_NAME)&(1<<DB21_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(DB21_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB21_GetDir(void)
|
||||
{
|
||||
return DB21_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
DB21_SetOutput();
|
||||
} else {
|
||||
DB21_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, &DB21_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PIN_NUMBER, &DB21_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB21_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB21_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<DB21_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(DB21_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(DB21_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
DB21_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, &DB21_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PIN_NUMBER, &DB21_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB21_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB21_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<DB21_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(DB21_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(DB21_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
DB21_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PORT_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB21_CONFIG_GPIO_NAME, DB21_CONFIG_PORT_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB21_CONFIG_GPIO_NAME, 1<<DB21_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(DB21_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB21_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(DB21_CONFIG_PORT_NAME, DB21_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(DB21_InputConfig, DB21_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = DB21_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if DB21_CONFIG_INIT_PIN_DIRECTION == DB21_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
DB21_SetInput();
|
||||
#elif DB21_CONFIG_INIT_PIN_DIRECTION == DB21_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
DB21_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB21_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END DB21. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/DB21.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/DB21.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB21.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB21
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB21_GetDir(void);
|
||||
** SetDir - void DB21_SetDir(bool Dir);
|
||||
** SetInput - void DB21_SetInput(void);
|
||||
** SetOutput - void DB21_SetOutput(void);
|
||||
** GetVal - bool DB21_GetVal(void);
|
||||
** PutVal - void DB21_PutVal(bool Val);
|
||||
** ClrVal - void DB21_ClrVal(void);
|
||||
** SetVal - void DB21_SetVal(void);
|
||||
** NegVal - void DB21_NegVal(void);
|
||||
** Init - void DB21_Init(void);
|
||||
** Deinit - void DB21_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB21.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB21_module DB21 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __DB21_H
|
||||
#define __DB21_H
|
||||
|
||||
/* MODULE DB21. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "DB21config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define DB21_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum DB21_pinNames{
|
||||
DB21_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(DB21_GPIO_IDX, DB21_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t DB21_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t DB21_InputConfig[];
|
||||
#endif
|
||||
|
||||
void DB21_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB21_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB21_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB21_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB21_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB21_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB21_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB21_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB21_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB21_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB21_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END DB21. */
|
||||
|
||||
#endif
|
||||
/* ifndef __DB21_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/DB21config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/DB21config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __DB21_CONFIG_H
|
||||
#define __DB21_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_DB21_PIN)
|
||||
#define DB21_CONFIG_PIN_NUMBER BOARD_INITPINS_DB21_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB21_GPIO)
|
||||
#define DB21_CONFIG_GPIO_NAME BOARD_INITPINS_DB21_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB21_PORT)
|
||||
#define DB21_CONFIG_PORT_NAME BOARD_INITPINS_DB21_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DB21_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB21_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB21_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define DB21_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef DB21_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB21_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB21_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define DB21_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define DB21_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define DB21_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef DB21_CONFIG_PIN_NUMBER
|
||||
#define DB21_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef DB21_CONFIG_PIN_SYMBOL
|
||||
#define DB21_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef DB21_CONFIG_INIT_PIN_VALUE
|
||||
#define DB21_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define DB21_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define DB21_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define DB21_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef DB21_CONFIG_INIT_PIN_DIRECTION
|
||||
#define DB21_CONFIG_INIT_PIN_DIRECTION DB21_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef DB21_CONFIG_DO_PIN_MUXING
|
||||
#define DB21_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef DB21_CONFIG_PULL_RESISTOR
|
||||
#define DB21_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __DB21_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/DB31.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/DB31.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB31.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB31
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB31_GetDir(void);
|
||||
** SetDir - void DB31_SetDir(bool Dir);
|
||||
** SetInput - void DB31_SetInput(void);
|
||||
** SetOutput - void DB31_SetOutput(void);
|
||||
** GetVal - bool DB31_GetVal(void);
|
||||
** PutVal - void DB31_PutVal(bool Val);
|
||||
** ClrVal - void DB31_ClrVal(void);
|
||||
** SetVal - void DB31_SetVal(void);
|
||||
** NegVal - void DB31_NegVal(void);
|
||||
** Init - void DB31_Init(void);
|
||||
** Deinit - void DB31_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB31.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB31_module DB31 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE DB31. */
|
||||
|
||||
#include "DB31.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB31_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t DB31_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
DB31_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t DB31_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
DB31_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t DB31_OutputConfig[] = {
|
||||
{
|
||||
.pinName = DB31_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = DB31_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t DB31_InputConfig[] = {
|
||||
{
|
||||
.pinName = DB31_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if DB31_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if DB31_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool DB31_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PORT_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(DB31_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(DB31_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PORT_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(DB31_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(DB31_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PORT_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(DB31_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(DB31_CONFIG_PORT_NAME);
|
||||
if (val&(1<<DB31_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(DB31_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB31_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(DB31_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(DB31_CONFIG_PORT_NAME)&(1<<DB31_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(DB31_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB31_GetDir(void)
|
||||
{
|
||||
return DB31_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
DB31_SetOutput();
|
||||
} else {
|
||||
DB31_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, &DB31_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PIN_NUMBER, &DB31_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB31_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB31_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<DB31_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(DB31_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(DB31_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
DB31_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, &DB31_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PIN_NUMBER, &DB31_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB31_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB31_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<DB31_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(DB31_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(DB31_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
DB31_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PORT_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB31_CONFIG_GPIO_NAME, DB31_CONFIG_PORT_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB31_CONFIG_GPIO_NAME, 1<<DB31_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(DB31_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB31_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(DB31_CONFIG_PORT_NAME, DB31_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(DB31_InputConfig, DB31_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = DB31_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if DB31_CONFIG_INIT_PIN_DIRECTION == DB31_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
DB31_SetInput();
|
||||
#elif DB31_CONFIG_INIT_PIN_DIRECTION == DB31_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
DB31_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB31_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END DB31. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/DB31.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/DB31.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB31.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB31
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB31_GetDir(void);
|
||||
** SetDir - void DB31_SetDir(bool Dir);
|
||||
** SetInput - void DB31_SetInput(void);
|
||||
** SetOutput - void DB31_SetOutput(void);
|
||||
** GetVal - bool DB31_GetVal(void);
|
||||
** PutVal - void DB31_PutVal(bool Val);
|
||||
** ClrVal - void DB31_ClrVal(void);
|
||||
** SetVal - void DB31_SetVal(void);
|
||||
** NegVal - void DB31_NegVal(void);
|
||||
** Init - void DB31_Init(void);
|
||||
** Deinit - void DB31_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB31.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB31_module DB31 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __DB31_H
|
||||
#define __DB31_H
|
||||
|
||||
/* MODULE DB31. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "DB31config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define DB31_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum DB31_pinNames{
|
||||
DB31_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(DB31_GPIO_IDX, DB31_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t DB31_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t DB31_InputConfig[];
|
||||
#endif
|
||||
|
||||
void DB31_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB31_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB31_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB31_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB31_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB31_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB31_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB31_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB31_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB31_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB31_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END DB31. */
|
||||
|
||||
#endif
|
||||
/* ifndef __DB31_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/DB31config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/DB31config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __DB31_CONFIG_H
|
||||
#define __DB31_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_DB31_PIN)
|
||||
#define DB31_CONFIG_PIN_NUMBER BOARD_INITPINS_DB31_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB31_GPIO)
|
||||
#define DB31_CONFIG_GPIO_NAME BOARD_INITPINS_DB31_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB31_PORT)
|
||||
#define DB31_CONFIG_PORT_NAME BOARD_INITPINS_DB31_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DB31_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB31_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB31_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define DB31_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef DB31_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB31_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB31_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define DB31_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define DB31_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define DB31_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef DB31_CONFIG_PIN_NUMBER
|
||||
#define DB31_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef DB31_CONFIG_PIN_SYMBOL
|
||||
#define DB31_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef DB31_CONFIG_INIT_PIN_VALUE
|
||||
#define DB31_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define DB31_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define DB31_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define DB31_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef DB31_CONFIG_INIT_PIN_DIRECTION
|
||||
#define DB31_CONFIG_INIT_PIN_DIRECTION DB31_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef DB31_CONFIG_DO_PIN_MUXING
|
||||
#define DB31_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef DB31_CONFIG_PULL_RESISTOR
|
||||
#define DB31_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __DB31_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/DB41.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/DB41.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB41.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB41
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB41_GetDir(void);
|
||||
** SetDir - void DB41_SetDir(bool Dir);
|
||||
** SetInput - void DB41_SetInput(void);
|
||||
** SetOutput - void DB41_SetOutput(void);
|
||||
** GetVal - bool DB41_GetVal(void);
|
||||
** PutVal - void DB41_PutVal(bool Val);
|
||||
** ClrVal - void DB41_ClrVal(void);
|
||||
** SetVal - void DB41_SetVal(void);
|
||||
** NegVal - void DB41_NegVal(void);
|
||||
** Init - void DB41_Init(void);
|
||||
** Deinit - void DB41_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB41.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB41_module DB41 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE DB41. */
|
||||
|
||||
#include "DB41.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB41_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t DB41_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
DB41_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t DB41_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
DB41_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t DB41_OutputConfig[] = {
|
||||
{
|
||||
.pinName = DB41_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = DB41_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t DB41_InputConfig[] = {
|
||||
{
|
||||
.pinName = DB41_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if DB41_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if DB41_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool DB41_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PORT_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(DB41_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(DB41_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PORT_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(DB41_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(DB41_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PORT_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(DB41_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(DB41_CONFIG_PORT_NAME);
|
||||
if (val&(1<<DB41_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(DB41_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB41_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(DB41_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(DB41_CONFIG_PORT_NAME)&(1<<DB41_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(DB41_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB41_GetDir(void)
|
||||
{
|
||||
return DB41_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
DB41_SetOutput();
|
||||
} else {
|
||||
DB41_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, &DB41_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PIN_NUMBER, &DB41_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB41_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB41_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<DB41_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(DB41_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(DB41_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
DB41_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, &DB41_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PIN_NUMBER, &DB41_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB41_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB41_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<DB41_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(DB41_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(DB41_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
DB41_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PORT_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB41_CONFIG_GPIO_NAME, DB41_CONFIG_PORT_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB41_CONFIG_GPIO_NAME, 1<<DB41_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(DB41_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB41_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(DB41_CONFIG_PORT_NAME, DB41_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(DB41_InputConfig, DB41_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = DB41_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if DB41_CONFIG_INIT_PIN_DIRECTION == DB41_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
DB41_SetInput();
|
||||
#elif DB41_CONFIG_INIT_PIN_DIRECTION == DB41_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
DB41_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB41_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END DB41. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/DB41.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/DB41.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB41.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB41
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB41_GetDir(void);
|
||||
** SetDir - void DB41_SetDir(bool Dir);
|
||||
** SetInput - void DB41_SetInput(void);
|
||||
** SetOutput - void DB41_SetOutput(void);
|
||||
** GetVal - bool DB41_GetVal(void);
|
||||
** PutVal - void DB41_PutVal(bool Val);
|
||||
** ClrVal - void DB41_ClrVal(void);
|
||||
** SetVal - void DB41_SetVal(void);
|
||||
** NegVal - void DB41_NegVal(void);
|
||||
** Init - void DB41_Init(void);
|
||||
** Deinit - void DB41_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB41.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB41_module DB41 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __DB41_H
|
||||
#define __DB41_H
|
||||
|
||||
/* MODULE DB41. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "DB41config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define DB41_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum DB41_pinNames{
|
||||
DB41_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(DB41_GPIO_IDX, DB41_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t DB41_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t DB41_InputConfig[];
|
||||
#endif
|
||||
|
||||
void DB41_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB41_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB41_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB41_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB41_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB41_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB41_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB41_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB41_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB41_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB41_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END DB41. */
|
||||
|
||||
#endif
|
||||
/* ifndef __DB41_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/DB41config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/DB41config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __DB41_CONFIG_H
|
||||
#define __DB41_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_DB41_PIN)
|
||||
#define DB41_CONFIG_PIN_NUMBER BOARD_INITPINS_DB41_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB41_GPIO)
|
||||
#define DB41_CONFIG_GPIO_NAME BOARD_INITPINS_DB41_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB41_PORT)
|
||||
#define DB41_CONFIG_PORT_NAME BOARD_INITPINS_DB41_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DB41_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB41_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB41_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define DB41_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef DB41_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB41_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB41_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define DB41_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define DB41_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define DB41_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef DB41_CONFIG_PIN_NUMBER
|
||||
#define DB41_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef DB41_CONFIG_PIN_SYMBOL
|
||||
#define DB41_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef DB41_CONFIG_INIT_PIN_VALUE
|
||||
#define DB41_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define DB41_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define DB41_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define DB41_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef DB41_CONFIG_INIT_PIN_DIRECTION
|
||||
#define DB41_CONFIG_INIT_PIN_DIRECTION DB41_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef DB41_CONFIG_DO_PIN_MUXING
|
||||
#define DB41_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef DB41_CONFIG_PULL_RESISTOR
|
||||
#define DB41_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __DB41_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/DB51.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/DB51.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB51.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB51
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB51_GetDir(void);
|
||||
** SetDir - void DB51_SetDir(bool Dir);
|
||||
** SetInput - void DB51_SetInput(void);
|
||||
** SetOutput - void DB51_SetOutput(void);
|
||||
** GetVal - bool DB51_GetVal(void);
|
||||
** PutVal - void DB51_PutVal(bool Val);
|
||||
** ClrVal - void DB51_ClrVal(void);
|
||||
** SetVal - void DB51_SetVal(void);
|
||||
** NegVal - void DB51_NegVal(void);
|
||||
** Init - void DB51_Init(void);
|
||||
** Deinit - void DB51_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB51.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB51_module DB51 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE DB51. */
|
||||
|
||||
#include "DB51.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB51_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t DB51_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
DB51_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t DB51_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
DB51_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t DB51_OutputConfig[] = {
|
||||
{
|
||||
.pinName = DB51_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = DB51_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t DB51_InputConfig[] = {
|
||||
{
|
||||
.pinName = DB51_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if DB51_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if DB51_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool DB51_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PORT_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(DB51_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(DB51_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PORT_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(DB51_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(DB51_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PORT_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(DB51_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(DB51_CONFIG_PORT_NAME);
|
||||
if (val&(1<<DB51_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(DB51_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB51_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(DB51_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(DB51_CONFIG_PORT_NAME)&(1<<DB51_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(DB51_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB51_GetDir(void)
|
||||
{
|
||||
return DB51_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
DB51_SetOutput();
|
||||
} else {
|
||||
DB51_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, &DB51_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PIN_NUMBER, &DB51_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB51_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB51_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<DB51_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(DB51_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(DB51_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
DB51_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, &DB51_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PIN_NUMBER, &DB51_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB51_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB51_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<DB51_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(DB51_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(DB51_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
DB51_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PORT_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB51_CONFIG_GPIO_NAME, DB51_CONFIG_PORT_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB51_CONFIG_GPIO_NAME, 1<<DB51_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(DB51_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB51_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(DB51_CONFIG_PORT_NAME, DB51_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(DB51_InputConfig, DB51_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = DB51_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if DB51_CONFIG_INIT_PIN_DIRECTION == DB51_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
DB51_SetInput();
|
||||
#elif DB51_CONFIG_INIT_PIN_DIRECTION == DB51_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
DB51_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB51_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END DB51. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/DB51.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/DB51.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB51.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB51
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB51_GetDir(void);
|
||||
** SetDir - void DB51_SetDir(bool Dir);
|
||||
** SetInput - void DB51_SetInput(void);
|
||||
** SetOutput - void DB51_SetOutput(void);
|
||||
** GetVal - bool DB51_GetVal(void);
|
||||
** PutVal - void DB51_PutVal(bool Val);
|
||||
** ClrVal - void DB51_ClrVal(void);
|
||||
** SetVal - void DB51_SetVal(void);
|
||||
** NegVal - void DB51_NegVal(void);
|
||||
** Init - void DB51_Init(void);
|
||||
** Deinit - void DB51_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB51.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB51_module DB51 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __DB51_H
|
||||
#define __DB51_H
|
||||
|
||||
/* MODULE DB51. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "DB51config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define DB51_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum DB51_pinNames{
|
||||
DB51_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(DB51_GPIO_IDX, DB51_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t DB51_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t DB51_InputConfig[];
|
||||
#endif
|
||||
|
||||
void DB51_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB51_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB51_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB51_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB51_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB51_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB51_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB51_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB51_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB51_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB51_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END DB51. */
|
||||
|
||||
#endif
|
||||
/* ifndef __DB51_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/DB51config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/DB51config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __DB51_CONFIG_H
|
||||
#define __DB51_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_DB51_PIN)
|
||||
#define DB51_CONFIG_PIN_NUMBER BOARD_INITPINS_DB51_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB51_GPIO)
|
||||
#define DB51_CONFIG_GPIO_NAME BOARD_INITPINS_DB51_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB51_PORT)
|
||||
#define DB51_CONFIG_PORT_NAME BOARD_INITPINS_DB51_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DB51_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB51_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB51_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define DB51_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef DB51_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB51_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB51_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define DB51_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define DB51_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define DB51_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef DB51_CONFIG_PIN_NUMBER
|
||||
#define DB51_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef DB51_CONFIG_PIN_SYMBOL
|
||||
#define DB51_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef DB51_CONFIG_INIT_PIN_VALUE
|
||||
#define DB51_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define DB51_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define DB51_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define DB51_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef DB51_CONFIG_INIT_PIN_DIRECTION
|
||||
#define DB51_CONFIG_INIT_PIN_DIRECTION DB51_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef DB51_CONFIG_DO_PIN_MUXING
|
||||
#define DB51_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef DB51_CONFIG_PULL_RESISTOR
|
||||
#define DB51_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __DB51_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/DB61.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/DB61.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB61.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB61
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB61_GetDir(void);
|
||||
** SetDir - void DB61_SetDir(bool Dir);
|
||||
** SetInput - void DB61_SetInput(void);
|
||||
** SetOutput - void DB61_SetOutput(void);
|
||||
** GetVal - bool DB61_GetVal(void);
|
||||
** PutVal - void DB61_PutVal(bool Val);
|
||||
** ClrVal - void DB61_ClrVal(void);
|
||||
** SetVal - void DB61_SetVal(void);
|
||||
** NegVal - void DB61_NegVal(void);
|
||||
** Init - void DB61_Init(void);
|
||||
** Deinit - void DB61_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB61.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB61_module DB61 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE DB61. */
|
||||
|
||||
#include "DB61.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB61_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t DB61_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
DB61_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t DB61_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
DB61_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t DB61_OutputConfig[] = {
|
||||
{
|
||||
.pinName = DB61_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = DB61_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t DB61_InputConfig[] = {
|
||||
{
|
||||
.pinName = DB61_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if DB61_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if DB61_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool DB61_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PORT_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(DB61_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(DB61_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PORT_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(DB61_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(DB61_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PORT_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(DB61_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(DB61_CONFIG_PORT_NAME);
|
||||
if (val&(1<<DB61_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(DB61_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB61_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(DB61_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(DB61_CONFIG_PORT_NAME)&(1<<DB61_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(DB61_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB61_GetDir(void)
|
||||
{
|
||||
return DB61_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
DB61_SetOutput();
|
||||
} else {
|
||||
DB61_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, &DB61_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PIN_NUMBER, &DB61_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB61_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB61_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<DB61_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(DB61_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(DB61_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
DB61_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, &DB61_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PIN_NUMBER, &DB61_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB61_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB61_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<DB61_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(DB61_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(DB61_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
DB61_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PORT_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB61_CONFIG_GPIO_NAME, DB61_CONFIG_PORT_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB61_CONFIG_GPIO_NAME, 1<<DB61_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(DB61_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB61_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(DB61_CONFIG_PORT_NAME, DB61_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(DB61_InputConfig, DB61_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = DB61_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if DB61_CONFIG_INIT_PIN_DIRECTION == DB61_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
DB61_SetInput();
|
||||
#elif DB61_CONFIG_INIT_PIN_DIRECTION == DB61_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
DB61_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB61_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END DB61. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/DB61.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/DB61.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB61.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB61
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB61_GetDir(void);
|
||||
** SetDir - void DB61_SetDir(bool Dir);
|
||||
** SetInput - void DB61_SetInput(void);
|
||||
** SetOutput - void DB61_SetOutput(void);
|
||||
** GetVal - bool DB61_GetVal(void);
|
||||
** PutVal - void DB61_PutVal(bool Val);
|
||||
** ClrVal - void DB61_ClrVal(void);
|
||||
** SetVal - void DB61_SetVal(void);
|
||||
** NegVal - void DB61_NegVal(void);
|
||||
** Init - void DB61_Init(void);
|
||||
** Deinit - void DB61_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB61.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB61_module DB61 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __DB61_H
|
||||
#define __DB61_H
|
||||
|
||||
/* MODULE DB61. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "DB61config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define DB61_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum DB61_pinNames{
|
||||
DB61_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(DB61_GPIO_IDX, DB61_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t DB61_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t DB61_InputConfig[];
|
||||
#endif
|
||||
|
||||
void DB61_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB61_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB61_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB61_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB61_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB61_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB61_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB61_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB61_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB61_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB61_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END DB61. */
|
||||
|
||||
#endif
|
||||
/* ifndef __DB61_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/DB61config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/DB61config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __DB61_CONFIG_H
|
||||
#define __DB61_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_DB61_PIN)
|
||||
#define DB61_CONFIG_PIN_NUMBER BOARD_INITPINS_DB61_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB61_GPIO)
|
||||
#define DB61_CONFIG_GPIO_NAME BOARD_INITPINS_DB61_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB61_PORT)
|
||||
#define DB61_CONFIG_PORT_NAME BOARD_INITPINS_DB61_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DB61_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB61_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB61_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define DB61_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef DB61_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB61_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB61_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define DB61_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define DB61_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define DB61_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef DB61_CONFIG_PIN_NUMBER
|
||||
#define DB61_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef DB61_CONFIG_PIN_SYMBOL
|
||||
#define DB61_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef DB61_CONFIG_INIT_PIN_VALUE
|
||||
#define DB61_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define DB61_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define DB61_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define DB61_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef DB61_CONFIG_INIT_PIN_DIRECTION
|
||||
#define DB61_CONFIG_INIT_PIN_DIRECTION DB61_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef DB61_CONFIG_DO_PIN_MUXING
|
||||
#define DB61_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef DB61_CONFIG_PULL_RESISTOR
|
||||
#define DB61_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __DB61_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/DB71.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/DB71.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB71.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB71
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB71_GetDir(void);
|
||||
** SetDir - void DB71_SetDir(bool Dir);
|
||||
** SetInput - void DB71_SetInput(void);
|
||||
** SetOutput - void DB71_SetOutput(void);
|
||||
** GetVal - bool DB71_GetVal(void);
|
||||
** PutVal - void DB71_PutVal(bool Val);
|
||||
** ClrVal - void DB71_ClrVal(void);
|
||||
** SetVal - void DB71_SetVal(void);
|
||||
** NegVal - void DB71_NegVal(void);
|
||||
** Init - void DB71_Init(void);
|
||||
** Deinit - void DB71_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB71.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB71_module DB71 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE DB71. */
|
||||
|
||||
#include "DB71.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB71_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t DB71_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
DB71_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t DB71_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
DB71_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t DB71_OutputConfig[] = {
|
||||
{
|
||||
.pinName = DB71_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = DB71_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t DB71_InputConfig[] = {
|
||||
{
|
||||
.pinName = DB71_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if DB71_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if DB71_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool DB71_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PORT_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(DB71_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(DB71_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PORT_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(DB71_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(DB71_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PORT_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(DB71_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(DB71_CONFIG_PORT_NAME);
|
||||
if (val&(1<<DB71_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(DB71_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB71_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(DB71_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(DB71_CONFIG_PORT_NAME)&(1<<DB71_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(DB71_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool DB71_GetDir(void)
|
||||
{
|
||||
return DB71_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
DB71_SetOutput();
|
||||
} else {
|
||||
DB71_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, &DB71_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PIN_NUMBER, &DB71_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB71_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB71_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<DB71_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(DB71_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(DB71_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
DB71_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, &DB71_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PIN_NUMBER, &DB71_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(DB71_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(DB71_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<DB71_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(DB71_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(DB71_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
DB71_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PORT_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB71_CONFIG_GPIO_NAME, DB71_CONFIG_PORT_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(DB71_CONFIG_GPIO_NAME, 1<<DB71_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(DB71_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if DB71_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(DB71_CONFIG_PORT_NAME, DB71_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(DB71_InputConfig, DB71_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = DB71_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if DB71_CONFIG_INIT_PIN_DIRECTION == DB71_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
DB71_SetInput();
|
||||
#elif DB71_CONFIG_INIT_PIN_DIRECTION == DB71_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
DB71_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void DB71_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END DB71. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/DB71.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/DB71.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : DB71.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : DB71
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool DB71_GetDir(void);
|
||||
** SetDir - void DB71_SetDir(bool Dir);
|
||||
** SetInput - void DB71_SetInput(void);
|
||||
** SetOutput - void DB71_SetOutput(void);
|
||||
** GetVal - bool DB71_GetVal(void);
|
||||
** PutVal - void DB71_PutVal(bool Val);
|
||||
** ClrVal - void DB71_ClrVal(void);
|
||||
** SetVal - void DB71_SetVal(void);
|
||||
** NegVal - void DB71_NegVal(void);
|
||||
** Init - void DB71_Init(void);
|
||||
** Deinit - void DB71_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file DB71.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup DB71_module DB71 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __DB71_H
|
||||
#define __DB71_H
|
||||
|
||||
/* MODULE DB71. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "DB71config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define DB71_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum DB71_pinNames{
|
||||
DB71_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(DB71_GPIO_IDX, DB71_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t DB71_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t DB71_InputConfig[];
|
||||
#endif
|
||||
|
||||
void DB71_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB71_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB71_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB71_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB71_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB71_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool DB71_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB71_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB71_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB71_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void DB71_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END DB71. */
|
||||
|
||||
#endif
|
||||
/* ifndef __DB71_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/DB71config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/DB71config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __DB71_CONFIG_H
|
||||
#define __DB71_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_DB71_PIN)
|
||||
#define DB71_CONFIG_PIN_NUMBER BOARD_INITPINS_DB71_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB71_GPIO)
|
||||
#define DB71_CONFIG_GPIO_NAME BOARD_INITPINS_DB71_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_DB71_PORT)
|
||||
#define DB71_CONFIG_PORT_NAME BOARD_INITPINS_DB71_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DB71_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB71_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB71_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define DB71_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef DB71_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define DB71_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define DB71_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define DB71_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define DB71_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define DB71_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef DB71_CONFIG_PIN_NUMBER
|
||||
#define DB71_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef DB71_CONFIG_PIN_SYMBOL
|
||||
#define DB71_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef DB71_CONFIG_INIT_PIN_VALUE
|
||||
#define DB71_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define DB71_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define DB71_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define DB71_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef DB71_CONFIG_INIT_PIN_DIRECTION
|
||||
#define DB71_CONFIG_INIT_PIN_DIRECTION DB71_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef DB71_CONFIG_DO_PIN_MUXING
|
||||
#define DB71_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef DB71_CONFIG_PULL_RESISTOR
|
||||
#define DB71_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __DB71_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/EN1.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/EN1.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : EN1.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : EN1
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool EN1_GetDir(void);
|
||||
** SetDir - void EN1_SetDir(bool Dir);
|
||||
** SetInput - void EN1_SetInput(void);
|
||||
** SetOutput - void EN1_SetOutput(void);
|
||||
** GetVal - bool EN1_GetVal(void);
|
||||
** PutVal - void EN1_PutVal(bool Val);
|
||||
** ClrVal - void EN1_ClrVal(void);
|
||||
** SetVal - void EN1_SetVal(void);
|
||||
** NegVal - void EN1_NegVal(void);
|
||||
** Init - void EN1_Init(void);
|
||||
** Deinit - void EN1_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file EN1.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup EN1_module EN1 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE EN1. */
|
||||
|
||||
#include "EN1.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if EN1_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t EN1_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
EN1_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t EN1_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
EN1_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t EN1_OutputConfig[] = {
|
||||
{
|
||||
.pinName = EN1_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = EN1_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t EN1_InputConfig[] = {
|
||||
{
|
||||
.pinName = EN1_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if EN1_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if EN1_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool EN1_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PORT_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(EN1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(EN1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PORT_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(EN1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(EN1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PORT_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(EN1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(EN1_CONFIG_PORT_NAME);
|
||||
if (val&(1<<EN1_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(EN1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool EN1_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(EN1_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(EN1_CONFIG_PORT_NAME)&(1<<EN1_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(EN1_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool EN1_GetDir(void)
|
||||
{
|
||||
return EN1_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
EN1_SetOutput();
|
||||
} else {
|
||||
EN1_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, &EN1_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PIN_NUMBER, &EN1_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(EN1_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(EN1_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<EN1_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(EN1_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(EN1_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
EN1_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, &EN1_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PIN_NUMBER, &EN1_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(EN1_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(EN1_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<EN1_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(EN1_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(EN1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
EN1_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PORT_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(EN1_CONFIG_GPIO_NAME, EN1_CONFIG_PORT_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(EN1_CONFIG_GPIO_NAME, 1<<EN1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(EN1_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if EN1_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(EN1_CONFIG_PORT_NAME, EN1_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(EN1_InputConfig, EN1_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = EN1_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if EN1_CONFIG_INIT_PIN_DIRECTION == EN1_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
EN1_SetInput();
|
||||
#elif EN1_CONFIG_INIT_PIN_DIRECTION == EN1_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
EN1_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN1_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END EN1. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/EN1.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/EN1.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : EN1.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : EN1
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool EN1_GetDir(void);
|
||||
** SetDir - void EN1_SetDir(bool Dir);
|
||||
** SetInput - void EN1_SetInput(void);
|
||||
** SetOutput - void EN1_SetOutput(void);
|
||||
** GetVal - bool EN1_GetVal(void);
|
||||
** PutVal - void EN1_PutVal(bool Val);
|
||||
** ClrVal - void EN1_ClrVal(void);
|
||||
** SetVal - void EN1_SetVal(void);
|
||||
** NegVal - void EN1_NegVal(void);
|
||||
** Init - void EN1_Init(void);
|
||||
** Deinit - void EN1_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file EN1.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup EN1_module EN1 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __EN1_H
|
||||
#define __EN1_H
|
||||
|
||||
/* MODULE EN1. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "EN1config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define EN1_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum EN1_pinNames{
|
||||
EN1_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(EN1_GPIO_IDX, EN1_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t EN1_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t EN1_InputConfig[];
|
||||
#endif
|
||||
|
||||
void EN1_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN1_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN1_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN1_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN1_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool EN1_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool EN1_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN1_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN1_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN1_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN1_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END EN1. */
|
||||
|
||||
#endif
|
||||
/* ifndef __EN1_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/EN1config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/EN1config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __EN1_CONFIG_H
|
||||
#define __EN1_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_EN1_PIN)
|
||||
#define EN1_CONFIG_PIN_NUMBER BOARD_INITPINS_EN1_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_EN1_GPIO)
|
||||
#define EN1_CONFIG_GPIO_NAME BOARD_INITPINS_EN1_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_EN1_PORT)
|
||||
#define EN1_CONFIG_PORT_NAME BOARD_INITPINS_EN1_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EN1_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define EN1_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define EN1_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define EN1_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef EN1_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define EN1_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define EN1_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define EN1_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define EN1_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define EN1_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef EN1_CONFIG_PIN_NUMBER
|
||||
#define EN1_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef EN1_CONFIG_PIN_SYMBOL
|
||||
#define EN1_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef EN1_CONFIG_INIT_PIN_VALUE
|
||||
#define EN1_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define EN1_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define EN1_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define EN1_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef EN1_CONFIG_INIT_PIN_DIRECTION
|
||||
#define EN1_CONFIG_INIT_PIN_DIRECTION EN1_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef EN1_CONFIG_DO_PIN_MUXING
|
||||
#define EN1_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef EN1_CONFIG_PULL_RESISTOR
|
||||
#define EN1_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __EN1_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/EN2.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/EN2.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : EN2.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : EN2
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool EN2_GetDir(void);
|
||||
** SetDir - void EN2_SetDir(bool Dir);
|
||||
** SetInput - void EN2_SetInput(void);
|
||||
** SetOutput - void EN2_SetOutput(void);
|
||||
** GetVal - bool EN2_GetVal(void);
|
||||
** PutVal - void EN2_PutVal(bool Val);
|
||||
** ClrVal - void EN2_ClrVal(void);
|
||||
** SetVal - void EN2_SetVal(void);
|
||||
** NegVal - void EN2_NegVal(void);
|
||||
** Init - void EN2_Init(void);
|
||||
** Deinit - void EN2_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file EN2.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup EN2_module EN2 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE EN2. */
|
||||
|
||||
#include "EN2.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if EN2_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t EN2_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
EN2_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t EN2_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
EN2_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t EN2_OutputConfig[] = {
|
||||
{
|
||||
.pinName = EN2_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = EN2_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t EN2_InputConfig[] = {
|
||||
{
|
||||
.pinName = EN2_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if EN2_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if EN2_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool EN2_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PORT_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(EN2_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(EN2_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PORT_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(EN2_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(EN2_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PORT_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(EN2_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(EN2_CONFIG_PORT_NAME);
|
||||
if (val&(1<<EN2_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(EN2_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool EN2_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(EN2_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(EN2_CONFIG_PORT_NAME)&(1<<EN2_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(EN2_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool EN2_GetDir(void)
|
||||
{
|
||||
return EN2_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
EN2_SetOutput();
|
||||
} else {
|
||||
EN2_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, &EN2_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PIN_NUMBER, &EN2_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(EN2_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(EN2_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<EN2_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(EN2_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(EN2_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
EN2_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, &EN2_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PIN_NUMBER, &EN2_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(EN2_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(EN2_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<EN2_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(EN2_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(EN2_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
EN2_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PORT_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(EN2_CONFIG_GPIO_NAME, EN2_CONFIG_PORT_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(EN2_CONFIG_GPIO_NAME, 1<<EN2_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(EN2_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if EN2_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(EN2_CONFIG_PORT_NAME, EN2_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(EN2_InputConfig, EN2_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = EN2_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if EN2_CONFIG_INIT_PIN_DIRECTION == EN2_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
EN2_SetInput();
|
||||
#elif EN2_CONFIG_INIT_PIN_DIRECTION == EN2_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
EN2_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void EN2_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END EN2. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/EN2.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/EN2.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : EN2.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : EN2
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool EN2_GetDir(void);
|
||||
** SetDir - void EN2_SetDir(bool Dir);
|
||||
** SetInput - void EN2_SetInput(void);
|
||||
** SetOutput - void EN2_SetOutput(void);
|
||||
** GetVal - bool EN2_GetVal(void);
|
||||
** PutVal - void EN2_PutVal(bool Val);
|
||||
** ClrVal - void EN2_ClrVal(void);
|
||||
** SetVal - void EN2_SetVal(void);
|
||||
** NegVal - void EN2_NegVal(void);
|
||||
** Init - void EN2_Init(void);
|
||||
** Deinit - void EN2_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file EN2.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup EN2_module EN2 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __EN2_H
|
||||
#define __EN2_H
|
||||
|
||||
/* MODULE EN2. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "EN2config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define EN2_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum EN2_pinNames{
|
||||
EN2_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(EN2_GPIO_IDX, EN2_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t EN2_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t EN2_InputConfig[];
|
||||
#endif
|
||||
|
||||
void EN2_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN2_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN2_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN2_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN2_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool EN2_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool EN2_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN2_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN2_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN2_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void EN2_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END EN2. */
|
||||
|
||||
#endif
|
||||
/* ifndef __EN2_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/EN2config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/EN2config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __EN2_CONFIG_H
|
||||
#define __EN2_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_EN2_PIN)
|
||||
#define EN2_CONFIG_PIN_NUMBER BOARD_INITPINS_EN2_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_EN2_GPIO)
|
||||
#define EN2_CONFIG_GPIO_NAME BOARD_INITPINS_EN2_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_EN2_PORT)
|
||||
#define EN2_CONFIG_PORT_NAME BOARD_INITPINS_EN2_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EN2_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define EN2_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define EN2_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define EN2_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef EN2_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define EN2_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define EN2_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define EN2_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define EN2_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define EN2_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef EN2_CONFIG_PIN_NUMBER
|
||||
#define EN2_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef EN2_CONFIG_PIN_SYMBOL
|
||||
#define EN2_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef EN2_CONFIG_INIT_PIN_VALUE
|
||||
#define EN2_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define EN2_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define EN2_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define EN2_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef EN2_CONFIG_INIT_PIN_DIRECTION
|
||||
#define EN2_CONFIG_INIT_PIN_DIRECTION EN2_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef EN2_CONFIG_DO_PIN_MUXING
|
||||
#define EN2_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef EN2_CONFIG_PULL_RESISTOR
|
||||
#define EN2_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __EN2_CONFIG_H */
|
||||
1182
TSM_PicoW_Sensor/McuLib/HD44780/McuHD44780.c
Normal file
1182
TSM_PicoW_Sensor/McuLib/HD44780/McuHD44780.c
Normal file
File diff suppressed because it is too large
Load Diff
497
TSM_PicoW_Sensor/McuLib/HD44780/McuHD44780.h
Normal file
497
TSM_PicoW_Sensor/McuLib/HD44780/McuHD44780.h
Normal file
@@ -0,0 +1,497 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : McuHD44780.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : LCDHTA
|
||||
** Version : Component 01.031, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2020-08-14, 06:24, # CodeGen: 679
|
||||
** Abstract :
|
||||
** This component implements a driver for multiple 2x16 character displays.
|
||||
** Settings :
|
||||
** Component name : McuHD44780
|
||||
** HW Interface :
|
||||
** LCD Type : generic
|
||||
** LCD Lines : 2
|
||||
** Characters per Line : 16
|
||||
** Line Addresses :
|
||||
** Line 1 : 0x00
|
||||
** Line 2 : 0x40
|
||||
** Line 3 : 0x10
|
||||
** Line 4 : 0x50
|
||||
** LCD Enable Signal : Disabled
|
||||
** Read from Display : Enabled
|
||||
** R/W signal : SDK_BitIO
|
||||
** Check Busy Flag : yes
|
||||
** Wait (us) : 0
|
||||
** E signal : SDK_BitIO
|
||||
** E2 : Enabled
|
||||
** E2 signal : SDK_BitIO
|
||||
** RS signal : SDK_BitIO
|
||||
** Data/Control Bus :
|
||||
** Data/Control Bus Width : 8bit
|
||||
** DB0..DB3 : Enabled
|
||||
** DB0 : SDK_BitIO
|
||||
** DB1 : SDK_BitIO
|
||||
** DB2 : SDK_BitIO
|
||||
** DB3 : SDK_BitIO
|
||||
** DB4..DB7 : Enabled
|
||||
** DB4 : SDK_BitIO
|
||||
** DB5 : SDK_BitIO
|
||||
** DB6 : SDK_BitIO
|
||||
** DB7 : SDK_BitIO
|
||||
** Bits/Byte Bus : Disabled
|
||||
** System Interface :
|
||||
** Wait : McuWait
|
||||
** Contents :
|
||||
** WriteLCDCommand - void McuHD44780_WriteLCDCommand(uint8_t cmd);
|
||||
** Write - void McuHD44780_Write(char ch);
|
||||
** WriteLn - void McuHD44780_WriteLn(void);
|
||||
** WriteLineStr - void McuHD44780_WriteLineStr(uint8_t line, char *str);
|
||||
** WriteString - void McuHD44780_WriteString(char *str);
|
||||
** LoadSoftChar - void McuHD44780_LoadSoftChar(uint8_t charCode, uint8_t *softChar);
|
||||
** ShiftLeft - void McuHD44780_ShiftLeft(void);
|
||||
** ShiftRight - void McuHD44780_ShiftRight(void);
|
||||
** GotoXY - void McuHD44780_GotoXY(uint8_t line, uint8_t column);
|
||||
** SetEntryMode - void McuHD44780_SetEntryMode(bool increment, bool shiftLeft);
|
||||
** DisplayOn - void McuHD44780_DisplayOn(void);
|
||||
** DisplayOff - void McuHD44780_DisplayOff(void);
|
||||
** CursorOn - void McuHD44780_CursorOn(void);
|
||||
** CursorOff - void McuHD44780_CursorOff(void);
|
||||
** CursorShiftRight - void McuHD44780_CursorShiftRight(void);
|
||||
** CursorShiftLeft - void McuHD44780_CursorShiftLeft(void);
|
||||
** BlinkingOn - void McuHD44780_BlinkingOn(void);
|
||||
** BlinkingOff - void McuHD44780_BlinkingOff(void);
|
||||
** Home - void McuHD44780_Home(void);
|
||||
** Line - void McuHD44780_Line(uint8_t line);
|
||||
** Clear - void McuHD44780_Clear(void);
|
||||
** UseDisplay - uint8_t McuHD44780_UseDisplay(uint8_t display);
|
||||
** DeInit - void McuHD44780_DeInit(void);
|
||||
**
|
||||
** * Copyright (c) 2008-2020, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file McuHD44780.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** This component implements a driver for multiple 2x16 character displays.
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup McuHD44780_module McuHD44780 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __McuHD44780_H
|
||||
#define __McuHD44780_H
|
||||
|
||||
/* MODULE McuHD44780. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "McuHD44780config.h" /* configuration */
|
||||
|
||||
|
||||
|
||||
/* ID's for the soft characters which can be used as first argument for McuHD44780_LoadSoftChar().
|
||||
Note that ID's can start with zero, but if you want to use a zero byte in McuHD44780_WriteString()
|
||||
then this would be the zero delimiter byte, so not very useful. */
|
||||
#define McuHD44780_SOFTCHAR_UE 1 /*<! ID for '<27>' */
|
||||
#define McuHD44780_SOFTCHAR_AE 2 /*<! ID for '<27>' */
|
||||
#define McuHD44780_SOFTCHAR_OE 3 /*<! ID for '<27>' */
|
||||
|
||||
/* support for custom soft characters in the display which can be used with McuHD44780_LoadSoftChar() */
|
||||
extern const uint8_t McuHD44780_SoftCharUE[8]; /* <20> */
|
||||
extern const uint8_t McuHD44780_SoftCharAE[8]; /* <20> */
|
||||
extern const uint8_t McuHD44780_SoftCharOE[8]; /* <20> */
|
||||
|
||||
#define McuHD44780_MAX_LCD_LINE_CHARS 16 /* number of chars of the LCD on a line */
|
||||
|
||||
|
||||
void McuHD44780_WriteLCDData(uint8_t ch);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : McuHD44780_WriteLCDData (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** This method is internal. It is used by Processor Expert only.
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : McuHD44780_Init (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** This method is internal. It is used by Processor Expert only.
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_Clear(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Clear (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Clears the display and moves the cursor to the first line.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_Home(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Home (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Moves the cursor to the beginning of the first line.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_GotoXY(uint8_t line, uint8_t column);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GotoXY (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Places the cursor on a specified position on the display.
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** line - Line number starting with 1
|
||||
** column - Column number starting with 1
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_ShiftLeft(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ShiftLeft (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Shifts all characters to the left.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
#define McuHD44780_Write(ch) McuHD44780_WriteLCDData((uint8_t)ch)
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Write (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Write a single character to the display
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** ch - Character to write
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_WriteLn(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : WriteLn (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Writes a new line to the display
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_WriteString(char *str);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : WriteString (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Writes a string to the display at the current cursor
|
||||
** position.
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** * str - Pointer to string (zero byte terminated)
|
||||
** to write to the display
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_WriteLineStr(uint8_t line, char *str);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : WriteLineStr (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Writes a full line to the display (clears the rest of the
|
||||
** line).
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** line - Line number (starting with 1).
|
||||
** * str - Pointer to the string which should be
|
||||
** shown on the display.
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_LoadSoftChar(uint8_t charCode, uint8_t *softChar);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : LoadSoftChar (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Loads a user defined (softchar) into the display CGRAM.
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** charCode - The character code to be defined
|
||||
** (0..7)
|
||||
** * softChar - Pointer to an array of 8 bytes
|
||||
** defining the soft character
|
||||
** Example of the soft character '<27>':
|
||||
** const byte SoftCharUE[8] = { // <20>
|
||||
** 0x11, 0x00, 0x11, 0x11, 0x11, 0x13, 0x0d, 0
|
||||
** // X...X
|
||||
** // .....
|
||||
** // X...X
|
||||
** // X...X
|
||||
** // X...X
|
||||
** // X..XX
|
||||
** // .XX.X
|
||||
** };
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_Line(uint8_t line);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Line (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Sets the current line.
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** line - Line number, starting with 1
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_ShiftRight(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ShiftRight (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Shifts all characters to the right.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_CursorOn(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : CursorOn (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Enables the cursor.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_CursorOff(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : CursorOff (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Disables the cursor.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_DisplayOn(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : DisplayOn (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Sends the display on command to the display.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_DisplayOff(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : DisplayOff (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Sends the display off command to the display.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_BlinkingOn(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : BlinkingOn (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Sends the display off command to the display.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_BlinkingOff(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : BlinkingOff (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Puts the display in blinking off mode.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_SetEntryMode(bool increment, bool shiftLeft);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetEntryMode (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Configures the display entry mode, if the cursor has to
|
||||
** shift and/or if the display shall shift content while
|
||||
** displaying text.
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** increment - Increments (TRUE) or
|
||||
** decrements (FALSE) the display address by 1
|
||||
** when a character code is written into or
|
||||
** read from DDRAM. The cursor or blinking
|
||||
** moves to the right when incremented by 1
|
||||
** and to the left when decremented by 1.
|
||||
** shiftLeft - The display does not shift if
|
||||
** the 'shift' is FALSE. If 'shift' is TRUE,
|
||||
** it will seem as if the cursor does not move
|
||||
** but the display does.
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_WaitForLCDReady(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : McuHD44780_WaitForLCDReady (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** This method is internal. It is used by Processor Expert only.
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
uint8_t McuHD44780_UseDisplay(uint8_t display);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : UseDisplay (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
**
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** display - Has to be either 1 (top display,
|
||||
** using E1) or 2 (bottom display, using E2)
|
||||
** Returns :
|
||||
** --- - Error code
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_CursorShiftRight(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : CursorShiftRight (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Shift the cursor to the right.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_CursorShiftLeft(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : CursorShiftLeft (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Shift the cursor to the left.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_WriteLCDCommand(uint8_t cmd);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : WriteLCDCommand (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Writes a command to the display
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** cmd - command passed to the LCD
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void McuHD44780_DeInit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : DeInit (component LCDHTA)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization routine
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END McuHD44780. */
|
||||
|
||||
#endif
|
||||
/* ifndef __McuHD44780_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
74
TSM_PicoW_Sensor/McuLib/HD44780/McuHD44780config.h
Normal file
74
TSM_PicoW_Sensor/McuLib/HD44780/McuHD44780config.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for LCDHTA
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the character LCD module.
|
||||
*/
|
||||
|
||||
#ifndef __McuHD44780_CONFIG_H
|
||||
#define __McuHD44780_CONFIG_H
|
||||
|
||||
#ifndef McuHD44780_CONFIG_LCD_TYPE
|
||||
#define McuHD44780_CONFIG_LCD_TYPE (0)
|
||||
/*!< 1: Diplaytech 162c: use different timing than the default. 0: use default timing */
|
||||
#endif
|
||||
|
||||
#define McuHD44780_CONFIG_LCD_NOF_LINES (2) /* 1, 2, 3 or 4 */
|
||||
|
||||
#define McuHD44780_CONFIG_LCD_DATA_BUS_WIDTH (8) /* 4 or 8 */
|
||||
|
||||
#define McuHD44780_CONFIG_LCD_DATA_BUS_PORT_8BIT (0)
|
||||
/*!< 1: using 8bit data port; 0: not using 8bit data port */
|
||||
|
||||
#include "RS1.h" /* RS signal pin header file */
|
||||
#include "EN1.h" /* EN signal pin header file */
|
||||
#if McuHD44780_CONFIG_LCD_DATA_BUS_WIDTH==8 /* extra includes for 8bit data bus */
|
||||
#include "DB01.h" /* DB0 signal pin header file */
|
||||
#include "DB11.h" /* DB1 signal pin header file */
|
||||
#include "DB21.h" /* DB2 signal pin header file */
|
||||
#include "DB31.h" /* DB3 signal pin header file */
|
||||
#endif /* McuHD44780_CONFIG_LCD_DATA_BUS_WIDTH==8 */
|
||||
#include "DB41.h" /* DB4 signal pin header file */
|
||||
#include "DB51.h" /* DB5 signal pin header file */
|
||||
#include "DB61.h" /* DB6 signal pin header file */
|
||||
#include "DB71.h" /* DB7 signal pin header file */
|
||||
|
||||
#ifndef McuHD44780_CONFIG_USE_E2_SIGNAL
|
||||
#define McuHD44780_CONFIG_USE_E2_SIGNAL (1)
|
||||
/*!< 1: Use E2 signal to control upper and lower half of display. 0: do not use E2 signal */
|
||||
#endif
|
||||
|
||||
#if McuHD44780_CONFIG_USE_E2_SIGNAL
|
||||
#include "EN2.h"
|
||||
#endif
|
||||
|
||||
#ifndef McuHD44780_CONFIG_USE_DISPLAY_READ
|
||||
#define McuHD44780_CONFIG_USE_DISPLAY_READ (1)
|
||||
/*!< 1: Read from the display. Requires R/W signal. 0: do not read from the display */
|
||||
#endif
|
||||
|
||||
#ifndef McuHD44780_CONFIG_USE_DISPLAY_READ_CHECK_BUSY_FLAG
|
||||
#if McuHD44780_CONFIG_USE_DISPLAY_READ && McuHD44780_CONFIG_USE_DISPLAY_READ_CHECK_BUSY_FLAG
|
||||
#define McuHD44780_CONFIG_USE_DISPLAY_READ_CHECK_BUSY_FLAG (1 && McuHD44780_CONFIG_USE_DISPLAY_READ)
|
||||
#else
|
||||
#define McuHD44780_CONFIG_USE_DISPLAY_READ_CHECK_BUSY_FLAG (0 && McuHD44780_CONFIG_USE_DISPLAY_READ)
|
||||
#endif
|
||||
/*!< 1: Check the busy flag Requires reading from the display. 0: do not check busy flag */
|
||||
#endif
|
||||
|
||||
#ifndef McuHD44780_CONFIG_USE_RW_SIGNAL
|
||||
#define McuHD44780_CONFIG_USE_RW_SIGNAL (1 && McuHD44780_CONFIG_USE_DISPLAY_READ)
|
||||
/*!< 1: Use RW signal to read/write from the display. 0: do not use RW signal */
|
||||
#endif
|
||||
|
||||
#if McuHD44780_CONFIG_USE_RW_SIGNAL
|
||||
#include "RW1.h"
|
||||
#endif
|
||||
|
||||
#define McuHD44780_CONFIG_WAIT_DISPLAY_US 0 /* wait time as specified in properties */
|
||||
#define McuHD44780_CONFIG_WAIT_LCD_CMD_AFTER_4BIT_DATA1_US 15 /* wait time after first 4bit data */
|
||||
#define McuHD44780_CONFIG_WAIT_LCD_CMD_AFTER_4BIT_DATA2_US 60 /* wait time after second 4bit data */
|
||||
|
||||
#endif /* __McuHD44780_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/RS1.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/RS1.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : RS1.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : RS1
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool RS1_GetDir(void);
|
||||
** SetDir - void RS1_SetDir(bool Dir);
|
||||
** SetInput - void RS1_SetInput(void);
|
||||
** SetOutput - void RS1_SetOutput(void);
|
||||
** GetVal - bool RS1_GetVal(void);
|
||||
** PutVal - void RS1_PutVal(bool Val);
|
||||
** ClrVal - void RS1_ClrVal(void);
|
||||
** SetVal - void RS1_SetVal(void);
|
||||
** NegVal - void RS1_NegVal(void);
|
||||
** Init - void RS1_Init(void);
|
||||
** Deinit - void RS1_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file RS1.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup RS1_module RS1 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE RS1. */
|
||||
|
||||
#include "RS1.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if RS1_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t RS1_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
RS1_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t RS1_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
RS1_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t RS1_OutputConfig[] = {
|
||||
{
|
||||
.pinName = RS1_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = RS1_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t RS1_InputConfig[] = {
|
||||
{
|
||||
.pinName = RS1_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if RS1_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if RS1_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool RS1_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PORT_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(RS1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(RS1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PORT_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(RS1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(RS1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PORT_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(RS1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(RS1_CONFIG_PORT_NAME);
|
||||
if (val&(1<<RS1_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(RS1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool RS1_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(RS1_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(RS1_CONFIG_PORT_NAME)&(1<<RS1_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(RS1_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool RS1_GetDir(void)
|
||||
{
|
||||
return RS1_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
RS1_SetOutput();
|
||||
} else {
|
||||
RS1_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, &RS1_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PIN_NUMBER, &RS1_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(RS1_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(RS1_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<RS1_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(RS1_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(RS1_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
RS1_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, &RS1_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PIN_NUMBER, &RS1_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(RS1_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(RS1_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<RS1_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(RS1_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(RS1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
RS1_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PORT_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(RS1_CONFIG_GPIO_NAME, RS1_CONFIG_PORT_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(RS1_CONFIG_GPIO_NAME, 1<<RS1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(RS1_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if RS1_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(RS1_CONFIG_PORT_NAME, RS1_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(RS1_InputConfig, RS1_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = RS1_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if RS1_CONFIG_INIT_PIN_DIRECTION == RS1_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
RS1_SetInput();
|
||||
#elif RS1_CONFIG_INIT_PIN_DIRECTION == RS1_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
RS1_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RS1_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END RS1. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/RS1.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/RS1.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : RS1.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : RS1
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool RS1_GetDir(void);
|
||||
** SetDir - void RS1_SetDir(bool Dir);
|
||||
** SetInput - void RS1_SetInput(void);
|
||||
** SetOutput - void RS1_SetOutput(void);
|
||||
** GetVal - bool RS1_GetVal(void);
|
||||
** PutVal - void RS1_PutVal(bool Val);
|
||||
** ClrVal - void RS1_ClrVal(void);
|
||||
** SetVal - void RS1_SetVal(void);
|
||||
** NegVal - void RS1_NegVal(void);
|
||||
** Init - void RS1_Init(void);
|
||||
** Deinit - void RS1_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file RS1.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup RS1_module RS1 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __RS1_H
|
||||
#define __RS1_H
|
||||
|
||||
/* MODULE RS1. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "RS1config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define RS1_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum RS1_pinNames{
|
||||
RS1_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(RS1_GPIO_IDX, RS1_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t RS1_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t RS1_InputConfig[];
|
||||
#endif
|
||||
|
||||
void RS1_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RS1_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RS1_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RS1_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RS1_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool RS1_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool RS1_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RS1_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RS1_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RS1_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RS1_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END RS1. */
|
||||
|
||||
#endif
|
||||
/* ifndef __RS1_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/RS1config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/RS1config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __RS1_CONFIG_H
|
||||
#define __RS1_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_RS1_PIN)
|
||||
#define RS1_CONFIG_PIN_NUMBER BOARD_INITPINS_RS1_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_RS1_GPIO)
|
||||
#define RS1_CONFIG_GPIO_NAME BOARD_INITPINS_RS1_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_RS1_PORT)
|
||||
#define RS1_CONFIG_PORT_NAME BOARD_INITPINS_RS1_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RS1_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define RS1_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define RS1_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define RS1_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef RS1_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define RS1_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define RS1_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define RS1_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define RS1_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define RS1_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef RS1_CONFIG_PIN_NUMBER
|
||||
#define RS1_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef RS1_CONFIG_PIN_SYMBOL
|
||||
#define RS1_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef RS1_CONFIG_INIT_PIN_VALUE
|
||||
#define RS1_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define RS1_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define RS1_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define RS1_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef RS1_CONFIG_INIT_PIN_DIRECTION
|
||||
#define RS1_CONFIG_INIT_PIN_DIRECTION RS1_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef RS1_CONFIG_DO_PIN_MUXING
|
||||
#define RS1_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef RS1_CONFIG_PULL_RESISTOR
|
||||
#define RS1_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __RS1_CONFIG_H */
|
||||
537
TSM_PicoW_Sensor/McuLib/HD44780/RW1.c
Normal file
537
TSM_PicoW_Sensor/McuLib/HD44780/RW1.c
Normal file
@@ -0,0 +1,537 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : RW1.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : RW1
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool RW1_GetDir(void);
|
||||
** SetDir - void RW1_SetDir(bool Dir);
|
||||
** SetInput - void RW1_SetInput(void);
|
||||
** SetOutput - void RW1_SetOutput(void);
|
||||
** GetVal - bool RW1_GetVal(void);
|
||||
** PutVal - void RW1_PutVal(bool Val);
|
||||
** ClrVal - void RW1_ClrVal(void);
|
||||
** SetVal - void RW1_SetVal(void);
|
||||
** NegVal - void RW1_NegVal(void);
|
||||
** Init - void RW1_Init(void);
|
||||
** Deinit - void RW1_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file RW1.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup RW1_module RW1 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
/* MODULE RW1. */
|
||||
|
||||
#include "RW1.h"
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if RW1_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#include "fsl_iocon.h" /* include SDK header file for I/O connection muxing */
|
||||
#else /* Kinetis */
|
||||
#include "fsl_port.h" /* include SDK header file for port muxing */
|
||||
#endif
|
||||
#endif
|
||||
#include "fsl_gpio.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
#include "pins_gpio_hw_access.h"
|
||||
#include "pins_driver.h" /* include SDK header file for GPIO */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
#include "nrf_gpio.h"
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
#include "McuGPIO.h"
|
||||
#else
|
||||
#error "Unsupported SDK!"
|
||||
#endif
|
||||
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
static const gpio_pin_config_t RW1_configOutput = {
|
||||
kGPIO_DigitalOutput, /* use as output pin */
|
||||
RW1_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
|
||||
static const gpio_pin_config_t RW1_configInput = {
|
||||
kGPIO_DigitalInput, /* use as input pin */
|
||||
RW1_CONFIG_INIT_PIN_VALUE, /* initial value */
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
const gpio_output_pin_user_config_t RW1_OutputConfig[] = {
|
||||
{
|
||||
.pinName = RW1_CONFIG_PIN_SYMBOL,
|
||||
.config.outputLogic = RW1_CONFIG_INIT_PIN_VALUE,
|
||||
#if FSL_FEATURE_PORT_HAS_SLEW_RATE
|
||||
.config.slewRate = kPortSlowSlewRate,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_OPEN_DRAIN
|
||||
.config.isOpenDrainEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH
|
||||
.config.driveStrength = kPortLowDriveStrength,
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
|
||||
const gpio_input_pin_user_config_t RW1_InputConfig[] = {
|
||||
{
|
||||
.pinName = RW1_CONFIG_PIN_SYMBOL,
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_ENABLE
|
||||
#if RW1_CONFIG_PULL_RESISTOR==0 /* 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
.config.isPullEnable = false,
|
||||
#else
|
||||
.config.isPullEnable = true,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PULL_SELECTION
|
||||
#if RW1_CONFIG_PULL_RESISTOR==1
|
||||
.config.pullSelect = kPortPullUp,
|
||||
#else
|
||||
.config.pullSelect = kPortPullDown,
|
||||
#endif
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER
|
||||
.config.isPassiveFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER
|
||||
.config.isDigitalFilterEnabled = true,
|
||||
#endif
|
||||
#if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR
|
||||
.config.interrupt = kPortIntDisabled
|
||||
#endif
|
||||
},
|
||||
{
|
||||
.pinName = GPIO_PINS_OUT_OF_RANGE,
|
||||
}
|
||||
};
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
static McuGPIO_Handle_t pin;
|
||||
#endif
|
||||
|
||||
static bool RW1_isOutput = false;
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_ClrVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortClear(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PORT_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_ClearPinsOutput(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortClear(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_ClearPinOutput(RW1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, 0);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_clear(RW1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetLow(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_SetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortSet(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PORT_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_SetPinsOutput(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortSet(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinOutput(RW1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_GPIO_WritePin(RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, 1);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_set(RW1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetHigh(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_NegVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PortToggle(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PORT_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION < 250
|
||||
GPIO_TogglePinsOutput(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#else
|
||||
GPIO_PortToggle(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_TogglePinOutput(RW1_CONFIG_PIN_SYMBOL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsOutput(RW1_CONFIG_PORT_NAME);
|
||||
if (val&(1<<RW1_CONFIG_PIN_NUMBER)) {
|
||||
PINS_GPIO_WritePin(RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, 0);
|
||||
} else {
|
||||
PINS_GPIO_WritePin(RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, 1);
|
||||
}
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_pin_toggle(RW1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Toggle(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
bool RW1_GetVal(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
return GPIO_PinRead(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
return GPIO_ReadPinInput(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PIN_NUMBER)!=0;
|
||||
#else
|
||||
return GPIO_PinRead(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PIN_NUMBER)!=0;
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
return GPIO_DRV_ReadPinInput(RW1_CONFIG_PIN_SYMBOL)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
return (PINS_DRV_ReadPins(RW1_CONFIG_PORT_NAME)&(1<<RW1_CONFIG_PIN_NUMBER))!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
return nrf_gpio_pin_read(RW1_CONFIG_PIN_NUMBER)!=0;
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
return McuGPIO_GetValue(pin);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
bool RW1_GetDir(void)
|
||||
{
|
||||
return RW1_isOutput;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_SetDir(bool Dir)
|
||||
{
|
||||
if (Dir) {
|
||||
RW1_SetOutput();
|
||||
} else {
|
||||
RW1_SetInput();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_SetInput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, &RW1_configInput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PIN_NUMBER, &RW1_configInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(RW1_CONFIG_PIN_SYMBOL, kGpioDigitalInput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(RW1_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val &= ~(1<<RW1_CONFIG_PIN_NUMBER); /* clear bit ==> input */
|
||||
PINS_DRV_SetPinsDirection(RW1_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_input(RW1_CONFIG_PIN_NUMBER, NRF_GPIO_PIN_NOPULL);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsInput(pin);
|
||||
#endif
|
||||
RW1_isOutput = false;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_SetOutput(void)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
GPIO_PinInit(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, &RW1_configOutput);
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
GPIO_PinInit(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PIN_NUMBER, &RW1_configOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_SetPinDir(RW1_CONFIG_PIN_SYMBOL, kGpioDigitalOutput);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
pins_channel_type_t val;
|
||||
|
||||
val = PINS_GPIO_GetPinsDirection(RW1_CONFIG_PORT_NAME); /* bit 0: pin is input; 1: pin is output */
|
||||
val |= (1<<RW1_CONFIG_PIN_NUMBER); /* set bit ==> output */
|
||||
PINS_DRV_SetPinsDirection(RW1_CONFIG_PORT_NAME, val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
nrf_gpio_cfg_output(RW1_CONFIG_PIN_NUMBER);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetAsOutput(pin, false /* don't care */);
|
||||
#endif
|
||||
RW1_isOutput = true;
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_PutVal(bool Val)
|
||||
{
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
if (Val) {
|
||||
GPIO_PortSet(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PORT_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(RW1_CONFIG_GPIO_NAME, RW1_CONFIG_PORT_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#elif McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if McuLib_CONFIG_SDK_VERSION < 250
|
||||
if (Val) {
|
||||
GPIO_SetPinsOutput(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_ClearPinsOutput(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#else
|
||||
if (Val) {
|
||||
GPIO_PortSet(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
} else {
|
||||
GPIO_PortClear(RW1_CONFIG_GPIO_NAME, 1<<RW1_CONFIG_PIN_NUMBER);
|
||||
}
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
GPIO_DRV_WritePinOutput(RW1_CONFIG_PIN_SYMBOL, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
PINS_DRV_WritePin(RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, Val);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* NYI */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_SetValue(pin, Val);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_Init(void)
|
||||
{
|
||||
#if McuLib_CONFIG_NXP_SDK_2_0_USED
|
||||
#if RW1_CONFIG_DO_PIN_MUXING
|
||||
#if McuLib_CONFIG_CPU_IS_LPC
|
||||
#define _IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
|
||||
#define _IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
|
||||
#define _IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
|
||||
#define _IOCON_PIO_MODE_PULLUP 0x10u /*!<@brief Selects pull-up function */
|
||||
#define _IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
|
||||
#define _IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
|
||||
|
||||
const uint32_t port_pin_config = (/* Pin is configured as PI<portname>_<pinnumber> */
|
||||
_IOCON_PIO_FUNC0 |
|
||||
/* Selects pull-up function */
|
||||
_IOCON_PIO_MODE_PULLUP |
|
||||
/* Standard mode, output slew rate control is enabled */
|
||||
_IOCON_PIO_SLEW_STANDARD |
|
||||
/* Input function is not inverted */
|
||||
_IOCON_PIO_INV_DI |
|
||||
/* Enables digital function */
|
||||
_IOCON_PIO_DIGITAL_EN |
|
||||
/* Open drain is disabled */
|
||||
_IOCON_PIO_OPENDRAIN_DI);
|
||||
#if (McuLib_CONFIG_CPU_IS_LPC && McuLib_CONFIG_CORTEX_M==0)
|
||||
IOCON_PinMuxSet(RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#else
|
||||
IOCON_PinMuxSet(IOCON, RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, port_pin_config);
|
||||
#endif
|
||||
#else
|
||||
PORT_SetPinMux(RW1_CONFIG_PORT_NAME, RW1_CONFIG_PIN_NUMBER, kPORT_MuxAsGpio); /* mux as GPIO */
|
||||
#endif
|
||||
#endif
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
/*! Pin Muxing not implemented */
|
||||
GPIO_DRV_Init(RW1_InputConfig, RW1_OutputConfig);
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_S32K
|
||||
/* the following needs to be called in the application first:
|
||||
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
|
||||
*/
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_NORDIC_NRF5
|
||||
/* nothing needed */
|
||||
#elif McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
McuGPIO_Config_t config;
|
||||
|
||||
McuGPIO_GetDefaultConfig(&config);
|
||||
config.hw.pin = RW1_CONFIG_PIN_NUMBER;
|
||||
config.isInput = true;
|
||||
pin = McuGPIO_InitGPIO(&config);
|
||||
#endif
|
||||
#if RW1_CONFIG_INIT_PIN_DIRECTION == RW1_CONFIG_INIT_PIN_DIRECTION_INPUT
|
||||
RW1_SetInput();
|
||||
#elif RW1_CONFIG_INIT_PIN_DIRECTION == RW1_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
RW1_SetOutput();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
void RW1_Deinit(void)
|
||||
{
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_RPI_PICO
|
||||
pin = McuGPIO_DeinitGPIO(pin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* END RW1. */
|
||||
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
243
TSM_PicoW_Sensor/McuLib/HD44780/RW1.h
Normal file
243
TSM_PicoW_Sensor/McuLib/HD44780/RW1.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* ###################################################################
|
||||
** This component module is generated by Processor Expert. Do not modify it.
|
||||
** Filename : RW1.h
|
||||
** Project : FRDM-K64F_Generator
|
||||
** Processor : MK64FN1M0VLL12
|
||||
** Component : SDK_BitIO
|
||||
** Version : Component 01.030, Driver 01.00, CPU db: 3.00.000
|
||||
** Compiler : GNU C Compiler
|
||||
** Date/Time : 2024-07-29, 05:47, # CodeGen: 836
|
||||
** Abstract :
|
||||
** GPIO component usable with NXP SDK
|
||||
** Settings :
|
||||
** Component name : RW1
|
||||
** SDK : McuLib
|
||||
** GPIO Name : GPIOA
|
||||
** PORT Name : PORTA
|
||||
** Pin Number : 0
|
||||
** Pin Symbol : LED_RED
|
||||
** Do Pin Muxing : no
|
||||
** Init Direction : Output
|
||||
** Pull Resistor : no pull resistor
|
||||
** Init Value : 0
|
||||
** Contents :
|
||||
** GetDir - bool RW1_GetDir(void);
|
||||
** SetDir - void RW1_SetDir(bool Dir);
|
||||
** SetInput - void RW1_SetInput(void);
|
||||
** SetOutput - void RW1_SetOutput(void);
|
||||
** GetVal - bool RW1_GetVal(void);
|
||||
** PutVal - void RW1_PutVal(bool Val);
|
||||
** ClrVal - void RW1_ClrVal(void);
|
||||
** SetVal - void RW1_SetVal(void);
|
||||
** NegVal - void RW1_NegVal(void);
|
||||
** Init - void RW1_Init(void);
|
||||
** Deinit - void RW1_Deinit(void);
|
||||
**
|
||||
** * Copyright (c) 2015-2024, Erich Styger
|
||||
** * Web: https://mcuoneclipse.com
|
||||
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
|
||||
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
|
||||
** * All rights reserved.
|
||||
** *
|
||||
** * Redistribution and use in source and binary forms, with or without modification,
|
||||
** * are permitted provided that the following conditions are met:
|
||||
** *
|
||||
** * - Redistributions of source code must retain the above copyright notice, this list
|
||||
** * of conditions and the following disclaimer.
|
||||
** *
|
||||
** * - Redistributions in binary form must reproduce the above copyright notice, this
|
||||
** * list of conditions and the following disclaimer in the documentation and/or
|
||||
** * other materials provided with the distribution.
|
||||
** *
|
||||
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
** ###################################################################*/
|
||||
/*!
|
||||
** @file RW1.h
|
||||
** @version 01.00
|
||||
** @brief
|
||||
** GPIO component usable with NXP SDK
|
||||
*/
|
||||
/*!
|
||||
** @addtogroup RW1_module RW1 module documentation
|
||||
** @{
|
||||
*/
|
||||
|
||||
#ifndef __RW1_H
|
||||
#define __RW1_H
|
||||
|
||||
/* MODULE RW1. */
|
||||
#include "McuLib.h" /* SDK and API used */
|
||||
#include "RW1config.h" /* configuration */
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_KINETIS_1_3
|
||||
#include "fsl_gpio_driver.h"
|
||||
|
||||
/* only GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF and GPIOG are currently supported */
|
||||
#define RW1_GPIO_IDX GPIOA_IDX /* GPIOA */
|
||||
|
||||
enum RW1_pinNames{
|
||||
RW1_CONFIG_PIN_SYMBOL = GPIO_MAKE_PIN(RW1_GPIO_IDX, RW1_CONFIG_PIN_NUMBER),
|
||||
};
|
||||
|
||||
extern const gpio_output_pin_user_config_t RW1_OutputConfig[];
|
||||
extern const gpio_input_pin_user_config_t RW1_InputConfig[];
|
||||
#endif
|
||||
|
||||
void RW1_Init(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Init (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RW1_ClrVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : ClrVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Clears the pin value (sets it to a low level)
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RW1_SetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value to a high value.
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RW1_NegVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : NegVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Toggles/negates the pin value
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RW1_Deinit(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : Deinit (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Driver de-initialization method
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool RW1_GetVal(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Returns the pin value
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - Returns the value of the pin:
|
||||
** FALSE/logical level '0' or TRUE/logical
|
||||
** level '1'
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
bool RW1_GetDir(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : GetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Return the direction of the pin (input/output)
|
||||
** Parameters : None
|
||||
** Returns :
|
||||
** --- - FALSE if port is input, TRUE if port is
|
||||
** output
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RW1_SetDir(bool Dir);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetDir (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the direction of the pin (input or output)
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Dir - FALSE: input, TRUE: output
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RW1_SetInput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetInput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as input
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RW1_SetOutput(void);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : SetOutput (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin as output
|
||||
** Parameters : None
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
void RW1_PutVal(bool Val);
|
||||
/*
|
||||
** ===================================================================
|
||||
** Method : PutVal (component SDK_BitIO)
|
||||
**
|
||||
** Description :
|
||||
** Sets the pin value
|
||||
** Parameters :
|
||||
** NAME - DESCRIPTION
|
||||
** Val - Value to set. FALSE/logical '0' or
|
||||
** TRUE/logical '1'
|
||||
** Returns : Nothing
|
||||
** ===================================================================
|
||||
*/
|
||||
|
||||
/* END RW1. */
|
||||
|
||||
#endif
|
||||
/* ifndef __RW1_H */
|
||||
/*!
|
||||
** @}
|
||||
*/
|
||||
87
TSM_PicoW_Sensor/McuLib/HD44780/RW1config.h
Normal file
87
TSM_PicoW_Sensor/McuLib/HD44780/RW1config.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* \file
|
||||
* \brief Configuration header file for SDK_BitIO
|
||||
* Copyright (c) 2020, Erich Styger
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* This header file is used to configure settings of the SDK Bit I/O module.
|
||||
*/
|
||||
|
||||
#ifndef __RW1_CONFIG_H
|
||||
#define __RW1_CONFIG_H
|
||||
|
||||
#if McuLib_CONFIG_SDK_VERSION_USED == McuLib_CONFIG_SDK_MCUXPRESSO_2_0
|
||||
#include "pin_mux.h" /* include pin muxing header file */
|
||||
|
||||
#if defined(BOARD_INITPINS_RW1_PIN)
|
||||
#define RW1_CONFIG_PIN_NUMBER BOARD_INITPINS_RW1_PIN
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_RW1_GPIO)
|
||||
#define RW1_CONFIG_GPIO_NAME BOARD_INITPINS_RW1_GPIO
|
||||
#endif
|
||||
#if defined(BOARD_INITPINS_RW1_PORT)
|
||||
#define RW1_CONFIG_PORT_NAME BOARD_INITPINS_RW1_PORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RW1_CONFIG_PORT_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define RW1_CONFIG_PORT_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define RW1_CONFIG_PORT_NAME 0
|
||||
#else /* name from properties */
|
||||
#define RW1_CONFIG_PORT_NAME PORTA
|
||||
#endif
|
||||
/*!< name of PORT, is pointer to PORT_Type */
|
||||
#endif
|
||||
|
||||
#ifndef RW1_CONFIG_GPIO_NAME
|
||||
#if McuLib_CONFIG_CPU_IS_IMXRT
|
||||
#define RW1_CONFIG_GPIO_NAME GPIO1
|
||||
#elif McuLib_CONFIG_CPU_IS_LPC
|
||||
#define RW1_CONFIG_GPIO_NAME GPIO
|
||||
#elif McuLib_CONFIG_CPU_IS_KINETIS && McuLib_CONFIG_IS_KINETIS_KE
|
||||
#define RW1_CONFIG_GPIO_NAME 0
|
||||
#elif McuLib_CONFIG_CPU_IS_MCX
|
||||
#define RW1_CONFIG_GPIO_NAME GPIO0
|
||||
#else /* name from properties */
|
||||
#define RW1_CONFIG_GPIO_NAME GPIOA
|
||||
#endif
|
||||
/*!< name of GPIO, is pointer to GPIO_Type, not used for S32K SDK */
|
||||
#endif
|
||||
|
||||
#ifndef RW1_CONFIG_PIN_NUMBER
|
||||
#define RW1_CONFIG_PIN_NUMBER 0u
|
||||
/*!< number of pin, type unsigned integer */
|
||||
#endif
|
||||
|
||||
#ifndef RW1_CONFIG_PIN_SYMBOL
|
||||
#define RW1_CONFIG_PIN_SYMBOL LED_RED
|
||||
/*!< symbolic name for pin, used for NXP SDK V1.3 */
|
||||
#endif
|
||||
|
||||
#ifndef RW1_CONFIG_INIT_PIN_VALUE
|
||||
#define RW1_CONFIG_INIT_PIN_VALUE 0
|
||||
/*!< 0: Pin data is initialized with 0 (low); 1: pin value is initialized with 1 (high) */
|
||||
#endif
|
||||
|
||||
/* different types of pin direction settings */
|
||||
#define RW1_CONFIG_INIT_PIN_DIRECTION_NONE (0)
|
||||
#define RW1_CONFIG_INIT_PIN_DIRECTION_INPUT (1)
|
||||
#define RW1_CONFIG_INIT_PIN_DIRECTION_OUTPUT (2)
|
||||
|
||||
#ifndef RW1_CONFIG_INIT_PIN_DIRECTION
|
||||
#define RW1_CONFIG_INIT_PIN_DIRECTION RW1_CONFIG_INIT_PIN_DIRECTION_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifndef RW1_CONFIG_DO_PIN_MUXING
|
||||
#define RW1_CONFIG_DO_PIN_MUXING 0
|
||||
/*!< 1: perform pin muxing in Init(), 0: do not do pin muxing */
|
||||
#endif
|
||||
|
||||
#ifndef RW1_CONFIG_PULL_RESISTOR
|
||||
#define RW1_CONFIG_PULL_RESISTOR 0
|
||||
/*!< pull resistor setting. 0: no pull resistor, 1: pull-up, 2: pull-down, 3: pull-up or no pull, 4: pull-down or no pull: 4: autoselect-pull */
|
||||
#endif
|
||||
|
||||
#endif /* __RW1_CONFIG_H */
|
||||
Reference in New Issue
Block a user