1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
#include "hardware_abstraction_layer.h" #include <stdio.h>
bool hal_gpio_init(gpio_port_t port, gpio_direction_t direction) { printf("HAL: GPIO pin %u initialized with direction %u\n", port.pin, direction); return true; }
bool hal_gpio_set_state(gpio_port_t port, gpio_state_t state) { printf("HAL: GPIO pin %u set to state %u\n", port.pin, state); return true; }
gpio_state_t hal_gpio_get_state(gpio_port_t port) { printf("HAL: Read GPIO pin %u state\n", port.pin); return GPIO_STATE_LOW; }
bool hal_adc_init(adc_channel_t channel) { printf("HAL: ADC channel %u initialized\n", channel); return true; }
uint16_t hal_adc_read(adc_channel_t channel) { printf("HAL: Read ADC channel %u\n", channel); return 1024; }
bool hal_spi_init(spi_port_t port, uint32_t clock_speed, uint32_t mode) { printf("HAL: SPI bus %u initialized with clock speed %u and mode %u\n", port.bus, clock_speed, mode); return true; }
bool hal_spi_transmit(spi_port_t port, uint8_t* data, uint32_t length) { printf("HAL: SPI bus %u transmit data of length %u\n", port.bus, length); return true; }
bool hal_spi_receive(spi_port_t port, uint8_t* data, uint32_t length){ printf("HAL: SPI bus %u receive data of length %u\n", port.bus, length); return true; }
bool hal_i2c_init(i2c_port_t port, uint32_t clock_speed) { printf("HAL: I2C bus %u initialized with clock speed %u\n", port.bus, clock_speed); return true; }
bool hal_i2c_write(i2c_port_t port, uint8_t* data, uint32_t length) { printf("HAL: I2C bus %u write data of length %u\n", port.bus, length); return true; }
bool hal_i2c_read(i2c_port_t port, uint8_t* data, uint32_t length) { printf("HAL: I2C bus %u read data of length %u\n", port.bus, length); return true; }
bool hal_uart_init(uart_port_t port, uint32_t baudrate, uint32_t data_bits, uint32_t parity, uint32_t stop_bits) { printf("HAL: UART port %u initialized with baudrate %u, databits %u, parity %u, stopbits %u\n", port.uart_port, baudrate, data_bits, parity, stop_bits); return true; }
bool hal_uart_transmit(uart_port_t port, uint8_t* data, uint32_t length){ printf("HAL: UART port %u transmit data of length %u\n", port.uart_port, length); return true; }
bool hal_uart_receive(uart_port_t port, uint8_t* data, uint32_t length){ printf("HAL: UART port %u receive data of length %u\n", port.uart_port, length); return true; }
|