kopia lustrzana https://github.com/RobertGawron/IonizationChamber
commit
f06a409d54
|
@ -7,7 +7,7 @@ set(CMAKE_SYSTEM_NAME Generic) # No linux target etc
|
|||
set(CMAKE_C_FLAGS_INIT "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "")
|
||||
project(STM8Blink C)
|
||||
SET(CMAKE_C_FLAGS "-mstm8 --std-c99 -DSTM8S003 -D__SDCC__ -DUSE_STDPERIPH_DRIVER")
|
||||
SET(CMAKE_C_FLAGS "-mstm8 -DSTM8S003 -D__SDCC__ -DUSE_STDPERIPH_DRIVER")
|
||||
|
||||
# Flash targets
|
||||
#add_custom_target(flash ALL COMMAND stm8flash -c stlink -p stm8s105c6 -w main.ihx)
|
||||
|
@ -46,7 +46,7 @@ add_executable(IonizationChamber
|
|||
STM8S_StdPeriph_Lib/src/stm8s_uart1.c)
|
||||
|
||||
# flash targets
|
||||
add_custom_target(flash ALL COMMAND stm8flash -c stlink -p stm8s003f3 -w IonizationChamber.ihx)
|
||||
#add_custom_target(flash ALL COMMAND stm8flash -c stlink -p stm8s003f3 -w IonizationChamber.ihx)
|
||||
|
||||
|
||||
# generate doxygen docs and dependency graphs
|
||||
|
|
|
@ -35,7 +35,8 @@ void MeassurementFrame_Create(uint8_t configuration, uint16_t data)
|
|||
|
||||
bool MeassurementFrame_Send(void (*sendFunction)(uint8_t))
|
||||
{
|
||||
for(uint8_t i = 0; i < MAX_FRAME_LENGTH; i++)
|
||||
uint8_t i = 0;
|
||||
for(i = 0; i < MAX_FRAME_LENGTH; i++)
|
||||
{
|
||||
sendFunction(buffer[i]);
|
||||
}
|
||||
|
|
|
@ -97,6 +97,14 @@ static void write(uint8_t registerId)
|
|||
|
||||
static uint16_t read(uint8_t registerId)
|
||||
{
|
||||
uint16_t registerMSB = 0;
|
||||
uint16_t registerLSB = 0;
|
||||
uint16_t registerLSB1 = 0;
|
||||
uint16_t registerLSB2 = 0;
|
||||
uint16_t registerLSB3 = 0;
|
||||
uint16_t registerLSB4 = 0;
|
||||
uint16_t registerValue = 0;
|
||||
|
||||
I2C_GenerateSTART(ENABLE);
|
||||
while(!I2C_CheckEvent(I2C_EVENT_MASTER_MODE_SELECT));
|
||||
|
||||
|
@ -105,26 +113,25 @@ static uint16_t read(uint8_t registerId)
|
|||
while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_RECEIVED));
|
||||
|
||||
|
||||
uint16_t registerMSB = I2C_ReceiveData();
|
||||
registerMSB = I2C_ReceiveData();
|
||||
while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_RECEIVED));
|
||||
|
||||
uint16_t registerLSB = I2C_ReceiveData();
|
||||
registerLSB = I2C_ReceiveData();
|
||||
while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_RECEIVED));
|
||||
|
||||
uint16_t registerLSB1 = I2C_ReceiveData();
|
||||
registerLSB1 = I2C_ReceiveData();
|
||||
while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_RECEIVED));
|
||||
|
||||
uint16_t registerLSB2 = I2C_ReceiveData();
|
||||
registerLSB2 = I2C_ReceiveData();
|
||||
while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_RECEIVED));
|
||||
|
||||
uint16_t registerLSB3 = I2C_ReceiveData();
|
||||
registerLSB3 = I2C_ReceiveData();
|
||||
while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_RECEIVED));
|
||||
|
||||
uint16_t registerLSB4 = I2C_ReceiveData();
|
||||
registerLSB4 = I2C_ReceiveData();
|
||||
while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_RECEIVED));
|
||||
|
||||
|
||||
|
||||
I2C_AcknowledgeConfig(DISABLE);
|
||||
I2C_GenerateSTOP(ENABLE);
|
||||
|
||||
|
@ -137,7 +144,7 @@ static uint16_t read(uint8_t registerId)
|
|||
Logger_Print( registerLSB3);
|
||||
*/
|
||||
|
||||
uint16_t registerValue = (registerMSB << 8) + registerLSB;
|
||||
registerValue = (registerMSB << 8) + registerLSB;
|
||||
|
||||
return registerValue;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue