Taiga Develop 2 weken geleden
bovenliggende
commit
12ddde44ca
2 gewijzigde bestanden met toevoegingen van 86 en 0 verwijderingen
  1. 61 0
      include/cx/chlcd/hal.h
  2. 25 0
      source/hd44780.c

+ 61 - 0
include/cx/chlcd/hal.h

@@ -0,0 +1,61 @@
+#ifndef CX_CHLCD_HAL_H_INCLUDED
+#define CX_CHLCD_HAL_H_INCLUDED
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "chlcd/types.h"
+
+#ifdef CHLCD_ON_ESP
+
+static inline chlcd_error_t chlcd_pin_set_output(chlcd_pin_t target) {
+
+}
+
+static inline chlcd_error_t chlcd_pin_write(chlcd_pin_t target, bool state) {
+
+}
+
+static inline chlcd_error_t chlcd_pin_set_pwm(chlcd_pin_t target) {
+
+}
+
+static inline chlcd_error_t chlcd_pin_write_pwm(
+    chlcd_pin_t target, 
+    uint16_t pwm
+) {
+
+}
+
+#else
+
+#define CHLCD_MODE_DEBUG
+
+#include <stdio.h>
+
+static inline chlcd_error_t chlcd_pin_set_output(chlcd_pin_t target) {
+    printf("Pin %li mode set to output.\n", (uint32_t) target);
+    return CHLCD_SUCCESS;
+}
+
+static inline chlcd_error_t chlcd_pin_write(chlcd_pin_t target, bool state) {
+    printf("Pin %li set to %s.\n", (uint32_t) target, state ? "HIGH" : "LOW");
+    return CHLCD_SUCCESS;
+}
+
+static inline chlcd_error_t chlcd_pin_set_pwm(chlcd_pin_t target) {
+    printf("Pin %li mode set to PWM.\n", (uint32_t) target);
+    return CHLCD_SUCCESS;
+}
+
+static inline chlcd_error_t chlcd_pin_write_pwm(
+    chlcd_pin_t target,
+    uint16_t pwm
+) {
+    printf("Pin %li write to PWM %i.\n", (uint32_t) target, pwm);
+    return CHLCD_SUCCESS;
+}
+
+#endif
+
+#endif

+ 25 - 0
source/hd44780.c

@@ -0,0 +1,25 @@
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+#include "chlcd.h"
+
+chlcd_error_t chlcd_hd44780_direct_sender(
+    void *self,
+    chlcd_data_t content,
+    bool is_command,
+    bool is_half_word
+) {
+    return CHLCD_SUCCESS;
+}
+
+chlcd_error_t chlcd_hd44780_shift_register_sender(
+    void *self,
+    chlcd_data_t content,
+    bool is_command,
+    bool is_half_word
+) {
+    return CHLCD_SUCCESS;
+}
+
+