[C++] Polymorphism ⑦ (Polymorphism mechanism implementation principle | Virtual function table concept | Virtual function table working mechanism | vptr pointer | Virtual function table runtime mechanism | Virtual function and dynamic binding)

Article directory 1. The principle of polymorphism 1. Three conditions for polymorphism to be established 2. The concept of virtual function table 3. Working mechanism of virtual function table 4. vptr pointer 5. Virtual function table runtime mechanism 6. Virtual functions and dynamic binding 2. Code example – virtual function table 1. Code example analysis […]

Vue data binding and data rendering

Table of Contents 1. Quick Start with Vue 1 Introduction : 2.MVVM: 3. Preparation work: 2. Data binding 1.Example: 2.Verification: 3. Data rendering 1. One-way rendering: 2. Bidirectional rendering: 4. Event binding 1 Introduction : 2.Example: 5. Modifiers 1 Introduction : 2.Example: 3.Extension: 1. Quick Start with Vue 1. Introduction: (1) Vue[/vju/], short for Vue.js, […]

LED uses the step-by-step implementation of character device drivers to write LED drivers, and also implements binding of special files and devices.

head.h #ifndef __HEAD_H__ #define __HEAD_H__ #define PHY_LED13_MODER 0x50006000 //[20 21]/[16 17] >01 #define PHY_LED13_ODR 0x50006014 // [10]/[8] #define PHY_LED2_MODER 0x50007000 //[20 21] >01 #define PHY_LED2_ODR 0x50007014 //10 #define PHY_RCC 0x50000A28 //4 5 bits #define LED_ON _IOW(‘l’,1,int *) #define LED_OFF _IOW(‘l’,0,int *) #endif text.c #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <fcntl.h> #include <unistd.h> […]

Write the LED driver through the step-by-step implementation of the character device driver, and also implement the binding of special files and devices

Header file .h file #ifndef __HEAD_H__ #define __HEAD_H__ typedef struct { unsigned int MODER; unsigned int OTYPER; unsigned int OSPEEDR; unsigned int PUPDR; unsigned int IDR; unsigned int ODR; } gpio_t; #define PHY_LED1_ADDR 0X50006000 #define PHY_LED2_ADDR 0X50007000 #define PHY_LED3_ADDR 0X50006000 #define PHY_RCC_ADDR 0X50000A28 // Construct the function code to turn the lights on and off […]

Step by step implementation of writing LED drivers and binding of special files and devices

Write the LED driver through the step-by-step implementation of the character device driver, and also implement the binding of special files and devices, and publish it to CSDN head.h #ifndef __HEAD_H__ #define __HEAD_H__ typedef struct { unsigned int MODER; unsigned int OTYPER; unsigned int OSPEEDR; unsigned int PUPDR; unsigned int IDR; unsigned int ODR; } […]

Write LED drivers separately through character device drivers to achieve binding of special files and devices.

#include <linux/init.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/io.h> #include <linux/device.h> #include <linux/cdev.h> #include <linux/slab.h> #include “head.h” struct cdev *cdev; unsigned int major = 0; unsigned int minor = 0; dev_t devno; char kbuf[128] = {0}; gpio_t *vir_led1; gpio_t *vir_led2; gpio_t *vir_led3; unsigned int *vir_rcc; struct class *cls; struct device *dev; int mycdev_open(struct inode *inode, struct […]

[Driver Development] Turning the LED light on and off – writing the LED driver through the step-by-step implementation of the character device driver, and realizing the binding of device files and devices

Header file: #ifndef __HEAD_H__ #define __HEAD_H__ typedef struct { unsigned int MODER; unsigned int OTYPER; unsigned int OSPEEDR; unsigned int PUPDR; unsigned int IDR; unsigned int ODR; }gpio_t; //Register address of LED light #define LED1_ADDR 0X50006000 #define LED2_ADDR 0X50007000 #define LED3_ADDR 0X50006000 #define RCC_ADDR 0X50000A28 //Construct the function code of the LED switch, the third […]

Binding rules of this in front-end js 04

Hey, come on Article directory 1. this? 2. The direction of this 3. Default binding (independent function call) 4. Implicit binding 5. Explicit binding (apply call bind) 6. New binding (more details will be added later) 7. Differences between apply call bind 8. Thoughts on binding of built-in functions 9. Rule priority 10. Description 11. […]

Driver development LED light binding device file

head File #ifndef __HEAD_H__ #define __HEAD_H__ typedef struct { unsigned int MODER; unsigned int OTYPER; unsigned int OSPEEDR; unsigned int PUPDR; unsigned int IDR; unsigned int ODR; }gpio_t; #define PHY_LED1_ADDR 0x50006000 #define PHY_LED2_ADDR 0x50007000 #define PHY_LED3_ADDR 0x50006000 #define PHY_RCC_ADDR 0x50000A28 #define LED_ON _IOW(‘l’,1,int) #define LED_OFF _IOW(‘l’,0,int) #endif app #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include […]