return callback handler

This commit is contained in:
Siwat Sirichai 2023-12-31 13:32:38 +07:00
parent 5f6e586945
commit 724f8f42e9
8 changed files with 20 additions and 15 deletions

View file

@ -65,8 +65,9 @@ void AnalogIoT::setADCsPublishEnabled(bool enabled) {
adc_publish_enabled[i] = enabled;
}
}
void AnalogIoT::registerADCConversionCallback(std::function<void(uint8_t, uint16_t)> callback) {
this->adc_conversion_callbacks[this->adc_conversion_callback_index++] = callback;
uint8_t AnalogIoT::registerADCConversionCallback(std::function<void(uint8_t, uint16_t)> callback) {
this->adc_conversion_callbacks[this->adc_conversion_callback_index] = callback;
return this->adc_conversion_callback_index++;
}
void AnalogIoT::deregisterADCConversionCallback(uint8_t handler) {
this->adc_conversion_callbacks.erase(handler);