/*
 * int_out.h
 *
 *  Created on: Oct 12, 2024
 *      Author: true
 */

#ifndef USER_DEVICE_INT_OUT_H_
#define USER_DEVICE_INT_OUT_H_



#define INT_I2C_ADDR        0x5e

#define INT_OUT_PORT        GPIOA
#define INT_OUT_PIN         GPIO_Pin_1

#define INT_ACCEL_PORT      GPIOC
#define INT_ACCEL_PIN       GPIO_Pin_3


#define INT_OUT_SET()       INT_OUT_PORT->BCR = INT_OUT_PIN
#define INT_OUT_CLEAR()     INT_OUT_PORT->BSHR = INT_OUT_PIN



#define INT_BTN             (1 << 0)        // user pressed / held / released a button
                                            // set if per-button interrupt enabled for the action when action is taken
                                            // cleared on writing 1 to bit offset in REG_INT_FLAGS_CLEAR

#define INT_ACCEL           (1 << 1)        // accelerometer has interrupt
                                            // set when accelerometer INT pin goes high
                                            // cleared on writing 1 to bit offset in REG_INT_FLAGS_CLEAR

#define INT_UTX_DONE        (1 << 4)        // queued transmission is complete
                                            // set when a successful IrDA transmission has been performed
                                            // cleared on writing 1 to bit offset in REG_INT_FLAGS_CLEAR

#define INT_UTX_TIMEOUT     (1 << 5)        // queued transmission timed out; no receiver got our message
                                            // set when transmission times out
                                            // cleared on writing 1 to bit offset in REG_INT_FLAGS_CLEAR

#define INT_UTX_ERROR       (1 << 6)        // queued transmission failed due to an error (bad payload, etc)
                                            // set when the transmission timer has timed out
                                            // cleared on writing 1 to bit offset in REG_INT_FLAGS_CLEAR

#define INT_URX_RCVD        (1 << 7)        // received valid data packet
                                            // set when a packet is received and passes validation checks
                                            // cleared on writing 1 to bit offset in REG_INT_FLAGS_CLEAR



#endif /* USER_DEVICE_INT_OUT_H_ */
