Microchip® Advanced Software Framework

m2m_periph.h File Reference

WINC3400 Peripherals Application Interface.

Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.

Data Structures

struct  tstrI2cMasterInitParam
 I2C master configuration parameters. More...
 
struct  tstrPerphInitParam
 Peripheral module initialization parameters. More...
 

Enumerations

enum  tenuGpioNum {
  M2M_PERIPH_GPIO15,
  M2M_PERIPH_GPIO16,
  M2M_PERIPH_GPIO18,
  M2M_PERIPH_GPIO_MAX
}
 A list of GPIO numbers configurable through the m2m_periph module. More...
 
enum  tenuI2cMasterFlags {
  I2C_MASTER_NO_FLAGS = 0x00,
  I2C_MASTER_NO_STOP = 0x01,
  I2C_MASTER_NO_START = 0x02
}
 Bitwise-ORed flags for use in m2m_periph_i2c_master_write and m2m_periph_i2c_master_read. More...
 
enum  tenuI2cMasterSclMuxOpt {
  M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_HOST_WAKEUP,
  M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_SD_DAT3,
  M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_GPIO13,
  M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_GPIO4,
  M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_I2C_SCL,
  M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_NUM
}
 Allowed pin multiplexing options for I2C master SCL signal. More...
 
enum  tenuI2cMasterSdaMuxOpt {
  M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_RTC_CLK,
  M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_SD_CLK,
  M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_GPIO14,
  M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_GPIO6,
  M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_I2C_SDA,
  M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_NUM
}
 Allowed pin multiplexing options for I2C master SDA signal. More...
 
enum  tenuPullupEnable1Mask {
  M2M_PERIPH_PULLUP_DIS_HOST_WAKEUP = (1ul << 0),
  M2M_PERIPH_PULLUP_DIS_RTC_CLK = (1ul << 1),
  M2M_PERIPH_PULLUP_DIS_IRQN = (1ul << 2),
  M2M_PERIPH_PULLUP_DIS_GPIO_3 = (1ul << 3),
  M2M_PERIPH_PULLUP_DIS_GPIO_4 = (1ul << 4),
  M2M_PERIPH_PULLUP_DIS_GPIO_5 = (1ul << 5),
  M2M_PERIPH_PULLUP_DIS_GPIO_6 = (1ul << 6),
  M2M_PERIPH_PULLUP_DIS_SD_CLK = (1ul << 7),
  M2M_PERIPH_PULLUP_DIS_SD_CMD_SPI_SCK = (1ul << 8),
  M2M_PERIPH_PULLUP_DIS_SD_DAT0_SPI_TXD = (1ul << 9),
  M2M_PERIPH_PULLUP_DIS_SD_DAT1_SPI_SSN = (1ul << 10),
  M2M_PERIPH_PULLUP_DIS_SD_DAT1_SPI_RXD = (1ul << 11),
  M2M_PERIPH_PULLUP_DIS_SD_DAT3 = (1ul << 12)
}
 
enum  tenuPullupEnable2Mask {
  M2M_PERIPH_PULLUP_DIS_GPIO_13 = (1ul << 0),
  M2M_PERIPH_PULLUP_DIS_GPIO_14 = (1ul << 1),
  M2M_PERIPH_PULLUP_DIS_GPIO_15 = (1ul << 2),
  M2M_PERIPH_PULLUP_DIS_GPIO_16 = (1ul << 3),
  M2M_PERIPH_PULLUP_DIS_GPIO_17 = (1ul << 4),
  M2M_PERIPH_PULLUP_DIS_GPIO_18 = (1ul << 5),
  M2M_PERIPH_PULLUP_DIS_GPIO_19 = (1ul << 6),
  M2M_PERIPH_PULLUP_DIS_GPIO_20 = (1ul << 7),
  M2M_PERIPH_PULLUP_DIS_GPIO_22 = (1ul << 9),
  M2M_PERIPH_PULLUP_DIS_GPIO_23 = (1ul << 10),
  M2M_PERIPH_PULLUP_DIS_GPIO_38 = (1ul << 25),
  M2M_PERIPH_PULLUP_DIS_GPIO_39 = (1ul << 26),
  M2M_PERIPH_PULLUP_DIS_GPIO_40 = (1ul << 27),
  M2M_PERIPH_PULLUP_DIS_GPIO_42 = (1ul << 29)
}
 

Functions

NMI_API sint8 m2m_periph_gpio_get_val (uint8 u8GpioNum, uint8 *pu8GpioVal)
 Read an NMC1500 GPIO input level. More...
 
NMI_API 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...
 
NMI_API sint8 m2m_periph_gpio_set_val (uint8 u8GpioNum, uint8 u8GpioVal)
 Set an NMC1500 GPIO output level high or low. More...
 
NMI_API sint8 m2m_periph_init (tstrPerphInitParam *param)
 Initialize the NMC1500 peripheral driver module. More...
 
NMI_API sint8 m2m_periph_pullup_ctrl (uint32 pinmask, uint8 enable)
 Control the programmable pull-up resistor on the chip pads . More...
 

