For embedded applications, the simplest test is to light up the LED. Now I will do an experiment to light up the LED using GPIO. From the limited information, CH2601 uses the E906 core and the system bus interface supports the AMBA3.0 AHB-Lite protocol. The bus is an open on-chip bus standard proposed by ARM. It is independent of the processor and process technology and has the characteristics of high speed and low power consumption. In other words, the operation of the peripherals is similar to that of ARM-type MCUs. But I was wrong. There are still some differences. The specific operation process is: set the MUX multiplexer to connect the GPIO functions of the pin and the pin, and then initialize the GPIO interface. Then specify the GPIO direction, and then the GPIO pin can be used. Since there is not much information, it is mainly for reference to the example code.
csi_pin_set_mux(PA7, PIN_FUNC_GPIO); //Red LED
csi_pin_set_mux(PA25, PIN_FUNC_GPIO); //Green LED
csi_pin_set_mux(PA4, PIN_FUNC_GPIO); //Blue LED
csi_gpio_pin_init(&pin_led_red, PA7);
csi_gpio_pin_dir(&pin_led_red, GPIO_DIRECTION_OUTPUT);
csi_gpio_pin_init(&pin_led_green, PA25);
csi_gpio_pin_dir(&pin_led_green, GPIO_DIRECTION_OUTPUT);
csi_gpio_pin_init(&pin_led_blue, PA4);
csi_gpio_pin_dir(&pin_led_blue, GPIO_DIRECTION_OUTPUT);
First, according to the schematic diagram
Know the pin correspondence of the three-color LEDs LED_RED, LED_GREEN, and LED_BULE.
Second, set and initialize the three pins PA7, PA25, and PA4.
Third, csi_gpio_pin_write(&pin_led_red, GPIO_PIN_HIGH); function operates LED
while (1) {
LOGD(TAG, "Hello world!\n");
aos_msleep(1000);
if (d == 1) {
csi_gpio_pin_write(&pin_led_red, GPIO_PIN_HIGH);
csi_gpio_pin_write(&pin_led_green, GPIO_PIN_HIGH);
csi_gpio_pin_write(&pin_led_blue, GPIO_PIN_HIGH);
} else {
csi_gpio_pin_write(&pin_led_red, GPIO_PIN_LOW);
csi_gpio_pin_write(&pin_led_green, GPIO_PIN_LOW);
csi_gpio_pin_write(&pin_led_blue, GPIO_PIN_LOW);
}
d=!d;
}
The main program is as above. Since no good template was found, the main test program was modified from the Hello_world project.
Burn the program into the development board and run it.
You can see that the LED starts to flash.
For oled display, I modified the content of bitmap_risc_v.c.
This is a picture and micro-font production tool I developed. The displayed effect is when the drawn picture is converted into a C language array and then replaced with the original picture.
|