Cours:PiPico : Différence entre versions

De troyesGEII
Aller à : navigation, rechercher
Ligne 3 : Ligne 3 :
 
https://datasheets.raspberrypi.com/pico/Pico-R3-A4-Pinout.pdf
 
https://datasheets.raspberrypi.com/pico/Pico-R3-A4-Pinout.pdf
  
=Créer/configurer un projet vscode=
+
=Créer/configurer un projet VScode ou QtCreator=
 
*pico_project.py
 
*pico_project.py
 
**git clone https://github.com/raspberrypi/pico-project-generator.git
 
**git clone https://github.com/raspberrypi/pico-project-generator.git
 
** ./pico_project.py --gui
 
** ./pico_project.py --gui
 
**ne pas cocher "create VSCode project"
 
**ne pas cocher "create VSCode project"
 +
 +
Ensuite :
 
* Dans VSCode, ouvrir le dossier contenant le projet (''ie'' le fichier <code>CMakeLists.txt</code>), en sélectionnant <code>GCC for arm-none-eabi</code> commme compilateur dans le menu déroulant de configuration du projet.
 
* Dans VSCode, ouvrir le dossier contenant le projet (''ie'' le fichier <code>CMakeLists.txt</code>), en sélectionnant <code>GCC for arm-none-eabi</code> commme compilateur dans le menu déroulant de configuration du projet.
 +
* alternativement dans QtCreator, ouvrir (comme projet) le fichier ''CMakeLists.txt''
  
 
=GPIO=
 
=GPIO=

Version du 30 novembre 2022 à 16:40

Brochage

https://datasheets.raspberrypi.com/pico/Pico-R3-A4-Pinout.pdf

Créer/configurer un projet VScode ou QtCreator

Ensuite :

  • Dans VSCode, ouvrir le dossier contenant le projet (ie le fichier CMakeLists.txt), en sélectionnant GCC for arm-none-eabi commme compilateur dans le menu déroulant de configuration du projet.
  • alternativement dans QtCreator, ouvrir (comme projet) le fichier CMakeLists.txt

GPIO

https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__gpio.html

Syntaxe void gpio_init(uint gpio)
Paramètres
gpio numéro de gpio
  • gpio_put(LED_PIN, 1);
  • gpio_set_dir(LED_PIN, GPIO_OUT);
  • gpio_set_pulls (uint gpio, bool up, bool down)

Pwm

  • gpio_set_function(PICO_DEFAULT_LED_PIN, GPIO_FUNC_PWM);
  • uint slice_num = pwm_gpio_to_slice_num(PICO_DEFAULT_LED_PIN);
  • pwm_config config = pwm_get_default_config();
  • pwm_config_set_clkdiv(&config, 4.f);
  • pwm_init(slice_num, &config, true);
  • pwm_set_gpio_level(PICO_DEFAULT_LED_PIN, fade * fade); // rapport cyclique 16 bits


liens