components/mcp23s17/MCP23S17.cpp
/**
 * Run task for this instance.
 */
Run task for this instance.
Run task for this instance .
void MCP23S17::run()
{
    ESP_LOGD(TAG, "run, this:%p", this);
    pubsub_message_t message;
    while (true) {
        while (xQueueReceive(queue, &message, portMAX_DELAY)) {
            for (int topic_index = 0; topic_index < 16; topic_index++) {
                if (strcmp(message.topic, topics[topic_index]) == 0) {
                    bool value = message.boolean_val;
                    if (value) {
                        output_state |= BIT_ON[topic_index];
                    } else {
                        output_state &= BIT_OFF[topic_index];
                    }
                    write_word(GPIOA, output_state);
                }
            }
        };
    };
}
void MCP23S17 :: run ( ) { ESP_LOGD ( TAG , " " , this ) ; pubsub_message_t message ; while ( true ) { while ( xQueueReceive ( queue , & message , portMAX_DELAY ) ) { for ( int topic_index = 0 ; topic_index < 16 ; topic_index ++ ) { if ( strcmp ( message . topic , topics [ topic_index ] ) == 0 ) { bool value = message . boolean_val ; if ( value ) { output_state |= BIT_ON [ topic_index ] ; } else { output_state &= BIT_OFF [ topic_index ] ; } write_word ( GPIOA , output_state ) ; } } } ; } ; }
Run task for this instance.
Run task for this instance .
// wait for output messages // found // write GPIOA + GPIOB