/** * @file TExaS.h * @brief Creates either an oscilloscope or a logic analyzer * @details TExaS is an oscilloscope or a logic analyzer, sampling at 10 kHz
* - to create an 8-bit analog oscilloscope * -# set adc12 to either ADC0 or ADC1 * -# set channel to 0 to 7 * -# scope ISR is 11 instructions, 1.5us, 1.5% overhead * - to create a 7-bit digital logic analyzer * -# set adc12 to 0, channel doesn't not matter * -# create a function to read any 7-bit digital measurement, add bit7=1 * -# pass that function into TExaS_Init * * @note Works at 32MHz or 40MHz or 80 MHz * @version ECE319K v1.0 * @author Put your name here * @copyright Put your copyright here, * @warning AS-IS * @date August 13, 2023
ADC pins on the MSPM0G3507
Pin ADC channelSensor
PA27 ADC0 channel 0 J1.8 also MKII light interrupt
PA26 ADC0 channel 1 J1.6 MKII microphone in
PA25 ADC0 channel 2 J1.2 MKII Joystick X
PA24 ADC0 channel 3 J3.27 ***free***
PB25 ADC0 channel 4 J19.7 (insert 0ohm R74, no U3 OPA2365)
PB24 ADC0 channel 5 J1.5 also MKII joystick select button
PB20 ADC0 channel 6 J4.36 ***free***
PA22 ADC0 channel 7 J24 MKII Accelerometer Y
PA15 ADC1 channel 0 J3.30 (also DACout)
PA16 ADC1 channel 1 J3.29 ***free***
PA17 ADC1 channel 2 J3.28 ***free***
PA18 ADC1 channel 3 J3.26 MKII Joystick Y
PB17 ADC1 channel 4 J2.18 ***free***
PB18 ADC1 channel 5 J3.25 MKII Accelerometer Z
PB19 ADC1 channel 6 J3.23 MKII Accelerometer X
PA21 ADC1 channel 7 J17.8 (insert R20, remove R3)
******************************************************************************/ /*! * @defgroup Debugging * @brief Debugging tools * @{*/ #ifndef __TEXAS_H__ #define __TEXAS_H__ #include /** * \brief using PAoutPin0Bit0 places PA0 output on bit 0 */ #define PAoutPin0Bit0 (GPIOA->DOUT31_0&1) /** * \brief using PBoutPin22Bit1 places PB22 output on bit 1 */ #define PBoutPin22Bit1 (((GPIOB->DOUT31_0&(1<<22))>>21)) /** * \brief using PBoutPin26Bit2 places PB26 output on bit 2 */ #define PBoutPin26Bit2 (((GPIOB->DOUT31_0&(1<<26))>>24)) /** * \brief using PBoutPin27Bit3 places PB27 output on bit 3 */ #define PBoutPin27Bit3 (((GPIOB->DOUT31_0&(1<<27))>>24)) /** * \brief using PAinPin18Bit4 places PA18 input on bit 4 */ #define PAinPin18Bit4 (((GPIOA->DIN31_0&(1<<18))>>14)) /** * \brief using PBinPin21Bit5 places PA21 input on bit 5 */ #define PBinPin21Bit5 (((GPIOB->DIN31_0&(1<<21))>>16)) /** * To configure logic analyzer for PB21,PA18,PB27,PB26,PB22,PA0 * call TExaS_Init(0,0,&TExaS_LaunchPadLogic); * @param none * @return 8-bit PB21,PA18,PB27,PB26,PB22,PA0 * @note 40 instructions, 2us, 2%overhead * @see TExaS_Init * @brief PB21,PA18,PB27,PB26,PB22,PA0 */ uint8_t TExaS_LaunchPadLogic(void); /** * To configure logic analyzer for PB22,PA0 * call TExaS_Init(0,0,&TExaS_PB22PA0Logic); * @param none * @return 8-bit PB22,PA0 * @note 16 instructions, 1.5us, 1.5% overhead * @see TExaS_Init * @brief PB22,PA0 */ uint8_t TExaS_PB22PA0Logic(void); /** * To configure logic analyzer for PA6-PA0 outputs * call TExaS_Init(0,0,&TExaS_PA60Logic); * @param none * @return 8-bit PA6-PA0 outputs * @note 11 instructions, 1.5us, 1.5% overhead * @see TExaS_Init * @brief PA6-PA0 */ uint8_t TExaS_PA60Logic(void); /** * To configure logic analyzer for PB18-16 outputs, PB2-0 input * call TExaS_Init(0,0,&TExaS_PB18PB17PB16PB2PB1PB0Logic); * @param none * @return 8-bit PB18-16 outputs, PB2-0 input * @see TExaS_Init * @brief PB18-16 outputs, PB2-0 input */ uint8_t TExaS_PB18PB17PB16PB2PB1PB0Logic(void); /** * Initialize TExaS scope or logic analyzer
* Sends one 8-bit data to PC at 10kHz * @param adc12 is ADC0 or ADC1 (set to 0 for logic analyzer) * @param channel specifies ADC channel 0 to 7 * @param logic function that returns an 8-bit value with bit 7 set * @return none * @brief Initialize TExaS */ void TExaS_Init(ADC12_Regs *adc12, uint32_t channel, uint8_t (*logic)(void)); #endif // __TEXAS_H__ /** @}*/