Exercise Performance - JawaharT/Best-Practices-On-Azure-Sphere GitHub Wiki

Exercises for Performance

In general, these exercises use a variety of the topics discussed as part of the 'How: Performance' section such as an example of using a built-in function and an Azure Sphere based exercise.

Exercise one

In the first exercise, we will create a program that will check if a sequence is alphanumeric. To find out what an alphanumeric character is click here.

#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(){
    // Equivalent input from an embedded system, max 8 chars
    char display_text[8] = "chj2";
    
    // Alphanumeric logic

    return 0;
}

Exercise two

In the second exercise we will develop the logic to initialise file descriptors of peripherals and event handlers. The tasks below require the AVNET MT3620 Azure Sphere board and the commented notes will help provide guidance on the tasks.

int epollFd = -1;
static int buttonPollTimerFd = -1;
static int buttonAGpioFd = -1;
static int buttonBGpioFd = -1;

// Will return 0 on success or -1 on failure
static int InitPeripheralsAndHandlers(void){

    // Task 1: Create Instance of CreateEpollFd


    // Task 2: Open button A GPIO as input


    // Task 3: Set up a timer to poll the buttons (in seconds)
    

    return 0;
}

For a version of the correct solutions and explanations to both exercises click here.

⚠️ **GitHub.com Fallback** ⚠️