|
LevelMeter-Display
2.0
An ultrasonic Level Meter for Stormwater Cisterns
|


Go to the source code of this file.
Macros | |
| #define | HOST_BAUD 9600 |
| #define | HOST_UBRR (F_CPU/16/HOST_BAUD-1) |
| #define | SENSOR_BAUD 9600 |
| #define | SENSOR_UBRR (F_CPU/16/SENSOR_BAUD-1) |
| #define | UART0_BUFSIZE 40 |
| Size of the UART0 Buffers. More... | |
| #define | UART0_DE_MASK 0x04 |
| #define | UART0_PORT PORTE |
| #define | UART1_BUFSIZE 200 |
| UART1 really communicates, so a little more. More... | |
| #define | UART1_CTS_MASK 0x20 |
| #define | UART1_DE_MASK 0x02 |
| #define | UART1_PIN PIND |
| #define | UART1_PORT PORTD |
| #define | UART1_RTS_MASK 0x10 |
| #define | USE_RTS |
Functions | |
| static void | AssertRTS (void) |
| Asserts RTS to the Host Line, i.e. allows the Host to send Data. More... | |
| int | hprintf_P (const char *fmt,...) |
| printf_P for Communication with the Host More... | |
| void | InitUart (void) |
| Initialize USART Hardware and Pointers. More... | |
| void | putc0 (char) |
| Sends a Command Char (bit9=1) over USART0. More... | |
| int | putchar_uart1 (char, FILE *) |
| The Putchar-Routine for USART1 (Host-Interface) More... | |
| void | putd0 (char) |
| Sends a Data Char (bit9=0) over USART0. More... | |
| static void | ReleaseRTS (void) |
| Releases RTS to the Host Line, i.e. stops the Host from sending Data. More... | |
| bool | Tbub1IsEmpty (void) |
| Tell if Transmit Buffer 1 is empty. More... | |
| static void | Uart0DisableLineDriver (void) |
| Disables the RS485 Line Driver on Uart0. More... | |
| static void | Uart0EnableLineDriver (void) |
| Enables the RS485 Line Driver on Uart0. More... | |
| static void | Uart1DisableLineDriver (void) |
| Disables the RS485 Line Driver on Uart1. More... | |
| static void | Uart1EnableLineDriver (void) |
| Enables the RS485 Line Driver on Uart1. More... | |
| void | usart1FlushRx (void) |
| static void | UsartTimerCallback (void) |
| Timer Callback. Checks for CTS from the Host to resume Communication. More... | |
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 [] |
| Receive Buffer for UART0. More... | |
| volatile uint8_t | tbuf1_head |
| volatile uint8_t | tbuf1_tail |
| FILE | uart0 |
| FILE | uart1 |
| #define HOST_BAUD 9600 |
| #define HOST_UBRR (F_CPU/16/HOST_BAUD-1) |
| #define SENSOR_BAUD 9600 |
| #define SENSOR_UBRR (F_CPU/16/SENSOR_BAUD-1) |
| #define UART0_BUFSIZE 40 |
Size of the UART0 Buffers.
| #define UART0_DE_MASK 0x04 |
| #define UART0_PORT PORTE |
| #define UART1_BUFSIZE 200 |
UART1 really communicates, so a little more.
| #define UART1_CTS_MASK 0x20 |
| #define UART1_DE_MASK 0x02 |
| #define UART1_PIN PIND |
| #define UART1_PORT PORTD |
| #define UART1_RTS_MASK 0x10 |
| #define USE_RTS |
|
inlinestatic |
Asserts RTS to the Host Line, i.e. allows the Host to send Data.
References config, UART1_PORT, UART1_RTS_MASK, and confStruct_t::useRts.
Referenced by CmdCalibrate(), CmdDistance(), DoCflags(), EnterDouble(), InitUart(), and ReadIntelHex().

| 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().


| 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 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().


|
inlinestatic |
Releases RTS to the Host Line, i.e. stops the Host from sending Data.
References config, UART1_PORT, UART1_RTS_MASK, and confStruct_t::useRts.
Referenced by ISR().

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

|
inlinestatic |
Disables the RS485 Line Driver on Uart0.
References UART0_DE_MASK, and UART0_PORT.
Referenced by FTest485GetConnects(), and ISR().

|
inlinestatic |
Enables the RS485 Line Driver on Uart0.
References UART0_DE_MASK, and UART0_PORT.
Referenced by FTest485GetConnects(), and put0().

|
inlinestatic |
Disables the RS485 Line Driver on Uart1.
References UART1_DE_MASK, and UART1_PORT.
Referenced by FTest485GetConnects(), and ISR().

|
inlinestatic |
Enables the RS485 Line Driver on Uart1.
References UART1_DE_MASK, and UART1_PORT.
Referenced by FTest485GetConnects(), and ISR().

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

|
inlinestatic |
Timer Callback. Checks for CTS from the Host to resume Communication.
This function re-enables interrupts after CTS becomes true again and must be called periodically e.g. from timer interrupt.
References config, tbuf1_head, tbuf1_tail, UART1_CTS_MASK, UART1_PIN, and confStruct_t::useRts.
Referenced by ISR().

| 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[] |
Receive Buffer for UART0.
Referenced by DoCflags(), and ISR().
| 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 uart0 |
| FILE uart1 |
Referenced by hprintf_P().
1.8.15