A list of GPIO numbers configurable through the m2m_periph module.

Enumerator
M2M_PERIPH_GPIO15 

GPIO15 pad

M2M_PERIPH_GPIO16 

GPIO16 pad

M2M_PERIPH_GPIO18 

GPIO18 pad

M2M_PERIPH_GPIO_MAX 

Bitwise-ORed flags for use in m2m_periph_i2c_master_write and m2m_periph_i2c_master_read.

See Also
m2m_periph_i2c_master_write m2m_periph_i2c_master_read
Enumerator
I2C_MASTER_NO_FLAGS 

No flags.

I2C_MASTER_NO_STOP 

No stop bit after this transaction. Useful for scattered buffer read/write operations.

I2C_MASTER_NO_START 

No start bit at the beginning of this transaction. Useful for scattered buffer read/write operations.

Allowed pin multiplexing options for I2C master SCL signal.

Enumerator
M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_HOST_WAKEUP 

I2C master SCL is available on HOST_WAKEUP.

M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_SD_DAT3 

I2C master SCL is available on SD_DAT3 (GPIO 7).

M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_GPIO13 

I2C master SCL is available on GPIO 13.

M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_GPIO4 

I2C master SCL is available on GPIO 4.

M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_I2C_SCL 

I2C master SCL is available on I2C slave SCL.

M2M_PERIPH_I2C_MASTER_SCL_MUX_OPT_NUM 

Allowed pin multiplexing options for I2C master SDA signal.

Enumerator
M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_RTC_CLK 

I2C master SDA is available on RTC_CLK.

M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_SD_CLK 

I2C master SDA is available on SD_CLK (GPIO 8).

M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_GPIO14 

I2C master SDA is available on GPIO 14.

M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_GPIO6 

I2C master SDA is available on GPIO 6.

M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_I2C_SDA 

I2C master SDA is available on I2C slave SDA.

M2M_PERIPH_I2C_MASTER_SDA_MUX_OPT_NUM 
Enumerator
M2M_PERIPH_PULLUP_DIS_HOST_WAKEUP 
M2M_PERIPH_PULLUP_DIS_RTC_CLK 
M2M_PERIPH_PULLUP_DIS_IRQN 
M2M_PERIPH_PULLUP_DIS_GPIO_3 
M2M_PERIPH_PULLUP_DIS_GPIO_4 
M2M_PERIPH_PULLUP_DIS_GPIO_5 
M2M_PERIPH_PULLUP_DIS_GPIO_6 
M2M_PERIPH_PULLUP_DIS_SD_CLK 
M2M_PERIPH_PULLUP_DIS_SD_CMD_SPI_SCK 
M2M_PERIPH_PULLUP_DIS_SD_DAT0_SPI_TXD 
M2M_PERIPH_PULLUP_DIS_SD_DAT1_SPI_SSN 
M2M_PERIPH_PULLUP_DIS_SD_DAT1_SPI_RXD 
M2M_PERIPH_PULLUP_DIS_SD_DAT3 
Enumerator
M2M_PERIPH_PULLUP_DIS_GPIO_13 
M2M_PERIPH_PULLUP_DIS_GPIO_14 
M2M_PERIPH_PULLUP_DIS_GPIO_15 
M2M_PERIPH_PULLUP_DIS_GPIO_16 
M2M_PERIPH_PULLUP_DIS_GPIO_17 
M2M_PERIPH_PULLUP_DIS_GPIO_18 
M2M_PERIPH_PULLUP_DIS_GPIO_19 
M2M_PERIPH_PULLUP_DIS_GPIO_20 
M2M_PERIPH_PULLUP_DIS_GPIO_22 
M2M_PERIPH_PULLUP_DIS_GPIO_23 
M2M_PERIPH_PULLUP_DIS_GPIO_38 
M2M_PERIPH_PULLUP_DIS_GPIO_39 
M2M_PERIPH_PULLUP_DIS_GPIO_40 
M2M_PERIPH_PULLUP_DIS_GPIO_42 

NMI_API sint8 m2m_periph_gpio_get_val ( uint8  u8GpioNum,
uint8 pu8GpioVal 
)

Read an NMC1500 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

References gpio_ioctl(), and GPIO_OP_GET.

NMI_API 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).

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

References gpio_ioctl(), GPIO_OP_DIR, and NULL.

NMI_API sint8 m2m_periph_gpio_set_val ( uint8  u8GpioNum,
uint8  u8GpioVal 
)

Set an NMC1500 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

References gpio_ioctl(), GPIO_OP_SET, and NULL.

NMI_API sint8 m2m_periph_init ( tstrPerphInitParam param)

Initialize the NMC1500 peripheral driver module.

Parameters
[in]paramPeripheral module initialization structure. See members of tstrPerphInitParam.
Returns
The function SHALL return 0 for success and a negative value otherwise.
See Also
tstrPerphInitParam

References M2M_SUCCESS.

NMI_API 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

References pullup_ctrl().

Referenced by app_wifi_init().