V1
ihm_L476.h@3:1fb93eb764ac, 2020-05-15 (annotated)
- Committer:
- gr91
- Date:
- Fri May 15 14:33:04 2020 +0000
- Revision:
- 3:1fb93eb764ac
- Parent:
- 2:fb23524feda5
Version 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
slowness | 1:9b234695c10f | 1 | /// @file IHM_L476.h Bibliothéque de classe pour la carte L476 compatible IHM NBOARD |
slowness | 1:9b234695c10f | 2 | /// @mainpage |
slowness | 1:9b234695c10f | 3 | /// |
slowness | 1:9b234695c10f | 4 | /// |
slowness | 1:9b234695c10f | 5 | /// |
slowness | 1:9b234695c10f | 6 | /// @author Bruno LARNAUDIE, IUT Cachan |
slowness | 1:9b234695c10f | 7 | /// |
slowness | 1:9b234695c10f | 8 | /// @note |
slowness | 1:9b234695c10f | 9 | /// History |
slowness | 1:9b234695c10f | 10 | /// v3.00 31/10/2019 |
slowness | 0:d67999aa55a3 | 11 | |
gr91 | 3:1fb93eb764ac | 12 | //#include "mbed.h" |
slowness | 0:d67999aa55a3 | 13 | #include "LCD_DISCO_L476VG.h" |
slowness | 0:d67999aa55a3 | 14 | #include "stm32l476g_discovery_glass_lcd.h" |
slowness | 0:d67999aa55a3 | 15 | #include "lcd.h" |
slowness | 0:d67999aa55a3 | 16 | |
slowness | 1:9b234695c10f | 17 | // |
slowness | 1:9b234695c10f | 18 | /// |
slowness | 1:9b234695c10f | 19 | /// Example: |
slowness | 1:9b234695c10f | 20 | /// @code |
slowness | 1:9b234695c10f | 21 | /// #include "ihm_L476.h" |
slowness | 1:9b234695c10f | 22 | /// |
slowness | 1:9b234695c10f | 23 | /// IHM_L476 ihm; // Déclaration de l'objet lcd permettant d'utiliser l'écran LCD |
slowness | 1:9b234695c10f | 24 | /// |
slowness | 1:9b234695c10f | 25 | /// //-------- 2 LED (verte / rouge) seulement sur la Disco L476 (+ bargraph de 4 barres sur le LCD) |
slowness | 1:9b234695c10f | 26 | /// DigitalOut led_green(PE_8); |
slowness | 1:9b234695c10f | 27 | /// // Définir ici l'objet led rouge voir sur le board pinout à l'adresse suivante: https://os.mbed.com/platforms/ST-Discovery-L476VG/ |
slowness | 1:9b234695c10f | 28 | /// |
slowness | 1:9b234695c10f | 29 | /// //------------- les 5 BP du joystick (attention : celui du milieu est câblé différemment !) |
slowness | 1:9b234695c10f | 30 | /// DigitalIn central(PA_0, PullNone); // le BP central du joystick a une Res EXTERNE de PullDown (1 si enfoncé) -> PullNone (ou PullDown) |
slowness | 1:9b234695c10f | 31 | /// // PA_0 ou USER_BUTTON |
slowness | 1:9b234695c10f | 32 | /// // Définir ici les objets boutons droite, haut et bas de la même facon que pour l'objet gauche |
slowness | 1:9b234695c10f | 33 | /// // voir sur le board pinout à l'adresse suivante: https://os.mbed.com/platforms/ST-Discovery-L476VG/ |
slowness | 1:9b234695c10f | 34 | /// |
slowness | 1:9b234695c10f | 35 | /// int main() |
slowness | 1:9b234695c10f | 36 | /// { |
slowness | 1:9b234695c10f | 37 | /// unsigned char compteur=0; |
slowness | 1:9b234695c10f | 38 | /// |
slowness | 1:9b234695c10f | 39 | /// ihm.LCD_printf("HELLO "); // affichage sur l'afficheur lcd |
slowness | 1:9b234695c10f | 40 | /// wait(3); // attente de 3 seconde |
slowness | 1:9b234695c10f | 41 | /// ihm.LCD_printf("Programme d'exemple de la carte L476"); |
slowness | 1:9b234695c10f | 42 | /// wait(10); // attente de 10 seconde |
slowness | 1:9b234695c10f | 43 | /// ihm.LCD_clear(); // efface l'écran |
slowness | 1:9b234695c10f | 44 | /// |
slowness | 1:9b234695c10f | 45 | /// while (true) { // boule infinie. Equivalent à: while(1) |
slowness | 1:9b234695c10f | 46 | /// led_green = !led_green; // change l'état de la led |
slowness | 1:9b234695c10f | 47 | /// ihm.LCD_printf("%03d:%02xh",compteur,compteur); // Affichage sur le ihm du compteur en décimal et hexa |
slowness | 1:9b234695c10f | 48 | /// ihm.BAR_set(compteur); // Affichage sur le bargraphe de l'écran |
slowness | 1:9b234695c10f | 49 | /// wait(1); // attente 1 seconde |
slowness | 1:9b234695c10f | 50 | /// if (central) |
slowness | 1:9b234695c10f | 51 | /// compteur=0; // LED s'allume à 1 / BP enfoncé à 1 |
slowness | 1:9b234695c10f | 52 | /// else |
slowness | 1:9b234695c10f | 53 | /// compteur++; // incrémente le compteur. Equivalent à: compteur=compteur+1; |
slowness | 1:9b234695c10f | 54 | /// } |
slowness | 1:9b234695c10f | 55 | /// } |
slowness | 1:9b234695c10f | 56 | /// @endcode |
slowness | 1:9b234695c10f | 57 | /// |
slowness | 1:9b234695c10f | 58 | |
slowness | 0:d67999aa55a3 | 59 | class IHM_L476 |
slowness | 0:d67999aa55a3 | 60 | { |
slowness | 0:d67999aa55a3 | 61 | public: |
slowness | 1:9b234695c10f | 62 | /// Constructeur pour l'IHM de la carte L476, placé à l'extérieur du main |
slowness | 1:9b234695c10f | 63 | /// |
slowness | 0:d67999aa55a3 | 64 | IHM_L476(); |
slowness | 0:d67999aa55a3 | 65 | |
slowness | 0:d67999aa55a3 | 66 | ~IHM_L476(); |
slowness | 1:9b234695c10f | 67 | /// commande des 4 leds du bargraph sur le lcd |
slowness | 1:9b234695c10f | 68 | /// |
slowness | 1:9b234695c10f | 69 | /// Affiche la valeur passée en argument sur le bargraph |
slowness | 1:9b234695c10f | 70 | /// @param valeur à afficher sur le bargraph |
slowness | 1:9b234695c10f | 71 | /// @returns void |
slowness | 1:9b234695c10f | 72 | /// |
slowness | 0:d67999aa55a3 | 73 | void BAR_set(unsigned char valeur); |
slowness | 0:d67999aa55a3 | 74 | |
slowness | 1:9b234695c10f | 75 | /// effacement de l'afficheur LCD |
slowness | 1:9b234695c10f | 76 | /// |
slowness | 1:9b234695c10f | 77 | /// @param void |
slowness | 1:9b234695c10f | 78 | /// @returns void |
slowness | 1:9b234695c10f | 79 | /// |
slowness | 0:d67999aa55a3 | 80 | void LCD_clear(void); |
slowness | 0:d67999aa55a3 | 81 | |
slowness | 1:9b234695c10f | 82 | /// écriture formatée sur l'afficheur LCD |
slowness | 1:9b234695c10f | 83 | /// si affichage de plus de 6 caractéres |
slowness | 1:9b234695c10f | 84 | /// alors l'affichage se met en mode défilement |
slowness | 1:9b234695c10f | 85 | /// @param format... |
slowness | 1:9b234695c10f | 86 | /// @returns void |
slowness | 1:9b234695c10f | 87 | /// |
slowness | 0:d67999aa55a3 | 88 | void LCD_printf(const char* format, ...); |
slowness | 0:d67999aa55a3 | 89 | |
slowness | 0:d67999aa55a3 | 90 | private: |
slowness | 0:d67999aa55a3 | 91 | |
slowness | 0:d67999aa55a3 | 92 | }; |
slowness | 0:d67999aa55a3 | 93 | |
slowness | 0:d67999aa55a3 | 94 | |
slowness | 0:d67999aa55a3 | 95 | void BSP_LCD_GLASS_CLEAR_WITHOUT_BAR(void); |
slowness | 0:d67999aa55a3 | 96 | |
slowness | 0:d67999aa55a3 | 97 | void BSP_LCD_GLASS_SetBar(uint8_t Value); |
slowness | 0:d67999aa55a3 | 98 | |
slowness | 0:d67999aa55a3 | 99 | void BSP_LCD_GLASS_DisplayString_iut_cachan(uint8_t *ptr); |
slowness | 0:d67999aa55a3 | 100 | |
slowness | 0:d67999aa55a3 | 101 | void BSP_LCD_GLASS_ScrollSentence_iut_cachan(uint8_t* ptr, uint8_t size, uint16_t nScroll, uint16_t ScrollSpeed); |
slowness | 0:d67999aa55a3 | 102 | |
slowness | 0:d67999aa55a3 | 103 | void Decalage_sentence(void); |
slowness | 0:d67999aa55a3 | 104 | |
slowness | 0:d67999aa55a3 | 105 | extern uint8_t Global_Bar_Value; |
slowness | 0:d67999aa55a3 | 106 | |
slowness | 0:d67999aa55a3 | 107 | extern LCD_HandleTypeDef LCDHandle; |
slowness | 0:d67999aa55a3 | 108 | |
slowness | 0:d67999aa55a3 | 109 | extern const uint16_t CapLetterMap[26]; |
slowness | 0:d67999aa55a3 | 110 | |
slowness | 0:d67999aa55a3 | 111 | extern const uint16_t NumberMap[10]; |
slowness | 0:d67999aa55a3 | 112 | |
slowness | 0:d67999aa55a3 | 113 | extern uint32_t Digit[4]; /* Digit frame buffer */ |
slowness | 0:d67999aa55a3 | 114 | |
slowness | 0:d67999aa55a3 | 115 | extern uint8_t LCDBar; |
slowness | 0:d67999aa55a3 | 116 |