mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-12-16 01:09:57 +00:00
IR_CMD_Handler
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
#include "usbd_cdc_if.h"
|
||||
|
||||
|
||||
void SaveShot(unsigned char number, struct StructShot* shot)
|
||||
void SaveShot(unsigned char number, struct Shot* shot)
|
||||
{
|
||||
uint16_t blockAddr16 = (uint16_t)(START_ADR_SHOT + (uint16_t)(number*FLASH_BLOCKSIZE));
|
||||
|
||||
@ -26,31 +26,30 @@ void SaveShot(unsigned char number, struct StructShot* shot)
|
||||
FLASH_WriteBlock(blockAddr, Buf);
|
||||
}
|
||||
|
||||
struct StructShot GetShot( unsigned char number )
|
||||
struct Shot GetShot( unsigned char number )
|
||||
{
|
||||
struct StructShot shot;
|
||||
|
||||
uint16_t blockAddr16 = (uint16_t)(START_ADR_SHOT + (uint16_t)(number*FLASH_BLOCKSIZE));
|
||||
|
||||
uint8_t blockAddr[2] = {HIBYTE(blockAddr16), LOBYTE(blockAddr16)};
|
||||
struct Shot shot;
|
||||
|
||||
uint16_t blockAddr16 = (uint16_t)(START_ADR_SHOT + (uint16_t)(number*FLASH_BLOCKSIZE));
|
||||
uint8_t blockAddr[2] = {HIBYTE(blockAddr16), LOBYTE(blockAddr16)};
|
||||
|
||||
unsigned char Buf[FLASH_BLOCKSIZE];
|
||||
|
||||
|
||||
HAL_I2C_Master_Transmit(&hi2c1, (AT24C_ADRESS << 1), blockAddr, 2, 10);
|
||||
HAL_Delay(1);
|
||||
HAL_I2C_Master_Receive(&hi2c1, (AT24C_ADRESS << 1), Buf, FLASH_BLOCKSIZE, 10);
|
||||
HAL_Delay(1);
|
||||
|
||||
shot.countRepeatShot = Buf[1];
|
||||
shot.speedRollerTop = Buf[2];
|
||||
shot.speedRollerBottom = Buf[3];
|
||||
shot.speedScrew = Buf[4];
|
||||
shot.rotationAxial = Buf[5];
|
||||
shot.rotationHorizontal = Buf[6];
|
||||
shot.rotationVertical = Buf[7];
|
||||
|
||||
unsigned char Buf[FLASH_BLOCKSIZE];
|
||||
|
||||
|
||||
HAL_I2C_Master_Transmit(&hi2c1, (AT24C_ADRESS << 1), blockAddr, 2, 10);
|
||||
HAL_Delay(1);
|
||||
HAL_I2C_Master_Receive(&hi2c1, (AT24C_ADRESS << 1), Buf, FLASH_BLOCKSIZE, 10);
|
||||
HAL_Delay(1);
|
||||
|
||||
shot.countRepeatShot = Buf[1];
|
||||
shot.speedRollerTop = Buf[2];
|
||||
shot.speedRollerBottom = Buf[3];
|
||||
shot.speedScrew = Buf[4];
|
||||
shot.rotationAxial = Buf[5];
|
||||
shot.rotationHorizontal = Buf[6];
|
||||
shot.rotationVertical = Buf[7];
|
||||
|
||||
return shot;
|
||||
return shot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user