Skip to content

Commit 6a23dc6

Browse files
committed
Fix I2C compilation: define _XTAL_FREQ for delay macros and add missing newline
1 parent 4c8601d commit 6a23dc6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pic18f26k83/i2c.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
#include "i2c.h"
44

5+
#ifndef _XTAL_FREQ
6+
// Define crystal frequency for delay macros (default: 16 MHz)
7+
#define _XTAL_FREQ 16000000
8+
#endif
9+
510
/* Private function declarations */
611
static void clear_i2c_buffers(void);
712
static w_status_t check_i2c_state(void);
@@ -256,4 +261,4 @@ w_status_t i2c_read_reg16(uint8_t address, uint8_t reg, uint16_t *value) {
256261
// Combine bytes (MSB first)
257262
*value = ((uint16_t)data[0] << 8) | data[1];
258263
return W_SUCCESS;
259-
}
264+
}

pic18f26k83/pwm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
// Helper function to configure PPS registers using direct register access
55
static w_status_t configure_pps(uint8_t ccp_module, pwm_pin_config_t pin_config) {
6-
76
// Ensure the CCP module number is within valid range (1-4)
87
if (ccp_module < 1 || ccp_module > 4) {
98
return W_INVALID_PARAM; // Return error if the module number is out of range

0 commit comments

Comments
 (0)