Skip to content

Instantly share code, notes, and snippets.

@dekuNukem
Created December 25, 2016 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dekuNukem/624891b6a977d6fcccc6d93baa1a8d0b to your computer and use it in GitHub Desktop.
Save dekuNukem/624891b6a977d6fcccc6d93baa1a8d0b to your computer and use it in GitHub Desktop.
FAP port read code snippet
// loads a port for CPU to read
void load16(uint8_t address, uint8_t data)
{
// put the address and data onto STM32-CPLD bus
uint16_t value = 0;
value = (address & 0xf) << 8;
value = value | data;
CPLD_DATA_PORT->ODR &= 0xf000;
CPLD_DATA_PORT->ODR |= value;
data_output();
addr_output();
// load the latch
latch16_activate();
latch16_deactivate();
data_input();
addr_input();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment