am13e23019-gpio-led-blink.ino

BeagleConnect QuadESC: 4-Channel BLDC Controller · File : am13e23019-gpio-led-blink.ino · Language : C · Use case : Faire clignoter une LED via GPIO pour valider l'initialisation du système.

Minimalist example of TI SDK GPIO driver initialization to control a digital output.

Uses TI AM13E2X SDK. Verify the physical LED pin on the BeagleConnect Torque schematic. Compile with the SDK makefile and flash via JTAG/SWD. Requires prior system clock initialization.

am13e23019-gpio-led-blink.ino

#include <ti/devices/am13e2x/inc/am13e2x.h>
#include <ti/drv/gpio/gpio.h>
#include <ti/drv/gpio/soc/GPIO_soc.h>
#include <ti/drv/uart/UART.h>
#include <ti/drv/uart/UART_stdio.h>

#define LED_PIN 0 // Supposons que la LED est sur GPIO0

void blink_task(void *args) {
    GPIO_Handle handle;
    GPIO_Params params;
    GPIO_Params_init(&params);
    params.pinDirection = GPIO_OUTPUT;
    
    handle = GPIO_open(GPIO_PORT0, &params);
    if (handle == NULL) {
        UART_printf("Erreur d'ouverture GPIO\n");
        return;
    }

    while (1) {
        GPIO_write(handle, 1);
        delay_ms(500);
        GPIO_write(handle, 0);
        delay_ms(500);
    }
}

int main(void) {
    // Initialisation du système (horloges, etc.) typique du SDK TI
    // SysCtl_clockInit(); 
    
    UART_init();
    UART_printf("Démarrage test GPIO\n");
    
    // Création de la tâche ou appel direct selon l'OS (ici simplifié)
    blink_task(NULL);
    
    return 0;
}

← Back to the board