//our address #define USI_OURADDRESS ( 0x90 >> 1 ) //waiting for start #define USISTATE_NULL 0x0000 //major states #define USISTATE_MASK 0x0f00 #define USISTATE_ACK 0x0001 #define USISTATE_HAS_START 0x0002 #define USISTATE_OUTMODE 0x0004 #define USISTATE_ACKDONE 0x0008 #define USISTATE_CONTROL 0x0100 #define USISTATE_COMMAND 0x0200 #define USISTATE_INPUT 0x0400 #define USISTATE_OUTPUT 0x0800 //super return states; lower 8 bits for read count #define SUPER_NULL 0x00 #define SUPER_ACK 0x1000 #define SUPER_START_CMD 0x2000 #define SUPER_LPM_EXIT 0x4000 #define SUPER_CNT_MASK 0x0fff //State of usi machine extern uint16_t usi_state; //The command byte received from master extern uint16_t usi_command; //pointer used internally by usi //This is set by the super, requested by this code extern uint8_t* usi_buf_ptr; //A command byte was received by i2c slave //super needs to deal with it, this needs to be defined elsewhere uint16_t i2c_super_command( ); //Call this in main at initialization // or anytime to reset usi void initialize_i2c( void );