2021-04-03 17:06:40 +01:00
|
|
|
/********************************************************************
|
|
|
|
* Tasmota lib
|
|
|
|
*
|
|
|
|
* To use: `import power`
|
|
|
|
*
|
|
|
|
* read power values
|
|
|
|
*******************************************************************/
|
2021-04-28 18:30:19 +01:00
|
|
|
#include "be_constobj.h"
|
2021-04-03 17:06:40 +01:00
|
|
|
|
|
|
|
// Tasmota specific
|
|
|
|
|
|
|
|
extern int gp_pin_mode(bvm *vm);
|
|
|
|
extern int gp_digital_write(bvm *vm);
|
|
|
|
extern int gp_digital_read(bvm *vm);
|
2021-09-13 12:44:39 +01:00
|
|
|
extern int gp_dac_voltage(bvm *vm);
|
2021-04-03 17:06:40 +01:00
|
|
|
|
|
|
|
extern int gp_pin_used(bvm *vm);
|
|
|
|
extern int gp_pin(bvm *vm);
|
|
|
|
|
|
|
|
/* @const_object_info_begin
|
2021-04-24 11:11:06 +01:00
|
|
|
module gpio (scope: global) {
|
2021-04-03 17:06:40 +01:00
|
|
|
LOW, int(0)
|
|
|
|
HIGH, int(1)
|
|
|
|
|
|
|
|
INPUT, int(1)
|
|
|
|
OUTPUT, int(2)
|
|
|
|
PULLUP, int(4)
|
|
|
|
INPUT_PULLUP, int(5)
|
|
|
|
PULLDOWN, int(8)
|
|
|
|
INPUT_PULLDOWN, int(9)
|
|
|
|
OPEN_DRAIN, int(16)
|
|
|
|
OUTPUT_OPEN_DRAIN, int(18)
|
2021-09-13 12:44:39 +01:00
|
|
|
DAC, int(-1)
|
2021-04-03 17:06:40 +01:00
|
|
|
|
|
|
|
RISING, int(1)
|
|
|
|
FALLING, int(2)
|
|
|
|
CHANGE, int(4)
|
|
|
|
|
|
|
|
NONE, int(0)
|
|
|
|
KEY1, int(1)
|
|
|
|
KEY1_NP, int(2)
|
|
|
|
KEY1_INV, int(3)
|
|
|
|
KEY1_INV_NP, int(4)
|
|
|
|
SWT1, int(5)
|
|
|
|
SWT1_NP, int(6)
|
|
|
|
REL1, int(7)
|
|
|
|
REL1_INV, int(8)
|
|
|
|
LED1, int(9)
|
|
|
|
LED1_INV, int(10)
|
|
|
|
CNTR1, int(11)
|
|
|
|
CNTR1_NP, int(12)
|
|
|
|
PWM1, int(13)
|
|
|
|
PWM1_INV, int(14)
|
|
|
|
BUZZER, int(15)
|
|
|
|
BUZZER_INV, int(16)
|
|
|
|
LEDLNK, int(17)
|
|
|
|
LEDLNK_INV, int(18)
|
|
|
|
I2C_SCL, int(19)
|
|
|
|
I2C_SDA, int(20)
|
|
|
|
SPI_MISO, int(21)
|
|
|
|
SPI_MOSI, int(22)
|
|
|
|
SPI_CLK, int(23)
|
|
|
|
SPI_CS, int(24)
|
|
|
|
SPI_DC, int(25)
|
|
|
|
SSPI_MISO, int(26)
|
|
|
|
SSPI_MOSI, int(27)
|
|
|
|
SSPI_SCLK, int(28)
|
|
|
|
SSPI_CS, int(29)
|
|
|
|
SSPI_DC, int(30)
|
|
|
|
BACKLIGHT, int(31)
|
|
|
|
OLED_RESET, int(32)
|
|
|
|
IRSEND, int(33)
|
|
|
|
IRRECV, int(34)
|
|
|
|
RFSEND, int(35)
|
|
|
|
RFRECV, int(36)
|
|
|
|
DHT11, int(37)
|
|
|
|
DHT22, int(38)
|
|
|
|
SI7021, int(39)
|
|
|
|
DHT11_OUT, int(40)
|
|
|
|
DSB, int(41)
|
|
|
|
DSB_OUT, int(42)
|
|
|
|
WS2812, int(43)
|
|
|
|
MHZ_TXD, int(44)
|
|
|
|
MHZ_RXD, int(45)
|
|
|
|
PZEM0XX_TX, int(46)
|
|
|
|
PZEM004_RX, int(47)
|
|
|
|
PZEM016_RX, int(48)
|
|
|
|
PZEM017_RX, int(49)
|
|
|
|
SAIR_TX, int(50)
|
|
|
|
SAIR_RX, int(51)
|
|
|
|
PMS5003_TX, int(52)
|
|
|
|
PMS5003_RX, int(53)
|
|
|
|
SDS0X1_TX, int(54)
|
|
|
|
SDS0X1_RX, int(55)
|
|
|
|
SBR_TX, int(56)
|
|
|
|
SBR_RX, int(57)
|
|
|
|
SR04_TRIG, int(58)
|
|
|
|
SR04_ECHO, int(59)
|
|
|
|
SDM120_TX, int(60)
|
|
|
|
SDM120_RX, int(61)
|
|
|
|
SDM630_TX, int(62)
|
|
|
|
SDM630_RX, int(63)
|
|
|
|
TM1638CLK, int(64)
|
|
|
|
TM1638DIO, int(65)
|
|
|
|
TM1638STB, int(66)
|
|
|
|
MP3_DFR562, int(67)
|
|
|
|
HX711_SCK, int(68)
|
|
|
|
HX711_DAT, int(69)
|
|
|
|
TX2X_TXD_BLACK, int(70)
|
|
|
|
TUYA_TX, int(71)
|
|
|
|
TUYA_RX, int(72)
|
|
|
|
MGC3130_XFER, int(73)
|
|
|
|
MGC3130_RESET, int(74)
|
|
|
|
RF_SENSOR, int(75)
|
|
|
|
AZ_TXD, int(76)
|
|
|
|
AZ_RXD, int(77)
|
|
|
|
MAX31855CS, int(78)
|
|
|
|
MAX31855CLK, int(79)
|
|
|
|
MAX31855DO, int(80)
|
|
|
|
NRG_SEL, int(81)
|
|
|
|
NRG_SEL_INV, int(82)
|
|
|
|
NRG_CF1, int(83)
|
|
|
|
HLW_CF, int(84)
|
|
|
|
HJL_CF, int(85)
|
|
|
|
MCP39F5_TX, int(86)
|
|
|
|
MCP39F5_RX, int(87)
|
|
|
|
MCP39F5_RST, int(88)
|
|
|
|
PN532_TXD, int(89)
|
|
|
|
PN532_RXD, int(90)
|
|
|
|
SM16716_CLK, int(91)
|
|
|
|
SM16716_DAT, int(92)
|
|
|
|
SM16716_SEL, int(93)
|
|
|
|
DI, int(94)
|
|
|
|
DCKI, int(95)
|
|
|
|
CSE7766_TX, int(96)
|
|
|
|
CSE7766_RX, int(97)
|
|
|
|
ARIRFRCV, int(98)
|
|
|
|
ARIRFSEL, int(99)
|
|
|
|
TXD, int(100)
|
|
|
|
RXD, int(101)
|
|
|
|
ROT1A, int(102)
|
|
|
|
ROT1B, int(103)
|
|
|
|
ADC_JOY, int(104)
|
|
|
|
SSPI_MAX31865_CS1, int(105)
|
|
|
|
HRE_CLOCK, int(106)
|
|
|
|
HRE_DATA, int(107)
|
|
|
|
ADE7953_IRQ, int(108)
|
|
|
|
SOLAXX1_TX, int(109)
|
|
|
|
SOLAXX1_RX, int(110)
|
|
|
|
ZIGBEE_TX, int(111)
|
|
|
|
ZIGBEE_RX, int(112)
|
|
|
|
RDM6300_RX, int(113)
|
|
|
|
IBEACON_TX, int(114)
|
|
|
|
IBEACON_RX, int(115)
|
|
|
|
A4988_DIR, int(116)
|
|
|
|
A4988_STP, int(117)
|
|
|
|
A4988_ENA, int(118)
|
|
|
|
A4988_MS1, int(119)
|
|
|
|
OUTPUT_HI, int(120)
|
|
|
|
OUTPUT_LO, int(121)
|
|
|
|
DDS2382_TX, int(122)
|
|
|
|
DDS2382_RX, int(123)
|
|
|
|
DDSU666_TX, int(124)
|
|
|
|
DDSU666_RX, int(125)
|
|
|
|
SM2135_CLK, int(126)
|
|
|
|
SM2135_DAT, int(127)
|
|
|
|
DEEPSLEEP, int(128)
|
|
|
|
EXS_ENABLE, int(129)
|
|
|
|
TASMOTACLIENT_TXD, int(130)
|
|
|
|
TASMOTACLIENT_RXD, int(131)
|
|
|
|
TASMOTACLIENT_RST, int(132)
|
|
|
|
TASMOTACLIENT_RST_INV, int(133)
|
|
|
|
HPMA_RX, int(134)
|
|
|
|
HPMA_TX, int(135)
|
|
|
|
GPS_RX, int(136)
|
|
|
|
GPS_TX, int(137)
|
|
|
|
HM10_RX, int(138)
|
|
|
|
HM10_TX, int(139)
|
|
|
|
LE01MR_RX, int(140)
|
|
|
|
LE01MR_TX, int(141)
|
|
|
|
CC1101_GDO0, int(142)
|
|
|
|
CC1101_GDO2, int(143)
|
|
|
|
HRXL_RX, int(144)
|
|
|
|
ELECTRIQ_MOODL_TX, int(145)
|
|
|
|
AS3935, int(146)
|
|
|
|
ADC_INPUT, int(147)
|
|
|
|
ADC_TEMP, int(148)
|
|
|
|
ADC_LIGHT, int(149)
|
|
|
|
ADC_BUTTON, int(150)
|
|
|
|
ADC_BUTTON_INV, int(151)
|
|
|
|
ADC_RANGE, int(152)
|
|
|
|
ADC_CT_POWER, int(153)
|
|
|
|
WEBCAM_PWDN, int(154)
|
|
|
|
WEBCAM_RESET, int(155)
|
|
|
|
WEBCAM_XCLK, int(156)
|
|
|
|
WEBCAM_SIOD, int(157)
|
|
|
|
WEBCAM_SIOC, int(158)
|
|
|
|
WEBCAM_DATA, int(159)
|
|
|
|
WEBCAM_VSYNC, int(160)
|
|
|
|
WEBCAM_HREF, int(161)
|
|
|
|
WEBCAM_PCLK, int(162)
|
|
|
|
WEBCAM_PSCLK, int(163)
|
|
|
|
WEBCAM_HSD, int(164)
|
|
|
|
WEBCAM_PSRCS, int(165)
|
|
|
|
BOILER_OT_RX, int(166)
|
|
|
|
BOILER_OT_TX, int(167)
|
|
|
|
WINDMETER_SPEED, int(168)
|
|
|
|
KEY1_TC, int(169)
|
|
|
|
BL0940_RX, int(170)
|
|
|
|
TCP_TX, int(171)
|
|
|
|
TCP_RX, int(172)
|
|
|
|
ETH_PHY_POWER, int(173)
|
|
|
|
ETH_PHY_MDC, int(174)
|
|
|
|
ETH_PHY_MDIO, int(175)
|
|
|
|
TELEINFO_RX, int(176)
|
|
|
|
TELEINFO_ENABLE, int(177)
|
|
|
|
LMT01, int(178)
|
|
|
|
IEM3000_TX, int(179)
|
|
|
|
IEM3000_RX, int(180)
|
|
|
|
ZIGBEE_RST, int(181)
|
|
|
|
DYP_RX, int(182)
|
|
|
|
MIEL_HVAC_TX, int(183)
|
|
|
|
MIEL_HVAC_RX, int(184)
|
|
|
|
WE517_TX, int(185)
|
|
|
|
WE517_RX, int(186)
|
|
|
|
AS608_TX, int(187)
|
|
|
|
AS608_RX, int(188)
|
|
|
|
SHELLY_DIMMER_BOOT0, int(189)
|
|
|
|
SHELLY_DIMMER_RST_INV, int(190)
|
|
|
|
RC522_RST, int(191)
|
|
|
|
P9813_CLK, int(192)
|
|
|
|
P9813_DAT, int(193)
|
|
|
|
OPTION_A, int(194)
|
|
|
|
FTC532, int(195)
|
|
|
|
RC522_CS, int(196)
|
|
|
|
NRF24_CS, int(197)
|
|
|
|
NRF24_DC, int(198)
|
|
|
|
ILI9341_CS, int(199)
|
|
|
|
ILI9341_DC, int(200)
|
|
|
|
ILI9488_CS, int(201)
|
|
|
|
EPAPER29_CS, int(202)
|
|
|
|
EPAPER42_CS, int(203)
|
|
|
|
SSD1351_CS, int(204)
|
|
|
|
RA8876_CS, int(205)
|
|
|
|
ST7789_CS, int(206)
|
|
|
|
ST7789_DC, int(207)
|
|
|
|
SSD1331_CS, int(208)
|
|
|
|
SSD1331_DC, int(209)
|
|
|
|
SDCARD_CS, int(210)
|
|
|
|
ROT1A_NP, int(211)
|
|
|
|
ROT1B_NP, int(212)
|
|
|
|
ADC_PH, int(213)
|
|
|
|
BS814_CLK, int(214)
|
|
|
|
BS814_DAT, int(215)
|
|
|
|
WIEGAND_D0, int(216)
|
|
|
|
WIEGAND_D1, int(217)
|
|
|
|
NEOPOOL_TX, int(218)
|
|
|
|
NEOPOOL_RX, int(219)
|
|
|
|
SDM72_TX, int(220)
|
|
|
|
SDM72_RX, int(221)
|
|
|
|
TM1637CLK, int(222)
|
|
|
|
TM1637DIO, int(223)
|
|
|
|
PROJECTOR_CTRL_TX, int(224)
|
|
|
|
PROJECTOR_CTRL_RX, int(225)
|
|
|
|
SSD1351_DC, int(226)
|
|
|
|
XPT2046_CS, int(227)
|
|
|
|
CSE7761_TX, int(228)
|
|
|
|
CSE7761_RX, int(229)
|
|
|
|
VL53L0X_XSHUT1, int(230)
|
|
|
|
MAX7219CLK, int(231)
|
|
|
|
MAX7219DIN, int(232)
|
|
|
|
MAX7219CS, int(233)
|
|
|
|
TFMINIPLUS_TX, int(234)
|
|
|
|
TFMINIPLUS_RX, int(235)
|
|
|
|
ZEROCROSS, int(236)
|
|
|
|
HALLEFFECT, int(237)
|
2021-04-21 09:05:10 +01:00
|
|
|
EPD_DATA, int(238)
|
|
|
|
INPUT, int(239)
|
2021-07-20 20:05:10 +01:00
|
|
|
KEY1_PD, int(240)
|
|
|
|
KEY1_INV_PD, int(241)
|
|
|
|
SWT1_PD, int(242)
|
|
|
|
I2S_OUT_DATA, int(243)
|
|
|
|
I2S_OUT_CLK, int(244)
|
|
|
|
I2S_OUT_SLCT, int(245)
|
|
|
|
I2S_IN_DATA, int(246)
|
|
|
|
I2S_IN_CLK, int(247)
|
|
|
|
I2S_IN_SLCT, int(248)
|
|
|
|
INTERRUPT, int(249)
|
|
|
|
|
|
|
|
SENSOR_END, int(250)
|
2021-04-03 17:06:40 +01:00
|
|
|
|
|
|
|
pin_mode, func(gp_pin_mode)
|
|
|
|
digital_write, func(gp_digital_write)
|
|
|
|
digital_read, func(gp_digital_read)
|
2021-09-13 12:44:39 +01:00
|
|
|
dac_voltage, func(gp_dac_voltage)
|
2021-04-03 17:06:40 +01:00
|
|
|
|
|
|
|
pin_used, func(gp_pin_used)
|
|
|
|
pin, func(gp_pin)
|
|
|
|
}
|
|
|
|
@const_object_info_end */
|
|
|
|
#include "../generate/be_fixed_gpio.h"
|