Compare commits

..

No commits in common. "de1af41d428b56f1dadddcbfae9c425443efaa04" and "109e9e50cdd27fa766ae6097e1ac75ea3d26163e" have entirely different histories.

4 changed files with 35 additions and 51 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
.vscode/
build/
drone/
.cache/

View file

@ -5,13 +5,11 @@
*/
#include <stdio.h>
#include <zephyr/drivers/display.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS 1000
#define SLEEP_TIME_MS 1000
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
@ -20,27 +18,13 @@
* A build error on this line means your board is unsupported.
* See the sample documentation for information on how to fix this.
*/
// static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
int main(void)
{
int ret;
bool led_state = true;
const struct device *display =
DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
display_capabilities capabilities;
display_get_capabilities(display, &capabilities);
uint32_t buf = 0;
display_buffer_descriptor buf_desc = {
.buf_size = 4, .width = 8, .height = 1, .pitch = 8};
display_write(display, 0, 0, &buf_desc, &buf);
int x = 0;
#if 0
if (!gpio_is_ready_dt(&led)) {
return 0;
}
@ -49,25 +33,16 @@ int main(void)
if (ret < 0) {
return 0;
}
#endif
while (1) {
#if 0
ret = gpio_pin_toggle_dt(&led);
if (ret < 0) {
return 0;
}
#endif
for (int x = 0; x < 128; ++x) {
for (int y = 0; y < 64; y += 8) {
display_write(display, x, y, &buf_desc, &buf);
}
}
buf = ~buf;
led_state = !led_state;
printf("XLED state: %s\n", led_state ? "ON" : "OFF");
// display_write(display, x, x, &buf_desc, &buf);
// k_msleep(SLEEP_TIME_MS);
printf("LED state: %s\n", led_state ? "ON" : "OFF");
k_msleep(SLEEP_TIME_MS);
}
return 0;
}

View file

@ -11,7 +11,19 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &debug0;
zephyr,display = &hs96l03;
zephyr,shell-uart = &usart1;
};
leds {
compatible = "gpio-leds";
red_led: led0 {
gpios = <&gpioa 2 GPIO_ACTIVE_HIGH>;
};
};
aliases {
led0 = &red_led;
};
};
@ -19,21 +31,23 @@
status = "okay";
};
&i2c1 {
&gpioa {
status = "okay";
clock-frequency = <400000>;
};
hs96l03: hs96l03@3c {
compatible = "hs99l03", "solomon,ssd1306fb";
reg = <0x3c>;
width = <128>;
height = <64>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <63>;
segment-remap;
com-invdir;
prechargep = <0x22>;
&pinctrl {
usart1_default: usart1_default {
group0 {
pinmux = <USART1_TX_PD5_0>, <USART1_RX_PD6_0>;
bias-pull-up;
drive-push-pull;
};
};
};
&usart1 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&usart1_default>;
pinctrl-names = "default";
};

View file

@ -3,9 +3,5 @@ CONFIG_SOC_WCH_CH32V00X_PLL=y
CONFIG_SOC_WCH_CH32V00X_HSI_AS_PLLSRC=y
CONFIG_SOC_WCH_CH32V00X_PLL_AS_SYSCLK=y
CONFIG_I2C=y
CONFIG_CLOCK_CONTROL=y
CONFIG_PINCTRL=y
CONFIG_DISPLAY=y
CONFIG_SSD1306=y