2023-10-22 16:48:14 +00:00
|
|
|
/*****
|
2024-08-15 00:20:18 +00:00
|
|
|
* Copyright (c) 2024 - Poivron Robotique
|
2023-10-22 16:48:14 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
#include "pico/stdlib.h"
|
2024-08-15 00:20:18 +00:00
|
|
|
#include "Teleplot.h"
|
2025-01-04 17:08:56 +00:00
|
|
|
#include "Temps.h"
|
2023-10-22 16:48:14 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2024-08-15 00:20:18 +00:00
|
|
|
void setup(void);
|
|
|
|
void loop(void);
|
|
|
|
|
2025-01-04 17:08:56 +00:00
|
|
|
int valeur = 1;
|
|
|
|
|
2023-10-22 16:48:14 +00:00
|
|
|
void main(void)
|
|
|
|
{
|
2024-08-15 00:20:18 +00:00
|
|
|
setup();
|
2023-10-22 16:48:14 +00:00
|
|
|
while(1){
|
2024-08-15 00:20:18 +00:00
|
|
|
loop();
|
2023-10-22 16:48:14 +00:00
|
|
|
}
|
|
|
|
}
|
2024-08-15 00:20:18 +00:00
|
|
|
|
|
|
|
void setup(void){
|
|
|
|
stdio_init_all();
|
|
|
|
Teleplot_init();
|
2025-01-04 17:08:56 +00:00
|
|
|
Temps_init();
|
2025-01-04 17:49:19 +00:00
|
|
|
|
2025-01-04 17:49:19 +00:00
|
|
|
// Broches des codeur gérées en GPIO
|
|
|
|
gpio_init(11); // Codeur 1, voie A
|
|
|
|
gpio_init(12); // Codeur 1, voie B
|
|
|
|
gpio_init(2); // Codeur 2, voie A
|
|
|
|
gpio_init(3); // Codeur 2, voie B
|
|
|
|
|
|
|
|
// Broches des codeur en entrée
|
|
|
|
gpio_set_dir(11, false); // Codeur 1, voie A
|
|
|
|
gpio_set_dir(12, false); // Codeur 1, voie B
|
|
|
|
gpio_set_dir(2, false); // Codeur 2, voie A
|
|
|
|
gpio_set_dir(3, false); // Codeur 2, voie B
|
2024-08-15 00:20:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop(void){
|
2025-01-04 17:49:19 +00:00
|
|
|
Teleplot_add_variable_int("Codeur1_A", gpio_get(11));
|
|
|
|
Teleplot_add_variable_int("Codeur1_B", gpio_get(12));
|
|
|
|
Teleplot_add_variable_int("Codeur2_A", gpio_get(2));
|
|
|
|
Teleplot_add_variable_int("Codeur2_B", gpio_get(3));
|
|
|
|
Teleplot_envoie_tampon();
|
2024-08-15 00:20:18 +00:00
|
|
|
}
|