mirror of
https://codeberg.org/SiB64/turbo_weather.git
synced 2026-05-01 15:14:22 +02:00
Compare commits
No commits in common. "920938165e6c8122d3c111ef8677d84de2c35102" and "df8cdf897cfdff65eb39e5bd9720683990f4d98e" have entirely different histories.
920938165e
...
df8cdf897c
4 changed files with 17 additions and 16 deletions
|
|
@ -7,7 +7,7 @@
|
|||
- `USART0-RxD/TxD-PB2…3`: transmission of data, receive commands
|
||||
- `PORTB-PB1`: enable the RF power regulator
|
||||
- `PORTA-PA5`: light up the LED
|
||||
- `ADC0-PA4,6,7`: read Batterie, NTC, and RF power voltage, and internal sources.
|
||||
- `ADC0-PA4,6…7: read Batterie, NTC, and RF power voltage, and internal sources.
|
||||
- `PIT`: generate clock tick, to wake the µC once per second from deep sleep.
|
||||
- `USERROW`: store persistent configuration
|
||||
- `EEPROM`: store `ADC` readings configuration, store sensor test data records.
|
||||
|
|
@ -52,8 +52,8 @@ is the number of readings sent in between without sending config records.
|
|||
Debug data is only available when not disabled during compilation. Do
|
||||
`make DEBUG=-DNODEBUG` to disable all debugging code and data.
|
||||
|
||||
The `SEND` flags are stored in byte[3] of the `config` structure to
|
||||
enable the respective output records, with the bit positions
|
||||
The `SEND` flags are stored in byte[3] of the `config` structure with
|
||||
the bit positions
|
||||
|
||||
- `SEND_CONFIG = 0x01`
|
||||
- `SEND_BATED = 0x02`
|
||||
|
|
@ -67,7 +67,7 @@ enable the respective output records, with the bit positions
|
|||
## Configuration
|
||||
|
||||
At boot, the configuration is copied from the `USERROW` to the
|
||||
`config` structure in `RAM`, if the first byte in the `USERROW` is
|
||||
`config` structure in `RAM`, iff the first byte in the `USERROW` is
|
||||
the magic `0xba`, and the second byte matches the version of the
|
||||
`config` structure, currently `0x08`. Else, the defaults are used.
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ The config structure is
|
|||
- `[11]`: `mclk_period`: `TCA0.SINGLE.CMP0` \[÷76\]
|
||||
- `[12]`: `baud_div`: two bytes little endian \[÷16667\]
|
||||
- `[14]`: `uart_mode`: `USART0.CTRLB`
|
||||
- `[15]`: `pit_period`: `RTC.CLKSEL` \[÷1024\]
|
||||
- `[15]`: `pit_period`: `RTC.CLKSEL` \[%1024\]
|
||||
- `[16]`: `immediate`: number of immediate readings at boot.
|
||||
|
||||
### Triggers
|
||||
|
|
@ -127,7 +127,7 @@ necessary to bias the NTC measured by ADC readings.
|
|||
## Commands
|
||||
|
||||
Commandlines received via the UART must be in the format
|
||||
- `«C» {[«space»]+ «hex»}+ [«space»]+ «linefeed»`
|
||||
- `«C» {[«space»] «hex»}+ [«space»]+ «linefeed»`
|
||||
|
||||
A command letter, uppercase, and up to seven (optionally space
|
||||
separated) hex bytes, optionally followed by more space characters and
|
||||
|
|
@ -148,22 +148,21 @@ additional byte.
|
|||
|
||||
### List of commands:
|
||||
|
||||
- `R «ccp»`: Reboot the µC. The argument byte must be `d8`, the
|
||||
- `R «ccp»`: Reboot the µC. The argument byte must be `d8` the
|
||||
`CCP[IOREG]` key, to validate the reset.
|
||||
|
||||
- `C «key» «bytes»…`: write to the `config` structure in `RAM`
|
||||
- `U «key» «bytes»…`: write to persistent config in the `USERROW`
|
||||
- `E «key» «bytes»…`: write to `EEPROM`
|
||||
|
||||
Up to six «bytes» are written. The «key» must be `9d`, the
|
||||
`CCP[SPM]` key, for the persistent stores, and `ba` for the `RAM`.
|
||||
These commands return the old value of the first byte that was
|
||||
written.
|
||||
Up to six «bytes» are written. The «key» must be `9d`, the `CCP[SPM]``
|
||||
key, for the persistent stores, and `ba` for the `RAM`. Prints
|
||||
the old value of the first bytes written to.
|
||||
|
||||
- `T «n»`: trigger «n» more immediate sensor readings.
|
||||
|
||||
- `M «aaaa»`: reads any memory address «aaaa» (two bytes, big endian)
|
||||
and prints the byte.
|
||||
- `M «aaaa»`: reads any memory address «aaaa» (two bytes) and prints the
|
||||
byte.
|
||||
|
||||
- `W «aaaa» «bb»`: write a byte «bb» into any address «aaaa», return
|
||||
the old value of that memory location.
|
||||
|
|
@ -172,7 +171,7 @@ additional byte.
|
|||
be sent little endian.
|
||||
|
||||
- `D «n»`: process and send calibrated readings for «n» test data
|
||||
records. The `EEPROM` has space for up to five data records.
|
||||
records. The `EEPROM` has space for up to five records.
|
||||
|
||||
## Toolchain
|
||||
|
||||
|
|
|
|||
2
src/bate_wdt.c
Normal file
2
src/bate_wdt.c
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#define WDT_TRIGGERED 1
|
||||
#include "bate.c"
|
||||
|
|
@ -55,7 +55,7 @@ TEMP = {TEMP*0.1:.1f} °C
|
|||
P = X*10//32 + 2500
|
||||
|
||||
print(f"""Pressure
|
||||
D1 = {D[1]} {D[1]-7168}
|
||||
D1 = {D[1]} {D[1]-7168}10
|
||||
TCO = {TCO}
|
||||
OFFT1 = {OFFT1}
|
||||
OFF = {OFF}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ refdes=R3
|
|||
T 55200 46600 5 10 0 1 90 0 1
|
||||
footprint=C0603.fp
|
||||
T 55450 46850 5 10 1 1 90 3 1
|
||||
value=220kΩ
|
||||
value=270kΩ
|
||||
T 55000 46600 5 10 0 0 90 0 1
|
||||
symversion=0.1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue