Microchip® Advanced Software Framework

winc1500/host_drv/driver/source/m2m_periph.c File Reference

NMC1500 Peripherials Application Interface.

Copyright (c) 2016-2021 Microchip Technology Inc. and its subsidiaries.

#include "driver/include/m2m_periph.h"
#include "driver/source/nmasic.h"
#include "m2m_hif.h"

Macros

#define GPIO_OP_DIR   0
 
#define GPIO_OP_GET   2
 
#define GPIO_OP_SET   1
 

Functions

static sint8 gpio_ioctl (uint8 op, uint8 u8GpioNum, uint8 u8InVal, uint8 *pu8OutVal)
 
sint8 m2m_periph_gpio_get_val (uint8 u8GpioNum, uint8 *pu8GpioVal)
 Read an NMC1500 GPIO input level. More...
 
sint8 m2m_periph_gpio_set_dir (uint8 u8GpioNum, uint8 u8GpioDir)
 Configure a specific NMC1500 pad as a GPIO and sets its direction (input or output). More...
 
sint8 m2m_periph_gpio_set_val (uint8 u8GpioNum, uint8 u8GpioVal)
 Set an NMC1500 GPIO output level high or low. More...
 
sint8 m2m_periph_pullup_ctrl (uint32 pinmask, uint8 enable)
 Control the programmable pull-up resistor on the chip pads . More...
 

#define GPIO_OP_DIR   0
#define GPIO_OP_GET   2
#define GPIO_OP_SET   1

sint8 m2m_periph_gpio_get_val ( uint8  u8GpioNum,
uint8 pu8GpioVal 
)

Read an NMC1500 GPIO input level.

Read an WINC15x0 GPIO input level.

Parameters
[in]u8GpioNumGPIO number. Allowed values are defined in tenuGpioNum.
[out]pu8GpioValGPIO input value. Zero = low, non-zero = high.
Returns
The function SHALL return 0 for success and a negative value otherwise.
See Also
tenuGpioNum
Parameters
[in]u8GpioNumGPIO number. Allowed values are defined in tenuGpioNum.
[out]pu8GpioValGPIO input value. Zero = low, non-zero = high.
Returns
The function returns M2M_SUCCESS for success and a negative value otherwise.
See Also
tenuGpioNum

References gpio_ioctl(), and GPIO_OP_GET.

sint8 m2m_periph_gpio_set_dir ( uint8  u8GpioNum,
uint8  u8GpioDir 
)

Configure a specific NMC1500 pad as a GPIO and sets its direction (input or output).

Configure a specific WINC15x0 pad as a GPIO and sets its direction (input or output).

Parameters
[in]u8GpioNumGPIO number. Allowed values are defined in tenuGpioNum.
[in]u8GpioDirGPIO direction: Zero = input. Non-zero = output.
Returns
The function SHALL return 0 for success and a negative value otherwise.
See Also
tenuGpioNum
Parameters
[in]u8GpioNumGPIO number. Allowed values are defined in tenuGpioNum.
[in]u8GpioDirGPIO direction: Zero = input. Non-zero = output.
Returns
The function returns M2M_SUCCESS for success and a negative value otherwise.
See Also
tenuGpioNum

References gpio_ioctl(), GPIO_OP_DIR, and NULL.

sint8 m2m_periph_gpio_set_val ( uint8  u8GpioNum,
uint8  u8GpioVal 
)

Set an NMC1500 GPIO output level high or low.

Set an WINC15x0 GPIO output level high or low.

Parameters
[in]u8GpioNumGPIO number. Allowed values are defined in tenuGpioNum.
[in]u8GpioValGPIO output value. Zero = low, non-zero = high.
Returns
The function SHALL return 0 for success and a negative value otherwise.
See Also
tenuGpioNum
Parameters
[in]u8GpioNumGPIO number. Allowed values are defined in tenuGpioNum.
[in]u8GpioValGPIO output value. Zero = low, non-zero = high.
Returns
The function SHALL return 0 for success and a negative value otherwise.
See Also
tenuGpioNum

References gpio_ioctl(), GPIO_OP_SET, and NULL.

sint8 m2m_periph_pullup_ctrl ( uint32  pinmask,
uint8  enable 
)

Control the programmable pull-up resistor on the chip pads .

Parameters
[in]pinmaskWrite operation bitwise-ORed mask for which pads to control. Allowed values are defined in tenuPullupMask.
[in]enableSet to 0 to disable pull-up resistor. Non-zero will enable the pull-up.
Returns
The function SHALL return 0 for success and a negative value otherwise.
See Also
tenuPullupMask
Parameters
[in]pinmaskWrite operation bitwise-ORed mask for which pads to control. Allowed values are defined in tenuPullupMask.
[in]enableSet to 0 to disable pull-up resistor. Non-zero will enable the pull-up.
Returns
The function returns M2M_SUCCESS for success and a negative value otherwise.
See Also
tenuPullupMask

References pullup_ctrl().