improve readability

This commit is contained in:
Dennis Gunia
2025-09-11 22:02:37 +02:00
parent 1ace5dd9de
commit 405efd2906
7 changed files with 177 additions and 119 deletions

View File

@@ -16,18 +16,18 @@
// I/O Pin definition
#define BUX_RX PD0
#define BUX_TX PD1
#define BUX_DIR PD2
#define SENSOR_HOME PD3
#define BUX_RX PD0 // RX Pin (to buffer)
#define BUX_TX PD1 // TX Pin (to buffer)
#define BUX_DIR PD2 // Buffer direction pin
#define SENSOR_HOME PD3 // Home sensor pin
#define MOTOR_A PC0
#define MOTOR_B PC1
#define MOTOR_C PC2
#define MOTOR_D PC3
#define MOTOR_A PC0 // Motor phase A driver
#define MOTOR_B PC1 // Motor phase B driver
#define MOTOR_C PC2 // Motor phase C driver
#define MOTOR_D PC3 // Motor phase D driver
// EEPROM Addresses
#define CONF_CONST_OKAY (uint8_t)0xAA
#define CONF_CONST_OKAY (uint8_t)0xAA
#define CONF_ADDR_OKAY 0x0004
#define CONF_ADDR_ADDR 0x0000
#define CONF_ADDR_OFFSET 0x0002
@@ -35,21 +35,21 @@
// Protocol definitions
#define PROTO_MAXPKGLEN 64 // maximum size of package in bytes
// Commands
#define CMDB_SETVAL (uint8_t)0x10
#define CMDB_SETVALR (uint8_t)0x11
#define CMDB_EEPROMR (uint8_t)0xF0
#define CMDB_EEPROMW (uint8_t)0xF1
#define CMDB_GSTS (uint8_t)0xF8
#define CMDB_PING (uint8_t)0xFE
#define CMDB_RESET (uint8_t)0x30
#define CMDB_PWRON (uint8_t)0x21
#define CMDB_RPWROFF (uint8_t)0x20
// Command Bytes
#define CMDB_SETVAL (uint8_t)0x10 // Set display value
#define CMDB_SETVALR (uint8_t)0x11 // Set display value and do a full rotation
#define CMDB_EEPROMR (uint8_t)0xF0 // Read EEPROM
#define CMDB_EEPROMW (uint8_t)0xF1 // Write EEPROM
#define CMDB_GSTS (uint8_t)0xF8 // Get status
#define CMDB_PING (uint8_t)0xFE // Ping
#define CMDB_RESET (uint8_t)0x30 // Reset device
#define CMDB_PWRON (uint8_t)0x21 // Power motor on
#define CMDB_RPWROFF (uint8_t)0x20 // Poer motor off
// Reply
#define CMDR_ERR_INVALID 0xEE
#define CMDR_ACK 0xAA
#define CMDR_PING 0xFF
// Command Responses
#define CMDR_ERR_INVALID 0xEE // Invalid command
#define CMDR_ACK 0xAA // Acknowledge
#define CMDR_PING 0xFF // Ping response
// Utility definitions
#define SHIFT_0B 0