/** * abelx.c * * Copyright 2020 astro * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "abelx.h" #include "tca6424.h" #include "aw9523b.h" void set_pin(uint16_t pin) { uint8_t data = tca6424_read_port(GET_PORT(pin)); data |= ( 1 << GET_PIN(pin)); tca6424_write_port(GET_PORT(pin), data); } void clear_pin(uint16_t pin) { uint8_t data = tca6424_read_port(GET_PORT(pin)); data &= ~( 1 << GET_PIN(pin)); tca6424_write_port(GET_PORT(pin), data); } uint8_t read_pin(uint16_t pin) { uint8_t data = tca6424_read_port(GET_PORT(pin)); return (data & (1<BKP0R)) = REBOOT_MAGIC; }