// Initialize the hardware running the shift register
// Tiva Port B Pins 0-2 will be set to output
// Pin 0 to Serial input, Pin 1 to Shift Clock, Pin 2 to Register clock
// Takes: nothing
// Returns: nothing
void SR_Init(void)
{
Initialize Port B
Enable clock on Port B
Set Port B Pins 0-2 to digital output
}
// Allow external programs to determine the last value written to the shift regi
ster
// Takes: nothing
// Returns uint8_t Last_Write: last value written to register
uint8_t SR_GetCurrentRegister(void)
{
Return value of last write to register
}
// Write an input value to the shift register as a binary number
// MSB of input will appear at Q7 of the shift register
// LSB of input will appear at Q0 of the shift register
// Takes: uint8_t NewValue: the value to be written to the shift register
// Returns: nothing
void SR_Write(uint8_t NewValue)
{
Update Last_Write
Create mask with only 7th bit HI
set the register clock low
compare the input against a mask and write the MSB to the register
Pulse the shift clock
shift mask to check next most significant bit
shift the register
}