8.1.4. How to Use the FTASK Module¶
8.1.4.1. Adding a Simple Functionality to a Task¶
This simple example shows how to add a blinking LED every 100ms (assuming the hardware supports this feature) and incrementing a counter from a database variable:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | void FTSK_UserCodeCyclic100ms(void) {
    /* user code */
    static uint32_t ftsk_cyclic_100ms_counter                = 0;
    static DATA_BLOCK_EXAMPLE_s ftsk_tableExampleCyclic100ms = {.header.uniqueId = DATA_BLOCK_ID_EXAMPLE};
    if ((ftsk_cyclic_100ms_counter % 10u) == 0u) {
        gioSetBit(gioPORTB, 6, gioGetBit(gioPORTB, 6) ^ 1);
    }
    DATA_READ_DATA(&ftsk_tableExampleCyclic100ms);
    ftsk_tableExampleCyclic100ms.dummyValue++;
    DATA_WRITE_DATA(&ftsk_tableExampleCyclic100ms);
    ftsk_cyclic_100ms_counter++;
}
 | 
8.1.4.2. Further Reading¶
Implementation details of the FTASK module are found in FTASK Module.
