Browse Source

update

temp
tianjialong 2 years ago
parent
commit
a44bb4970f
  1. 6
      app/MDK-ARM/app.uvguix.29643
  2. 22
      usersrc/usermain.c

6
app/MDK-ARM/app.uvguix.29643

@ -1883,9 +1883,9 @@
</Doc>
<Doc>
<Name>..\..\usersrc\usermain.c</Name>
<ColumnNumber>42</ColumnNumber>
<TopLine>79</TopLine>
<CurrentLine>102</CurrentLine>
<ColumnNumber>0</ColumnNumber>
<TopLine>80</TopLine>
<CurrentLine>96</CurrentLine>
<Folding>1</Folding>
<ContractedFolders></ContractedFolders>
<PaneID>0</PaneID>

22
usersrc/usermain.c

@ -93,37 +93,37 @@ void set_spi_table_sck(uint8_t startoff)
void set_spi_table_mosi(uint8_t startoff, uint8_t txdata)
{
HAL_UART_Transmit(&huart1, &txdata, 1, 100);
for (size_t i = 0; i < spi_table_type_size; i++)
for (size_t i = 0; i < spi_table_type_size; i+=2)
{
if (i < startoff)
{
table[SPI_MOSI_TYPE][i] = 1;
table[SPI_MOSI_TYPE][i+1] = 1;
}
else if (i >= startoff && i < (startoff + 8))
else if ((i >= startoff) && (i < (startoff + 16)))
{
(txdata & 0x80) ? (table[SPI_MOSI_TYPE][i] = 1) : (table[SPI_MOSI_TYPE][i] = 0);
table[SPI_MOSI_TYPE][i] = 1;
(txdata & 0x80) ? (table[SPI_MOSI_TYPE][i] = 1),(table[SPI_MOSI_TYPE][i+1] = 1) : (table[SPI_MOSI_TYPE][i] = 0),(table[SPI_MOSI_TYPE][i+1] = 0);
txdata = txdata << 1;
HAL_UART_Transmit(&huart1, &txdata, 1, 100);
}
else if (i <= spi_table_type_size - 2)
else if (i <= (spi_table_type_size - 2))
{
table[SPI_MOSI_TYPE][i] = 0;
table[SPI_MOSI_TYPE][i+1] = 0;
}
else
{
table[SPI_MOSI_TYPE][i] = 1;
table[SPI_MOSI_TYPE][i+1] = 1;
}
}
}
void dotable(uint8_t txdata)
{
int sel_startoff = 4;
int clock_startoff = 5;
int mosi_startoff = 5;
memset(&table[SPI_MOSI_TYPE][0], 0, spi_table_type_size);
memset(&table[SPI_SCK_TYPE][0], 0, spi_table_type_size);
int sel_startoff = 3;
int clock_startoff = 4;
int mosi_startoff = 4;
set_spi_table_sel(sel_startoff);
set_spi_table_sck(clock_startoff);

Loading…
Cancel
Save