| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef CX_CHLCD_HAL_H_INCLUDED
- #define CX_CHLCD_HAL_H_INCLUDED
- #include <stdint.h>
- #include <stdbool.h>
- #include "cx/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
- ) {
- }
- static inline chlcd_error_t chlcd_sleep_us(uint32_t time) {
- }
- #elifdef CHLCD_STDIO_TESTING
- #include <stdio.h>
- static inline chlcd_error_t chlcd_pin_set_output(chlcd_pin_t target) {
- printf("Pin %u 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 %u 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 %u 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 %u write to PWM %i.\n", (uint32_t) target, pwm);
- return CHLCD_SUCCESS;
- }
- static inline chlcd_error_t chlcd_sleep_us(uint32_t time) {
- printf("Wait for %u ns.\n", time);
- return CHLCD_SUCCESS;
- }
- #endif
- #endif
|