mirror of https://github.com/arendst/Tasmota.git
Berry `gpio.get_pin_type` and `gpio.ger_pin_type_index` (#20415)
This commit is contained in:
parent
ec75462905
commit
bd9a99caff
|
@ -9,6 +9,8 @@ All notable changes to this project will be documented in this file.
|
||||||
- Berry add support for `tcpclientasync` in `tcpserver` (#20401)
|
- Berry add support for `tcpclientasync` in `tcpserver` (#20401)
|
||||||
- Berry add `tasmota.urlbecload(url:string) -> bool` (#20412)
|
- Berry add `tasmota.urlbecload(url:string) -> bool` (#20412)
|
||||||
- GPIO Viewer to see realtime GPIO states. Enable with define USE_GPIO_VIEWER
|
- GPIO Viewer to see realtime GPIO states. Enable with define USE_GPIO_VIEWER
|
||||||
|
- Berry `gpio.read_pwm` and `gpio.read_pwm_resolution`
|
||||||
|
- Berry `gpio.get_pin_type` and `gpio.ger_pin_type_index`
|
||||||
- Berry `gpio.read_pwm` and `gpio.read_pwm_resolution` (#20414)
|
- Berry `gpio.read_pwm` and `gpio.read_pwm_resolution` (#20414)
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
|
@ -22,6 +22,9 @@ extern int gp_counter_add(bvm *vm);
|
||||||
extern int gp_pin_used(bvm *vm);
|
extern int gp_pin_used(bvm *vm);
|
||||||
extern int gp_pin(bvm *vm);
|
extern int gp_pin(bvm *vm);
|
||||||
|
|
||||||
|
extern int gp_get_pin(int32_t pin); BE_FUNC_CTYPE_DECLARE(gp_get_pin, "i", "i");
|
||||||
|
extern int gp_get_pin_index(int32_t pin); BE_FUNC_CTYPE_DECLARE(gp_get_pin_index, "i", "i");
|
||||||
|
|
||||||
// esp_err_tledc_set_duty_and_update(ledc_mode_tspeed_mode, ledc_channel_tchannel, uint32_t duty, uint32_t hpoint)
|
// esp_err_tledc_set_duty_and_update(ledc_mode_tspeed_mode, ledc_channel_tchannel, uint32_t duty, uint32_t hpoint)
|
||||||
extern void gp_set_duty(int32_t pin, int32_t duty, int32_t hpoint); BE_FUNC_CTYPE_DECLARE(gp_set_duty, "", "ii[i]");
|
extern void gp_set_duty(int32_t pin, int32_t duty, int32_t hpoint); BE_FUNC_CTYPE_DECLARE(gp_set_duty, "", "ii[i]");
|
||||||
|
|
||||||
|
@ -33,6 +36,8 @@ module gpio (scope: global) {
|
||||||
member, func(gp_member)
|
member, func(gp_member)
|
||||||
|
|
||||||
pin_mode, func(gp_pin_mode)
|
pin_mode, func(gp_pin_mode)
|
||||||
|
get_pin_type, ctype_func(gp_get_pin)
|
||||||
|
get_pin_type_index, ctype_func(gp_get_pin_index)
|
||||||
digital_write, func(gp_digital_write)
|
digital_write, func(gp_digital_write)
|
||||||
digital_read, func(gp_digital_read)
|
digital_read, func(gp_digital_read)
|
||||||
dac_voltage, func(gp_dac_voltage)
|
dac_voltage, func(gp_dac_voltage)
|
||||||
|
|
|
@ -324,8 +324,25 @@ extern "C" {
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// extern void gp_get_duty(int32_t pin); BE_FUNC_CTYPE_DECLARE(gp_get_duty, "i", "i");
|
|
||||||
// extern void gp_get_duty_resolution(int32_t pin); BE_FUNC_CTYPE_DECLARE(gp_get_duty_resolution, "i", "i");
|
// gpio.get_pin_type(phy_gpio:int) -> int
|
||||||
|
//
|
||||||
|
// Get the type configured for physical GPIO
|
||||||
|
// Return 0 if GPIO is not configured
|
||||||
|
extern int gp_get_pin(int32_t pin);
|
||||||
|
extern int gp_get_pin(int32_t pin) {
|
||||||
|
return GetPin(pin) / 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
// gpio.get_pin_type_index(phy_gpio:int) -> int
|
||||||
|
//
|
||||||
|
// Get the sub-index for the type configured for physical GPIO
|
||||||
|
// Return 0 if GPIO is not configured
|
||||||
|
extern int gp_get_pin_index(int32_t pin);
|
||||||
|
extern int gp_get_pin_index(int32_t pin) {
|
||||||
|
return GetPin(pin) % 32;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_BERRY
|
#endif // USE_BERRY
|
||||||
|
|
Loading…
Reference in New Issue