Skip to content

Commit

Permalink
fixed default pin output
Browse files Browse the repository at this point in the history
  • Loading branch information
dakhnod committed Jul 21, 2024
1 parent 698a06f commit f715b8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CUSTOM_INCLUDES_DIR = $(PROJ_DIR)/src/common
ADB_TARGET ?= Pixel-5
ADB_DIRECTORY ?= /sdcard/dfu

FIRMWARE_VERSION := \"0.8.3\"
FIRMWARE_VERSION := \"0.8.4\"

# Source files common to all targets
SRC_FILES += \
Expand Down
7 changes: 4 additions & 3 deletions src/gpio/sensor_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ void gpio_configure_aio_outputs_digital() {
if(config->direction != OUTPUT){
continue;
}
nrf_gpio_cfg_output(config->pin.output.pin);
gpio_write_output_digital_pin(i, config->pin.output.default_state);
gpio_write_output_digital_pin(current_index, config->pin.output.default_state);
current_index++;
};
}
Expand Down Expand Up @@ -309,7 +308,8 @@ void gpio_handle_parse_output_digital(uint32_t index, uint32_t pin, uint8_t defa
config->direction = OUTPUT;
config->pin.output.pin = pin;
config->pin.output.default_state = default_state;
config->pin.output.invert = invert;
config->pin.output.invert = invert;
config->pin.output.state = 0b10; // force output pin configuration
}

void gpio_handle_parse_output_analog(uint32_t index, uint32_t pin, uint8_t invert) {
Expand Down Expand Up @@ -355,6 +355,7 @@ void gpio_init(gpio_input_change_handler_t input_change_handler) {
gpio_configs[current_index].pin.output.pin = pin_index; \
gpio_configs[current_index].pin.output.invert = GPIO_CONFIGURATION_PIN_##pin_index##_INVERT; \
gpio_configs[current_index].pin.output.default_state = GPIO_CONFIGURATION_PIN_##pin_index##_DEFAULT_OUTPUT; \
gpio_configs[current_index].pin.output.state = 0b10; \
} \
}while (false)

Expand Down
4 changes: 2 additions & 2 deletions src/persistence/pin_configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ uint8_t is_output_pin_analog(uint8_t pin_byte) {
}

uint8_t get_output_digital_pin_default_state(uint8_t pin_byte) {
return (pin_byte & 0b0010) & 0b0010;
return (pin_byte & 0b0010) == 0b0010;
}

uint8_t is_input_pin_enabled(uint8_t pin_byte) {
Expand All @@ -35,7 +35,7 @@ uint8_t get_input_digital_pin_pull(uint8_t pin_byte) {
}

uint8_t get_pin_invert(uint8_t pin_byte) {
return (pin_byte & 0b0001) & 0b0001;
return (pin_byte & 0b0001) == 0b0001;
}

void parse_pin_byte(uint32_t pin_index, uint8_t pin_data) {
Expand Down

0 comments on commit f715b8d

Please sign in to comment.