am13e23019-gpio-led-blink.ino
Exemple minimaliste d'initialisation du pilote GPIO du SDK TI pour contrôler une sortie numérique.
Utilise le SDK TI AM13E2X. Vérifiez la broche physique de la LED sur le schéma du BeagleConnect Torque. Compilez avec le makefile du SDK et flashez via JTAG/SWD. Nécessite l'initialisation préalable des horloges système.
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(¶ms);
params.pinDirection = GPIO_OUTPUT;
handle = GPIO_open(GPIO_PORT0, ¶ms);
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;
}