I'm trying to connect a RM46 LaunchPad a memory Microchip 25LC256 SPI, I have trouble interpreting the functions of CCS (Microchip) with an equivalent function in CCSV6 + HalCogen
//--- driver code ---- #define EEPROM_SELECT PIN_B15 #define EEPROM_ADDRESS long int #define EEPROM_SIZE 32768 void init_ext_eeprom() { output_high(EEPROM_SELECT); setup_spi(SPI_MASTER | SPI_XMIT_L_TO_H | SPI_CLK_DIV_4 ); } //-------------------------------- int1 ext_eeprom_ready(void) { int8 data; output_low(EEPROM_SELECT); spi_write(0x05); data = spi_read(0); output_high(EEPROM_SELECT); return(!bit_test(data, 0)); } //-------------------------------- void write_ext_eeprom(EEPROM_ADDRESS address, BYTE data) { while(!ext_eeprom_ready()); output_low(EEPROM_SELECT); spi_write(0x06); output_high(EEPROM_SELECT); output_low(EEPROM_SELECT); spi_write(0x02); spi_write(address >> 8); spi_write(address); spi_write(data); output_high(EEPROM_SELECT); } //-------------------------------- BYTE read_ext_eeprom(EEPROM_ADDRESS address) { int8 data; while(!ext_eeprom_ready()); output_low(EEPROM_SELECT); spi_write(0x03); spi_write(address >> 8); spi_write(address); data = spi_read(0); output_high(EEPROM_SELECT); return(data); } |
|
which are the equivalent functions(HalCoGen):
spi_write(Byte)---->(Microchip) in CCSV6+HalcoGen---->????
data = spi_read(0); ---->(Microchip) in CCSV6+HalcoGen---->????
I found in "HalCoGen help", the following functions, but require many parameters.
uint32 | spiTransmitData (spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, uint16 *srcbuff) |
uint32 | spiReceiveData (spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, uint16 *destbuff) |
I need help setting these parameters!!!