fix little bugs, but I2C multiplexer don't work

This commit is contained in:
eddyem
2018-06-07 18:11:02 +03:00
parent cba53e39a5
commit 8d43610e1b
9 changed files with 153 additions and 46 deletions

View File

@@ -1,14 +1,14 @@
BINARY = tsys01
BOOTPORT ?= /dev/ttyUSB0
BOOTSPEED ?= 9600
BOOTSPEED ?= 57600
# MCU FAMILY
FAMILY = F0
# MCU code
MCU = F042x6
# hardware definitions
DEFS := -DUSARTNUM=1 -DI2CPINS=B6B7
DEFS := -DUSARTNUM=1 -DI2CPINS=67
#DEFS += -DCHECK_TMOUT
#DEFS += -DEBUG
DEFS += -DEBUG
# change this linking script depending on particular MCU model,
# for example, if you have STM32F103VBT6, you should write:
LDSCRIPT = ld/stm32f042k.ld
@@ -127,7 +127,7 @@ $(ELF): $(OBJDIR) $(OBJS)
clean:
@echo " CLEAN"
$(RM) $(OBJS) $(DEPS) $(ELF) $(HEX) $(LIST) $(OBJDIR)/*.map
$(RM) $(OBJS) $(DEPS) $(ELF) $(HEX) $(LIST) $(OBJDIR)/*.map *.d
@rmdir $(OBJDIR) 2>/dev/null || true

View File

@@ -44,6 +44,8 @@ void gpio_setup(void){
// PA8 - power enable
GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER8)) |
GPIO_MODER_MODER8_O;
pin_set(LED0_port, LED0_pin); // clear LEDs
pin_set(LED1_port, LED1_pin);
}
void i2c_setup(I2C_SPEED speed){
@@ -53,7 +55,7 @@ void i2c_setup(I2C_SPEED speed){
curI2Cspeed = speed;
}
I2C1->CR1 = 0;
#if I2CPINS == A9A10
#if I2CPINS == 910
/*
* GPIO Resources: I2C1_SCL - PA9, I2C1_SDA - PA10
* GPIOA->AFR[1]
@@ -64,7 +66,7 @@ void i2c_setup(I2C_SPEED speed){
GPIOA->MODER |= GPIO_MODER_MODER9_AF | GPIO_MODER_MODER10_AF; // alternate function
GPIOA->OTYPER |= GPIO_OTYPER_OT_9 | GPIO_OTYPER_OT_10; // opendrain
//GPIOA->OTYPER |= GPIO_OTYPER_OT_10; // opendrain
#elif I2CPINS == B6B7
#elif I2CPINS == 67
/*
* GPIO Resources: I2C1_SCL - PB6, I2C1_SDA - PB7 (AF1)
* GPIOB->AFR[0] -> 1<<6*4 | 1<<7*4 = 0x11000000
@@ -82,8 +84,10 @@ void i2c_setup(I2C_SPEED speed){
if(speed == LOW_SPEED){ // 10kHz
// PRESC=B, SCLDEL=4, SDADEL=2, SCLH=0xC3, SCLL=0xB0
I2C1->TIMINGR = (0xB<<28) | (4<<20) | (2<<16) | (0xC3<<8) | (0xB0);
}else{ // 100kHz
}else if(speed == HIGH_SPEED){ // 100kHz
I2C1->TIMINGR = (0xB<<28) | (4<<20) | (2<<16) | (0x12<<8) | (0x11);
}else{ // VERYLOW_SPEED - the lowest speed by STM register: 5.8kHz (presc = 16-1 = 15; )
I2C1->TIMINGR = (0xf<<28) | (4<<20) | (2<<16) | (0xff<<8) | (0xff);
}
I2C1->CR1 = I2C_CR1_PE;// | I2C_CR1_RXIE; // Enable I2C & (interrupt on receive - not supported yet)
}

View File

@@ -45,7 +45,7 @@
#define USARTX FORMUSART(USARTNUM)
#ifndef I2CPINS
#define I2CPINS A9A10
#define I2CPINS 910
#endif
#ifndef LED1_port
@@ -73,6 +73,7 @@
#define SENSORS_OVERCURNT() ((1<<3) != (GPIOB->IDR & (1<<3)))
typedef enum{
VERYLOW_SPEED,
LOW_SPEED,
HIGH_SPEED,
CURRENT_SPEED

View File

@@ -24,6 +24,14 @@
#include "i2c.h"
#include "sensors_manage.h"
#pragma message("USARTNUM=" STR(USARTNUM))
#pragma message("I2CPINS=" STR(I2CPINS))
#ifdef EBUG
#pragma message("Debug mode")
#else
#pragma message("Release mode")
#endif
volatile uint32_t Tms = 0;
/* Called when systick fires */
@@ -31,6 +39,27 @@ void sys_tick_handler(void){
++Tms;
}
void iwdg_setup(){
/* Enable the peripheral clock RTC */
/* (1) Enable the LSI (40kHz) */
/* (2) Wait while it is not ready */
RCC->CSR |= RCC_CSR_LSION; /* (1) */
while((RCC->CSR & RCC_CSR_LSIRDY) != RCC_CSR_LSIRDY); /* (2) */
/* Configure IWDG */
/* (1) Activate IWDG (not needed if done in option bytes) */
/* (2) Enable write access to IWDG registers */
/* (3) Set prescaler by 64 (1.6ms for each tick) */
/* (4) Set reload value to have a rollover each 2s */
/* (5) Check if flags are reset */
/* (6) Refresh counter */
IWDG->KR = IWDG_START; /* (1) */
IWDG->KR = IWDG_WRITE_ACCESS; /* (2) */
IWDG->PR = IWDG_PR_PR_1; /* (3) */
IWDG->RLR = 1250; /* (4) */
while(IWDG->SR); /* (5) */
IWDG->KR = IWDG_REFRESH; /* (6) */
}
int main(void){
uint32_t lastT = 0;
int16_t L = 0;
@@ -40,11 +69,12 @@ int main(void){
gpio_setup();
usart_setup();
i2c_setup(LOW_SPEED);
// reset on start
write_i2c(TSYS01_ADDR0, TSYS01_RESET);
write_i2c(TSYS01_ADDR1, TSYS01_RESET);
iwdg_setup();
SEND("Greetings!\n");
while (1){
IWDG->KR = IWDG_REFRESH; // refresh watchdog
if(lastT > Tms || Tms - lastT > 499){
LED_blink(LED0);
lastT = Tms;
@@ -69,6 +99,10 @@ int main(void){
i2c_setup(CURRENT_SPEED);
SEND("Reinit I2C\n");
break;
case 'V':
i2c_setup(VERYLOW_SPEED);
SEND("Very low speed\n");
break;
case 'L':
i2c_setup(LOW_SPEED);
SEND("Low speed\n");
@@ -82,6 +116,7 @@ int main(void){
"'D' - slave discovery\n"
"'T' - get raw temperature\n"
"'R' - reinit I2C\n"
"'V' - very low speed\n"
"'L' - low speed\n"
"'H' - high speed\n");
break;

View File

@@ -231,6 +231,10 @@ static uint8_t sensors_scan(uint8_t (* procfn)()){
// print coefficients @debug console
void showcoeffs(){
int a, p, k;
if(Nsens_present == 0){
SEND("No sensors found\n");
return;
}
for(a = 0; a <= MUL_MAX_ADDRESS; ++a){
for(p = 0; p < 2; ++p){
if(!(sens_present[p] & (1<<a))) continue; // no sensor
@@ -247,6 +251,13 @@ void showcoeffs(){
// print temperature @debug console
void showtemperature(){
int a, p;
if(Nsens_present == 0){
SEND("No sensors found\n");
return;
}
if(Ntemp_measured == 0){
SEND("No right measurements\n");
}
for(a = 0; a <= MUL_MAX_ADDRESS; ++a){
for(p = 0; p < 2; ++p){
if(!(sens_present[p] & (1<<a))) continue; // no sensor
@@ -273,37 +284,55 @@ void sensors_process(){
}
switch (Sstate){
case SENS_INITING: // initialisation (restart I2C)
MSG("init->reset\n");
i2c_setup(CURRENT_SPEED);
Sstate = SENS_RESETING;
break;
case SENS_RESETING: // reset & discovery procedure
overcurnt_ctr = 0;
if(sensors_scan(resetproc)) Sstate = SENS_GET_COEFFS;
if(sensors_scan(resetproc)){
count_sensors(); // get total amount of sensors
if(Nsens_present){
MSG("reset->getcoeff\n");
Sstate = SENS_GET_COEFFS;
}else{ // no sensors found
MSG("reset->off\n");
Sstate = SENS_OFF;
}
}
break;
case SENS_GET_COEFFS: // get coefficients
if(sensors_scan(getcoefsproc)){
count_sensors(); // get total amount of sensors
MSG("got coeffs for ");
#ifdef EBUG
printu(Nsens_present);
#endif
MSG(" sensors ->start\n");
Sstate = SENS_START_MSRMNT;
}
break;
case SENS_START_MSRMNT: // send all sensors command to start measurements
if(sensors_scan(msrtempproc)){
lastSensT = Tms;
MSG("->wait\n");
Sstate = SENS_WAITING;
Ntemp_measured = 0; // reset value of good measurements
}
break;
case SENS_WAITING: // wait for end of conversion
if(Tms - lastSensT > CONV_TIME){
MSG("->gather\n");
Sstate = SENS_GATHERING;
}
break;
case SENS_GATHERING: // scan all sensors, get thermal data & calculate temperature
if(sensors_scan(gettempproc)){
lastSensT = Tms;
if(Nsens_present == Ntemp_measured) // All OK, amount of T == amount of sensors
if(Nsens_present == Ntemp_measured){ // All OK, amount of T == amount of sensors
MSG("->sleep\n");
Sstate = SENS_SLEEPING;
else{ // reinit I2C & try to start measurements again
}else{ // reinit I2C & try to start measurements again
MSG("gather error ->start\n");
i2c_setup(CURRENT_SPEED);
Sstate = SENS_START_MSRMNT;
}
@@ -311,10 +340,12 @@ void sensors_process(){
break;
case SENS_SLEEPING: // wait for `SLEEP_TIME` till next measurements
if(Tms - lastSensT > SLEEP_TIME){
MSG("sleep->start\n");
Sstate = SENS_START_MSRMNT;
}
break;
case SENS_OVERCURNT: // try to reinit all after overcurrent
MSG("overcurrent occured!\n");
sensors_on();
break;
default: // do nothing

View File

@@ -1,17 +0,0 @@
tmp_UPGWJZ.o: /tmp/tmp_UPGWJZ.cpp /usr/include/stdc-predef.h i2c.h \
usart.c ../inc/F0/stm32f0.h ../inc/F0/stm32f0xx.h \
../inc/F0/stm32f042x6.h ../inc/cm/core_cm0.h \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdint.h \
/usr/include/stdint.h /usr/include/bits/libc-header-start.h \
/usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/bits/long-double.h \
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/bits/wchar.h /usr/include/bits/stdint-intn.h \
/usr/include/bits/stdint-uintn.h ../inc/cm/core_cmInstr.h \
../inc/cm/core_cmFunc.h hardware.h usart.h /usr/include/string.h \
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stddef.h \
/usr/include/bits/types/locale_t.h /usr/include/bits/types/__locale_t.h \
/usr/include/strings.h /usr/include/bits/strings_fortified.h \
/usr/include/bits/string_fortified.h main.c i2c.h i2c.c hardware.h \
hardware.c

Binary file not shown.

View File

@@ -96,6 +96,7 @@ AHB2PERIPH_BASE
AHBPERIPH_BASEÌ65536Ö0
ALL_OKÌ4Îanon_enum_1Ö0
APBPERIPH_BASEÌ65536Ö0
BAD_TEMPERATUREÌ65536Ö0
CANÌ65536Ö0
CAN_BASEÌ65536Ö0
CAN_BTR_BRPÌ65536Ö0
@@ -1310,6 +1311,7 @@ CRS_ISR_SYNCMISS
CRS_ISR_SYNCOKFÌ65536Ö0
CRS_ISR_SYNCWARNFÌ65536Ö0
CRS_ISR_TRIMOVFÌ65536Ö0
CURRENT_SPEEDÌ4Îanon_enum_0Ö0
DBGMCUÌ65536Ö0
DBGMCU_APB1_FZ_DBG_CAN_STOPÌ65536Ö0
DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUTÌ65536Ö0
@@ -1438,6 +1440,7 @@ DMA_ISR_TEIF4
DMA_ISR_TEIF5Ì65536Ö0
DMA_ISR_TEIF6Ì65536Ö0
DMA_ISR_TEIF7Ì65536Ö0
EBUGÌ65536Ö0
EXTIÌ65536Ö0
EXTI_BASEÌ65536Ö0
EXTI_EMR_MR0Ì65536Ö0
@@ -1984,10 +1987,6 @@ GPIO_PUPDR_PUPDR9
GPIO_PUPDR_PUPDR9_0Ì65536Ö0
GPIO_PUPDR_PUPDR9_1Ì65536Ö0
HIGH_SPEEDÌ4Îanon_enum_0Ö0
HIGH_SPEEDÌ4Îanon_enum_2Ö0
HIGH_SPEEDÌ4Îanon_enum_3Ö0
HIGH_SPEEDÌ4Îanon_enum_4Ö0
HIGH_SPEEDÌ4Îanon_enum_5Ö0
I2C1Ì65536Ö0
I2C1_BASEÌ65536Ö0
I2CPINSÌ65536Ö0
@@ -2057,7 +2056,7 @@ I2C_OAR2_OA2EN
I2C_OAR2_OA2MSKÌ65536Ö0
I2C_PECR_PECÌ65536Ö0
I2C_RXDR_RXDATAÌ65536Ö0
I2C_SPEEDÌ4096Ö0Ïanon_enum_5
I2C_SPEEDÌ4096Ö0Ïanon_enum_0
I2C_TIMEOUTÌ65536Ö0
I2C_TIMEOUTR_TEXTENÌ65536Ö0
I2C_TIMEOUTR_TIDLEÌ65536Ö0
@@ -2187,11 +2186,14 @@ IWDG_PR_PR
IWDG_PR_PR_0Ì65536Ö0
IWDG_PR_PR_1Ì65536Ö0
IWDG_PR_PR_2Ì65536Ö0
IWDG_REFRESHÌ65536Ö0
IWDG_RLR_RLÌ65536Ö0
IWDG_SR_PVUÌ65536Ö0
IWDG_SR_RVUÌ65536Ö0
IWDG_SR_WVUÌ65536Ö0
IWDG_STARTÌ65536Ö0
IWDG_WINR_WINÌ65536Ö0
IWDG_WRITE_ACCESSÌ65536Ö0
LED0_pinÌ65536Ö0
LED0_portÌ65536Ö0
LED1_pinÌ65536Ö0
@@ -2199,18 +2201,18 @@ LED1_port
LED_blinkÌ131072Í(x)Ö0
LINE_BUSYÌ4Îanon_enum_1Ö0
LOW_SPEEDÌ4Îanon_enum_0Ö0
LOW_SPEEDÌ4Îanon_enum_2Ö0
LOW_SPEEDÌ4Îanon_enum_3Ö0
LOW_SPEEDÌ4Îanon_enum_4Ö0
LOW_SPEEDÌ4Îanon_enum_5Ö0
MODIFY_REGÌ131072Í(REG,CLEARMASK,SETMASK)Ö0
MSGÌ131072Í(str)Ö0
MUL_ADDRESSÌ131072Í(x)Ö0
MUL_MAX_ADDRESSÌ65536Ö0
MUL_OFFÌ131072Í()Ö0
MUL_ONÌ131072Í()Ö0
NEWLINEÌ131072Í()Ö0
NULLÌ65536Ö0
NVICÌ65536Ö0
NVIC_BASEÌ65536Ö0
Nsens_presentÌ16384Ö0Ïuint8_t
Ntemp_measuredÌ16384Ö0Ïuint8_t
OBÌ65536Ö0
OB_BASEÌ65536Ö0
OB_RDP_RDPÌ65536Ö0
@@ -2830,12 +2832,26 @@ SCB_SHCSR_SVCALLPENDED_Msk
SCB_SHCSR_SVCALLPENDED_PosÌ65536Ö0
SCS_BASEÌ65536Ö0
SENDÌ131072Í(str)Ö0
SENSORS_OFFÌ131072Í()Ö0
SENSORS_ONÌ131072Í()Ö0
SENSORS_OVERCURNTÌ131072Í()Ö0
SENS_GATHERINGÌ4Îanon_enum_2Ö0
SENS_GET_COEFFSÌ4Îanon_enum_2Ö0
SENS_INITINGÌ4Îanon_enum_2Ö0
SENS_OFFÌ4Îanon_enum_2Ö0
SENS_OVERCURNTÌ4Îanon_enum_2Ö0
SENS_OVERCURNT_OFFÌ4Îanon_enum_2Ö0
SENS_RESETINGÌ4Îanon_enum_2Ö0
SENS_SLEEPINGÌ4Îanon_enum_2Ö0
SENS_START_MSRMNTÌ4Îanon_enum_2Ö0
SENS_WAITINGÌ4Îanon_enum_2Ö0
SET_BITÌ131072Í(REG,BIT)Ö0
SIG_ATOMIC_MAXÌ65536Ö0
SIG_ATOMIC_MINÌ65536Ö0
SIG_ATOMIC_WIDTHÌ65536Ö0
SIZE_MAXÌ65536Ö0
SIZE_WIDTHÌ65536Ö0
SLEEP_TIMEÌ65536Ö0
SPI1Ì65536Ö0
SPI1_BASEÌ65536Ö0
SPI2Ì65536Ö0
@@ -3046,6 +3062,8 @@ SYSCFG_EXTICR4_EXTI15_PB
SYSCFG_EXTICR4_EXTI15_PCÌ65536Ö0
SYSCFG_EXTICR4_EXTI15_PDÌ65536Ö0
SYSCFG_EXTICR4_EXTI15_PEÌ65536Ö0
SensorsStateÌ4096Ö0Ïanon_enum_2
SstateÌ16384Ö0ÏSensorsState
StartHSEÌ16Í()Ö0Ïinline void
StartHSI48Ì16Í()Ö0Ïinline void
SysTickÌ65536Ö0
@@ -3488,6 +3506,8 @@ TSYS01_PROM_ADDR0
TSYS01_RESETÌ65536Ö0
TSYS01_START_CONVÌ65536Ö0
TXstatusÌ4096Ö0Ïanon_enum_1
TaddrÌ16384Ö0Ïconst uint8_t
TemperaturesÌ16384Ö0Ïint16_t
TmsÌ16384Ö0Ïvolatile uint32_t
TmsÌ32768Ö0Ïvolatile uint32_t
UARTBUFSZÌ65536Ö0
@@ -3764,6 +3784,7 @@ USB_LPMCSR_REMWAKE
USB_PMAADDRÌ65536Ö0
VDDIO2_IRQHandlerÌ65536Ö0
VDDIO2_IRQnÌ65536Ö0
VERYLOW_SPEEDÌ4Îanon_enum_0Ö0
VREFINT_CAL_ADDRÌ65536Ö0
WCHAR_MAXÌ65536Ö0
WCHAR_MINÌ65536Ö0
@@ -3993,6 +4014,7 @@ __GXX_ABI_VERSION
__GXX_EXPERIMENTAL_CXX0X__Ì65536Ö0
__GXX_RTTIÌ65536Ö0
__GXX_WEAK__Ì65536Ö0
__HARDWARE_H__Ì65536Ö0
__HAVE_GENERIC_SELECTIONÌ65536Ö0
__IÌ65536Ö0
__ID_T_TYPEÌ65536Ö0
@@ -4100,6 +4122,7 @@ __S64_TYPE
__SCHAR_MAX__Ì65536Ö0
__SEG_FSÌ65536Ö0
__SEG_GSÌ65536Ö0
__SENSORS_MANAGE_H__Ì65536Ö0
__SHRT_MAX__Ì65536Ö0
__SIG_ATOMIC_MAX__Ì65536Ö0
__SIG_ATOMIC_MIN__Ì65536Ö0
@@ -4351,40 +4374,62 @@ __x86_64__
anon_enum_0Ì2Ö0
anon_enum_1Ì2Ö0
anon_enum_2Ì2Ö0
anon_enum_3Ì2Ö0
anon_enum_4Ì2Ö0
anon_enum_5Ì2Ö0
bufovrÌ16384Ö0Ïint
bufovrÌ32768Ö0Ïint
calc_tÌ16Í(uint32_t t, int i)Ö0Ïuint8_t
calc_tÌ16Í(uint32_t t, int i)Ö0Ïuint16_t
cntrÌ16384Ö0Ïuint32_t
coefficientsÌ16384Ö0Ïuint16_t
count_sensorsÌ16Í()Ö0Ïvoid
curI2CspeedÌ16384Ö0ÏI2C_SPEED
curI2CspeedÌ32768Ö0ÏI2C_SPEED
curr_mul_addrÌ16384Ö0Ïuint8_t
datalenÌ16384Ö0Ïint
dlenÌ16384Ö0Ïint
dma1_channel2_3_isrÌ16Í()Ö0Ïvoid
getcoefsprocÌ16Í()Ö0Ïuint8_t
gettempprocÌ16Í()Ö0Ïuint8_t
gpio_setupÌ16Í(void)Ö0Ïvoid
gpio_setupÌ1024Í(void)Ö0Ïvoid
i2c_setupÌ16Í(I2C_SPEED speed)Ö0Ïvoid
i2c_setupÌ1024Í(I2C_SPEED speed)Ö0Ïvoid
iwdg_setupÌ16Í()Ö0Ïvoid
lastSensTÌ16384Ö0Ïuint32_t
linerdyÌ16384Ö0Ïint
linerdyÌ32768Ö0Ïint
linuxÌ65536Ö0
mainÌ16Í(void)Ö0Ïint
msrtempprocÌ16Í()Ö0Ïuint8_t
newlineÌ16Í()Ö0Ïvoid
newlineÌ1024Í()Ö0Ïvoid
nopÌ131072Í()Ö0
overcurnt_ctrÌ16384Ö0Ïuint8_t
pin_clearÌ131072Í(gpioport,gpios)Ö0
pin_readÌ131072Í(gpioport,gpios)Ö0
pin_setÌ131072Í(gpioport,gpios)Ö0
pin_toggleÌ131072Í(gpioport,gpios)Ö0
pin_writeÌ131072Í(gpioport,gpios)Ö0
printuÌ16Í(uint32_t val)Ö0Ïvoid
printuÌ1024Í(uint32_t val)Ö0Ïvoid
rbufÌ16384Ö0Ïchar
rbufnoÌ16384Ö0Ïint
read_i2cÌ16Í(uint8_t addr, uint32_t *data, uint8_t nbytes)Ö0Ïuint8_t
read_i2cÌ1024Í(uint8_t addr, uint32_t *data, uint8_t nbytes)Ö0Ïuint8_t
recvdataÌ16384Ö0Ïchar *
showcoeffsÌ16Í(uint8_t addr, uint8_t verb)Ö0Ïvoid
resetprocÌ16Í()Ö0Ïuint8_t
sens_presentÌ16384Ö0Ïuint8_t
sensors_get_stateÌ16Í()Ö0ÏSensorsState
sensors_get_stateÌ1024Í()Ö0ÏSensorsState
sensors_offÌ16Í()Ö0Ïvoid
sensors_offÌ1024Í()Ö0Ïvoid
sensors_onÌ16Í()Ö0Ïvoid
sensors_onÌ1024Í()Ö0Ïvoid
sensors_processÌ16Í()Ö0Ïvoid
sensors_processÌ1024Í()Ö0Ïvoid
sensors_scanÌ16Í(uint8_t (* procfn)())Ö0Ïuint8_t
showcoeffsÌ16Í()Ö0Ïvoid
showcoeffsÌ1024Í()Ö0Ïvoid
showtemperatureÌ16Í()Ö0Ïvoid
showtemperatureÌ1024Í()Ö0Ïvoid
strdupaÌ131072Í(s)Ö0
strndupaÌ131072Í(s,n)Ö0
sys_tick_handlerÌ16Í(void)Ö0Ïvoid
@@ -4396,6 +4441,8 @@ unix
usart1_isrÌ16Í()Ö0Ïvoid
usart_getlineÌ16Í(char **line)Ö0Ïint
usart_getlineÌ1024Í(char **line)Ö0Ïint
usart_putcharÌ16Í(const char ch)Ö0Ïvoid
usart_putcharÌ1024Í(const char ch)Ö0Ïvoid
usart_sendÌ16Í(const char *str, int len)Ö0ÏTXstatus
usart_sendÌ1024Í(const char *str, int len)Ö0ÏTXstatus
usart_send_blockingÌ16Í(const char *str, int len)Ö0ÏTXstatus

View File

@@ -33,6 +33,12 @@
#define SEND(str) do{}while(LINE_BUSY == usart_send_blocking(str, sizeof(str)-1))
#define NEWLINE() do{}while(LINE_BUSY == usart_send_blocking('\n', 1))
#ifdef EBUG
#define MSG(str) SEND(str)
#else
#define MSG(str)
#endif
typedef enum{
ALL_OK,
LINE_BUSY,