MCPcopy Create free account
hub / github.com/FastLED/FastLED / stub_attach_external_handler

Function stub_attach_external_handler

src/platforms/stub/isr_stub.hpp:319–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319inline int stub_attach_external_handler(u8 pin, const isr_config_t& config, isr_handle_t* out_handle) FL_NOEXCEPT {
320 (void)pin; // Unused in stub implementation
321 if (!config.handler) {
322 STUB_LOG("attachExternalHandler: handler is null");
323 return -1; // Invalid parameter
324 }
325
326 // Allocate handle data
327 auto handle_owner = fl::make_unique<stub_isr_handle_data>();
328 auto* handle_data = handle_owner.get();
329 if (!handle_data) {
330 STUB_LOG("attachExternalHandler: failed to allocate handle data");
331 return -3; // Out of memory
332 }
333
334 handle_data->mIsTimer = false;
335 handle_data->mUserHandler = config.handler;
336 handle_data->mUserData = config.user_data;
337
338 //STUB_LOG("GPIO interrupt attached on pin " << static_cast<int>(pin));
339
340 // Release ownership - pointer is now managed by the C API (out_handle)
341 handle_owner.release();
342
343 // Populate output handle
344 if (out_handle) {
345 out_handle->platform_handle = handle_data;
346 out_handle->handler = config.handler;
347 out_handle->user_data = config.user_data;
348 out_handle->platform_id = STUB_PLATFORM_ID;
349 }
350
351 return 0; // Success
352}
353
354inline int stub_detach_handler(isr_handle_t& handle) FL_NOEXCEPT {
355 if (!handle.is_valid() || handle.platform_id != STUB_PLATFORM_ID) {

Callers 1

attach_external_handlerFunction · 0.85

Calls 2

getMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected