|
LevelMeter-Display
2.0
An ultrasonic Level Meter for Stormwater Cisterns
|
Routines for serial Communication. More...

Functions | |
| void | CopyRbuf1ToCmdline (void) |
| int | hprintf_P (const char *fmt,...) |
| printf_P for Communication with the Host More... | |
| void | InitUart () |
| Initialize USART Hardware and Pointers. More... | |
| ISR (USART0_TX_vect) | |
| USART0 Transmit Complete Interrupt. More... | |
| ISR (USART1_UDRE_vect) | |
| USART1 (Host-Interface) Data Register empty Interrupt. More... | |
| ISR (USART1_TX_vect) | |
| USART1 Transmit Complete Interrupt. More... | |
| ISR (USART0_RX_vect) | |
| Receive Interrupt for USART0 (sensor) More... | |
| ISR (USART1_RX_vect) | |
| USART1 Receive-Interrupt (Host-Interface) More... | |
| void | put0 (char c) |
| Sends a Character to USART0. More... | |
| void | putc0 (char c) |
| Sends a Command Char (bit9=1) over USART0. More... | |
| int | putc1 (char c) |
| Puts a char to USART1 (Host-Interface) More... | |
| int | putchar_uart1 (char c, FILE *stream) |
| The Putchar-Routine for USART1 (Host-Interface) More... | |
| void | putd0 (char c) |
| Sends a Data Char (bit9=0) over USART0. More... | |
| bool | Tbub1IsEmpty (void) |
| Tell if Transmit Buffer 1 is empty. More... | |
| void | usart1FlushRx (void) |
Variables | |
| volatile uint8_t | byteFromHost |
| Contains the last byte received from the host. More... | |
| uint8_t | charsInRbuf0 |
| volatile char | cksum0 |
| Keeps track of the Checksum for USART0. It is automatically reset by command bytes. More... | |
| uint8_t | computedChecksum |
| volatile uint8_t | hostCommandsLost |
| Counts the number of commands lost due to buffer overrun. More... | |
| volatile char | rbuf0 [UART0_BUFSIZE] |
| Receive Buffer for UART0. More... | |
| static volatile uint8_t | rbuf0_cksum |
| static volatile uint8_t | rbuf0_ptr |
| static volatile char | rbuf1 [UART1_BUFSIZE] |
| Receive Buffer for UART1. More... | |
| static volatile uint8_t | rbuf1_ptr |
| static volatile uint8_t | tbuf0_head |
| static volatile uint8_t | tbuf0_tail |
| static volatile char | tbuf1 [UART1_BUFSIZE] |
| Transmit Buffer for UART1. More... | |
| volatile uint8_t | tbuf1_head |
| volatile uint8_t | tbuf1_tail |
| FILE | uart1 =FDEV_SETUP_STREAM(putchar_uart1,NULL,_FDEV_SETUP_WRITE) |
Routines for serial Communication.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
| void CopyRbuf1ToCmdline | ( | void | ) |
| int hprintf_P | ( | const char * | fmt, |
| ... | |||
| ) |
printf_P for Communication with the Host
| fmt | Format String |
| ... | Additional Parameters |
References uart1.
Referenced by CmdAnalog(), CmdCalibrate(), CmdClearErrors(), CmdDebug(), CmdDistance(), CmdDumpConf(), CmdFTest(), CmdGetSensorValues(), CmdHelp(), CmdReset(), CmdSetBright(), CmdSetCistern(), CmdSetContrast(), CmdSetDCFInv(), CmdSetDisplay(), CmdSetOcr(), CmdSetPTime(), CmdSetPTimeK(), CmdSetSignal(), CmdSetSounds(), CmdSetSpontaneous(), CmdSetTime(), CmdStat(), CmdUseRts(), CmdWrite(), DCF77int(), DoCflags(), DoOneLine(), DoTflags(), DumpConfig(), DumpConfigSignal(), ExecCommand(), ExtraIgnored(), FTest(), FTestSupply(), FTestSWUnreg(), FTestToggleSignal(), FTestWalkingOne(), FTestWalkingZero(), HexDump(), MissingArg(), PrintError(), PrintPass(), ProgramSensor(), PushBit(), ReadIntelHex(), RTCsync(), UpdateSensorFirmware(), VerifySensor(), and VerifySensorFirmware().
| void InitUart | ( | void | ) |
Initialize USART Hardware and Pointers.
2 Stop-bits are used, USART0 connects to the sensor, uses 9-bit mode and parity, USART1 connects to the Host at 9600 baud, 8 bits and no parity.
References AssertRTS(), HOST_UBRR, and SENSOR_UBRR.
Referenced by Init().


| ISR | ( | USART0_TX_vect | ) |
USART0 Transmit Complete Interrupt.
Is only used to disable the RS485 line drivers.
References Uart0DisableLineDriver().

| ISR | ( | USART1_UDRE_vect | ) |
USART1 (Host-Interface) Data Register empty Interrupt.
References config, tbuf1, tbuf1_head, tbuf1_tail, UART1_BUFSIZE, UART1_CTS_MASK, UART1_PIN, Uart1EnableLineDriver(), and confStruct_t::useRts.

| ISR | ( | USART1_TX_vect | ) |
USART1 Transmit Complete Interrupt.
Transmission has been completed so the line driver is switched off.
References Uart1DisableLineDriver().

| ISR | ( | USART0_RX_vect | ) |
Receive Interrupt for USART0 (sensor)
USART0 receives not in buffered mode like the host communication does. USART0 resets the buffer pointer upon reception of a 9-bit char other than 1+0x00 and directly evaluates the buffer content on reception of the 9-bit char 1+0x00
References blFlags, BOOTLDDATA, BOOTLDERROR, BOOTLDHELLO, BOOTLDOK, bootLdPage, BOOTLDPROTECTED, CFLAG_CHECKSUMERROR, CFLAG_PARITYERROR, CFLAG_TEMPRECEIVED, CFLAG_TIMERECEIVED, cFlags, charsInRbuf0, computedChecksum, deadTime, displayValues, pulseTimeInt, pulseTimeMult, rbuf0, rbuf0_cksum, rbuf0_ptr, tempRaw, displayValues_t::tempSemi, and UART0_BUFSIZE.
| ISR | ( | USART1_RX_vect | ) |
USART1 Receive-Interrupt (Host-Interface)
This routine collects incoming characters until a complete host- or Bluetooth-command has been received.
References byteFromHost, CFLAG_BTRECEIVED, CFLAG_BYTERECEIVED, CFLAG_CMDRECEIVED, cFlags, config, CopyRbuf1ToCmdline(), hostCommandsLost, rbuf1, rbuf1_ptr, ReleaseRTS(), UART1_BUFSIZE, and confStruct_t::useRts.

| void put0 | ( | char | c | ) |
Sends a Character to USART0.
USART0 does not have a separate transmit buffer and does not use interrupts.
| c | The Character |
References cksum0, and Uart0EnableLineDriver().
Referenced by putc0(), and putd0().


| void putc0 | ( | char | c | ) |
Sends a Command Char (bit9=1) over USART0.
| c | The Character |
References cksum0, and put0().
Referenced by BootldRead(), BootldWrite(), UpdateSensorFirmware(), and VerifySensorFirmware().


| int putc1 | ( | char | c | ) |
Puts a char to USART1 (Host-Interface)
| c | The Character |
References tbuf1, tbuf1_head, tbuf1_tail, and UART1_BUFSIZE.
Referenced by putchar_uart1().

| int putchar_uart1 | ( | char | c, |
| FILE * | stream | ||
| ) |
The Putchar-Routine for USART1 (Host-Interface)
| c | The Character |
| stream | A Pointer to the File (unused) |
References putc1().

| void putd0 | ( | char | c | ) |
Sends a Data Char (bit9=0) over USART0.
| c | The Character |
References put0().
Referenced by BootldRead(), and BootldWrite().


| bool Tbub1IsEmpty | ( | void | ) |
Tell if Transmit Buffer 1 is empty.
References tbuf1_head, and tbuf1_tail.
Referenced by DoTflags().

| void usart1FlushRx | ( | void | ) |
References CFLAG_BTRECEIVED, CFLAG_BYTERECEIVED, CFLAG_CMDRECEIVED, cFlags, and rbuf1_ptr.
Referenced by CmdCalibrate().

| volatile uint8_t byteFromHost |
Contains the last byte received from the host.
Referenced by CmdCalibrate(), and ISR().
| uint8_t charsInRbuf0 |
Referenced by DoCflags(), and ISR().
| volatile char cksum0 |
Keeps track of the Checksum for USART0. It is automatically reset by command bytes.
Referenced by BootldRead(), BootldWrite(), put0(), and putc0().
| uint8_t computedChecksum |
Referenced by DoCflags(), and ISR().
| volatile uint8_t hostCommandsLost |
| volatile char rbuf0[UART0_BUFSIZE] |
Receive Buffer for UART0.
Referenced by DoCflags(), and ISR().
|
static |
Referenced by ISR().
|
static |
Referenced by ISR().
|
static |
Receive Buffer for UART1.
Referenced by CopyRbuf1ToCmdline(), and ISR().
|
static |
Referenced by CopyRbuf1ToCmdline(), ISR(), and usart1FlushRx().
|
static |
|
static |
|
static |
| volatile uint8_t tbuf1_head |
Referenced by ISR(), putc1(), Tbub1IsEmpty(), and UsartTimerCallback().
| volatile uint8_t tbuf1_tail |
Referenced by ISR(), putc1(), Tbub1IsEmpty(), and UsartTimerCallback().
| FILE uart1 =FDEV_SETUP_STREAM(putchar_uart1,NULL,_FDEV_SETUP_WRITE) |
Referenced by hprintf_P().
1.8.15