├── CCS
├── driver
│ ├── vti_ps.c
│ ├── ez430_chronos_drivers.lib
│ ├── rf1a.h
│ ├── pmm.h
│ ├── radio.h
│ ├── adc12.h
│ ├── timer.h
│ ├── buzzer.h
│ ├── pmm.c
│ ├── vti_ps.h
│ ├── vti_as.h
│ ├── ports.h
│ ├── adc12.c
│ ├── radio.c
│ ├── buzzer.c
│ └── rf1a.c
├── change_record.txt
├── logic
│ ├── temperature.c
│ ├── temperature.h
│ ├── test.h
│ ├── chronic-extern.h
│ ├── rfbsl.h
│ ├── date.h
│ ├── user.h
│ ├── alarm.h
│ ├── clock.h
│ ├── battery.h
│ ├── acceleration.h
│ ├── altitude.h
│ ├── stopwatch.h
│ ├── menu.h
│ ├── rfsimpliciti.h
│ ├── rfbsl.c
│ ├── bluerobin.h
│ ├── battery.c
│ └── chronic.h
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.debug.core.prefs
│ ├── org.eclipse.ltk.core.refactoring.prefs
│ └── org.eclipse.cdt.managedbuilder.core.prefs
├── bluerobin
│ ├── BlueRobin_RX_433MHz.lib
│ ├── BlueRobin_RX_868MHz.lib
│ ├── BlueRobin_RX_915MHz.lib
│ └── BlueRobin_RX_API.h
├── simpliciti
│ ├── Components
│ │ ├── bsp
│ │ │ ├── bsp.c
│ │ │ ├── bsp.h
│ │ │ ├── bsp_macros.h
│ │ │ ├── drivers
│ │ │ │ ├── bsp_leds.h
│ │ │ │ ├── bsp_buttons.h
│ │ │ │ └── code
│ │ │ │ │ ├── bsp_leds.c
│ │ │ │ │ ├── bsp_buttons.c
│ │ │ │ │ ├── bsp_generic_leds.h
│ │ │ │ │ └── bsp_generic_buttons.h
│ │ │ ├── mcus
│ │ │ │ └── bsp_msp430_defs.h
│ │ │ └── boards
│ │ │ │ └── CC430EM
│ │ │ │ ├── bsp_board.c
│ │ │ │ ├── bsp_config.h
│ │ │ │ ├── bsp_drivers.c
│ │ │ │ ├── bsp_led_defs.h
│ │ │ │ ├── bsp_board_defs.h
│ │ │ │ ├── bsp_button_defs.h
│ │ │ │ ├── bsp_driver_defs.h
│ │ │ │ └── bsp_external
│ │ │ │ └── mrfi_board_defs.h
│ │ ├── mrfi
│ │ │ ├── mrfi.c
│ │ │ ├── mrfi.h
│ │ │ ├── mrfi_defs.h
│ │ │ ├── radios
│ │ │ │ └── family5
│ │ │ │ │ ├── mrfi_radio.c
│ │ │ │ │ ├── mrfi_radio_interface.c
│ │ │ │ │ └── mrfi_radio_interface.h
│ │ │ └── smartrf
│ │ │ │ └── CC430
│ │ │ │ └── smartrf_CC430.h
│ │ ├── nwk
│ │ │ ├── nwk.c
│ │ │ ├── nwk.h
│ │ │ ├── nwk_api.c
│ │ │ ├── nwk_api.h
│ │ │ ├── nwk_app.h
│ │ │ ├── nwk_QMgmt.c
│ │ │ ├── nwk_QMgmt.h
│ │ │ ├── nwk_frame.c
│ │ │ ├── nwk_frame.h
│ │ │ ├── nwk_types.h
│ │ │ ├── nwk_globals.c
│ │ │ └── nwk_globals.h
│ │ └── nwk_applications
│ │ │ ├── nwk_freq.c
│ │ │ ├── nwk_freq.h
│ │ │ ├── nwk_ioctl.c
│ │ │ ├── nwk_ioctl.h
│ │ │ ├── nwk_join.c
│ │ │ ├── nwk_join.h
│ │ │ ├── nwk_link.c
│ │ │ ├── nwk_link.h
│ │ │ ├── nwk_mgmt.c
│ │ │ ├── nwk_mgmt.h
│ │ │ ├── nwk_ping.c
│ │ │ ├── nwk_ping.h
│ │ │ ├── nwk_security.c
│ │ │ └── nwk_security.h
│ ├── CC430_End_Device_433MHz.lib
│ ├── CC430_End_Device_868MHz.lib
│ ├── CC430_End_Device_915MHz.lib
│ ├── Applications
│ │ ├── configuration
│ │ │ ├── smpl_nwk_config.dat
│ │ │ └── End Device
│ │ │ │ └── smpl_config.dat
│ │ └── application
│ │ │ └── End Device
│ │ │ └── main_ED_BM.c
│ ├── simpliciti_readme.txt
│ └── simpliciti.h
├── 433MHz - Unrestricted CCS Platinum
│ └── ChronIC_433MHz.out
├── 868MHz - Unrestricted CCS Platinum
│ └── ChronIC_868MHz.out
├── .ccsproject
├── .project_initial
├── .cdtproject
├── CC430F6137.ccxml
├── .project
└── include
│ └── project.h
├── python
├── setup.py
├── chronic.py
└── chronic-cli.py
└── README.md
/CCS/driver/vti_ps.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/driver/vti_ps.c
--------------------------------------------------------------------------------
/CCS/change_record.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/change_record.txt
--------------------------------------------------------------------------------
/CCS/logic/temperature.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/logic/temperature.c
--------------------------------------------------------------------------------
/CCS/logic/temperature.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/logic/temperature.h
--------------------------------------------------------------------------------
/CCS/.settings/org.eclipse.cdt.codan.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | inEditor=false
3 | onBuild=false
4 |
--------------------------------------------------------------------------------
/CCS/bluerobin/BlueRobin_RX_433MHz.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/bluerobin/BlueRobin_RX_433MHz.lib
--------------------------------------------------------------------------------
/CCS/bluerobin/BlueRobin_RX_868MHz.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/bluerobin/BlueRobin_RX_868MHz.lib
--------------------------------------------------------------------------------
/CCS/bluerobin/BlueRobin_RX_915MHz.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/bluerobin/BlueRobin_RX_915MHz.lib
--------------------------------------------------------------------------------
/CCS/driver/ez430_chronos_drivers.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/driver/ez430_chronos_drivers.lib
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/bsp.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/bsp.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/bsp.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/bsp.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/mrfi/mrfi.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/mrfi/mrfi.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/mrfi/mrfi.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/mrfi/mrfi.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_api.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_api.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_api.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_api.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_app.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_app.h
--------------------------------------------------------------------------------
/CCS/simpliciti/CC430_End_Device_433MHz.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/CC430_End_Device_433MHz.lib
--------------------------------------------------------------------------------
/CCS/simpliciti/CC430_End_Device_868MHz.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/CC430_End_Device_868MHz.lib
--------------------------------------------------------------------------------
/CCS/simpliciti/CC430_End_Device_915MHz.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/CC430_End_Device_915MHz.lib
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/bsp_macros.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/bsp_macros.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/mrfi/mrfi_defs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/mrfi/mrfi_defs.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_QMgmt.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_QMgmt.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_QMgmt.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_QMgmt.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_frame.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_frame.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_frame.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_frame.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_types.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_types.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_globals.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_globals.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk/nwk_globals.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk/nwk_globals.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/drivers/bsp_leds.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/drivers/bsp_leds.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/drivers/bsp_buttons.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/drivers/bsp_buttons.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/mcus/bsp_msp430_defs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/mcus/bsp_msp430_defs.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/drivers/code/bsp_leds.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/drivers/code/bsp_leds.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_freq.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_freq.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_freq.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_freq.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_ioctl.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_ioctl.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_ioctl.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_ioctl.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_join.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_join.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_join.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_join.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_link.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_link.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_link.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_link.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_mgmt.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_mgmt.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_mgmt.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_mgmt.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_ping.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_ping.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_ping.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_ping.h
--------------------------------------------------------------------------------
/CCS/433MHz - Unrestricted CCS Platinum/ChronIC_433MHz.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/433MHz - Unrestricted CCS Platinum/ChronIC_433MHz.out
--------------------------------------------------------------------------------
/CCS/868MHz - Unrestricted CCS Platinum/ChronIC_868MHz.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/868MHz - Unrestricted CCS Platinum/ChronIC_868MHz.out
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_board.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_board.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_config.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_config.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/drivers/code/bsp_buttons.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/drivers/code/bsp_buttons.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_security.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_security.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/nwk_applications/nwk_security.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/nwk_applications/nwk_security.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_drivers.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_drivers.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_led_defs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_led_defs.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/mrfi/radios/family5/mrfi_radio.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/mrfi/radios/family5/mrfi_radio.c
--------------------------------------------------------------------------------
/CCS/.settings/org.eclipse.cdt.debug.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
3 |
--------------------------------------------------------------------------------
/CCS/simpliciti/Applications/configuration/smpl_nwk_config.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Applications/configuration/smpl_nwk_config.dat
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_board_defs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_board_defs.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_button_defs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_button_defs.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_driver_defs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_driver_defs.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/drivers/code/bsp_generic_leds.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/drivers/code/bsp_generic_leds.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Applications/application/End Device/main_ED_BM.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Applications/application/End Device/main_ED_BM.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/drivers/code/bsp_generic_buttons.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/drivers/code/bsp_generic_buttons.h
--------------------------------------------------------------------------------
/CCS/simpliciti/Applications/configuration/End Device/smpl_config.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Applications/configuration/End Device/smpl_config.dat
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/mrfi/radios/family5/mrfi_radio_interface.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/mrfi/radios/family5/mrfi_radio_interface.c
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/mrfi/radios/family5/mrfi_radio_interface.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/mrfi/radios/family5/mrfi_radio_interface.h
--------------------------------------------------------------------------------
/CCS/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | #Tue Oct 12 16:47:51 CEST 2010
2 | eclipse.preferences.version=1
3 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
4 |
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_external/mrfi_board_defs.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamLaurie/ChronIC/HEAD/CCS/simpliciti/Components/bsp/boards/CC430EM/bsp_external/mrfi_board_defs.h
--------------------------------------------------------------------------------
/python/setup.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | from distutils.core import setup
4 |
5 | scripts = ['chronic-cli.py']
6 | modules = ['chronic']
7 |
8 | setup (name = 'chronic-cli',
9 | version = '1.0',
10 | description = "ChronIC wearable RF hacking tool CLI",
11 | author = 'Adam Laurie',
12 | author_email = 'adam@aperturelabs.com',
13 | scripts = scripts,
14 | py_modules = modules
15 | )
16 |
--------------------------------------------------------------------------------
/CCS/.ccsproject:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/CCS/.project_initial:
--------------------------------------------------------------------------------
1 |
2 |
3 | ChronIC
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.core.cnature
16 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
17 | org.eclipse.cdt.core.ccnature
18 | com.ti.ccstudio.managedbuild.core.ccsNature
19 |
20 |
21 |
--------------------------------------------------------------------------------
/CCS/.cdtproject:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/CCS/CC430F6137.ccxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/CCS/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | ChronIC
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
15 | full,incremental,
16 |
17 |
18 |
19 |
20 |
21 | org.eclipse.cdt.core.cnature
22 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
23 | org.eclipse.cdt.core.ccnature
24 | com.ti.ccstudio.core.ccsNature
25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/CCS/driver/rf1a.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Actual revision: $Revision: $
4 | // Revision label: $Name: $
5 | // Revision state: $State: $
6 | //
7 | // *************************************************************************************************
8 | // Radio core access functions. Taken from TI reference code for CC430.
9 | // *************************************************************************************************
10 |
11 | // *************************************************************************************************
12 | // Prototype section
13 | unsigned char Strobe(unsigned char strobe);
14 | unsigned char ReadSingleReg(unsigned char addr);
15 | void WriteSingleReg(unsigned char addr, unsigned char value);
16 | void ReadBurstReg(unsigned char addr, unsigned char *buffer, unsigned char count);
17 | void WriteBurstReg(unsigned char addr, unsigned char *buffer, unsigned char count);
18 | void ResetRadioCore(void);
19 | void WritePATable(unsigned char value);
20 | void WaitForXT2(void);
21 |
--------------------------------------------------------------------------------
/CCS/driver/pmm.h:
--------------------------------------------------------------------------------
1 | //====================================================================
2 | // File: PMM.h
3 | //
4 | // This file is used in conjunction with PMM.c to set the core
5 | // voltage level of a device. To set a core voltage level, call
6 | // SetVCore(level). See RF project(s) for example usage.
7 | //
8 | // Version 1.0 first
9 | // 07/14/07
10 | //
11 | //====================================================================
12 |
13 | #ifndef __PMM
14 | #define __PMM
15 |
16 | //====================================================================
17 |
18 | /**
19 | * Set the VCore to a new level
20 | *
21 | * \param level PMM level ID
22 | */
23 | void SetVCore(unsigned char level);
24 |
25 | //====================================================================
26 |
27 | /**
28 | * Set the VCore to a new higher level
29 | *
30 | * \param level PMM level ID
31 | */
32 | void SetVCoreUp(unsigned char level);
33 |
34 | //====================================================================
35 |
36 | /**
37 | * Set the VCore to a new Lower level
38 | *
39 | * \param level PMM level ID
40 | */
41 | void SetVCoreDown(unsigned char level);
42 |
43 | #endif /* __PMM */
44 |
--------------------------------------------------------------------------------
/CCS/simpliciti/simpliciti_readme.txt:
--------------------------------------------------------------------------------
1 | Some notes about the SimpliciTI configuration used in this project
2 |
3 | - The source code is based on the SimpliciTI 1.1.1 release.
4 |
5 | - A full SimpliciTI installation contains configurations for many targets and device types. To avoid confusion,
6 | only the configuration (End Device) and target files (CC430EM) required for the eZ430-Chronos have been used.
7 |
8 | - All source code files have been copied into the project physically. Symbolic links have been replaced with
9 | the real source code file.
10 |
11 | - Due to the indirect inclusion scheme of hardware-dependent source code, some source code files have been
12 | excluded from build. However, they will be included through higher level source code.
13 |
14 | - Some modifications where required to the original source code. All these changes have been marked with [BM].
15 |
16 | bsp_board.c/BSP_InitBoard(void) Changed from TA0 to TA1 for delay function, because TA0 is already occupied.
17 |
18 | bsp_msp430_defs.h/BSP_EarlyInit(void) Function removed, because SimpliciTI must run in watch context
19 |
20 | mrfi_radio_interface.c/mrfiRadioInterfaceCmdStrobe(uint8_t addr)
21 | Added code to properly synchronize with radio interface. Otherwise
22 | interface could get stuck.
23 |
24 | mrfi_radio.c Changed channel assignment (mrfiLogicalChanTable) for three ISM bands
25 | Changed power output settings (mrfiRFPowerTable) for three ISM bands
26 |
27 | mrfi_radio.c/MRFI_Init(void) Added frequency offset correction to use calibrated frequency offset
28 | when starting RF communication
29 |
30 | mrfi_radio.c/MRFI_RadioIsr(void) Changed radio ISR to normal function, since we have a shared radio ISR
31 |
32 | nwk_api.c Made variable sInit_done globally available to allow SimpliciTI to shutdown
33 | and restart multiple times
34 |
35 | nwk.c/nwk_nwkInit Added workaround to allow allow SimpliciTI to shutdown
36 | and restart multiple times
37 |
38 | - If you (for whatever reason) want to upgrade to a newer version of SimpliciTI, please bear in mind that
39 |
40 | a) the access point SimpliciTI version is 1.1.1 (and cannot be updated)
41 |
42 | b) the workarounds used here to enable SimpliciTI to shutdown and restart multiple times might not necessarily
43 | work when used with later revisions
44 |
45 |
46 |
--------------------------------------------------------------------------------
/CCS/driver/radio.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef RADIO_H_
37 | #define RADIO_H_
38 |
39 | extern void radio_reset(void);
40 | extern void radio_powerdown(void);
41 | extern void radio_sxoff(void);
42 | extern void radio_idle(void);
43 | extern void open_radio(void);
44 | extern void close_radio(void);
45 | extern void pmm_set_high_current_mode(void);
46 | extern void pmm_set_low_current_mode(void);
47 |
48 | #endif /*RADIO_H_ */
49 |
--------------------------------------------------------------------------------
/CCS/logic/test.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 | // Test functions.
36 | // *************************************************************************************************
37 |
38 | #ifndef TEST_H_
39 | #define TEST_H_
40 |
41 | // *************************************************************************************************
42 | // Extern section
43 | extern void test_mode(void);
44 | extern void display_all_on(void);
45 | extern void display_all_off(void);
46 |
47 | #endif /*TEST_H_ */
48 |
--------------------------------------------------------------------------------
/CCS/logic/chronic-extern.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2013 Aperture Labs Ltd. - http://aperturelabs.com/
4 | //
5 | // Author: Adam Laurie
6 | //
7 | //
8 | // Redistribution and use in source and binary forms, with or without
9 | // modification, are permitted provided that the following conditions
10 | // are met:
11 | //
12 | // Redistributions of source code must retain the above copyright
13 | // notice, this list of conditions and the following disclaimer.
14 | //
15 | // Redistributions in binary form must reproduce the above copyright
16 | // notice, this list of conditions and the following disclaimer in the
17 | // documentation and/or other materials provided with the
18 | // distribution.
19 | //
20 | // Neither the name of Aperture Labs Ltd. nor the names of
21 | // its contributors may be used to endorse or promote products derived
22 | // from this software without specific prior written permission.
23 | //
24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 | //
36 | // *************************************************************************************************
37 | //
38 |
39 |
40 | extern unsigned char Button_Up_Data[BUTTON_SEQUENCES][BUTTON_DATA_SIZE];
41 | extern unsigned char Up_Buttons; // number of different up sequences to transmit
42 | extern unsigned char Button_Down_Data[BUTTON_SEQUENCES][BUTTON_DATA_SIZE];
43 | extern unsigned char Down_Buttons; // number of different down sequences to transmit
44 | extern unsigned char Button_Delay;
45 | extern unsigned char Button_Repeat;
46 | extern unsigned char Emulation_Mode;
47 | extern RADIO_REGS ChronicRF;
48 |
--------------------------------------------------------------------------------
/CCS/logic/rfbsl.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef RFBSL_H_
37 | #define RFBSL_H_
38 |
39 | // *************************************************************************************************
40 | // Prototypes section
41 | extern void sx_rfbsl(u8 line);
42 | extern void display_rfbsl(u8 line, u8 update);
43 |
44 | // *************************************************************************************************
45 | // Defines section
46 |
47 | // Entry point of of the Flash Updater in BSL memory
48 | #define CALL_RFSBL() ((void (*)()) 0x1000)()
49 |
50 |
51 | // *************************************************************************************************
52 | // Global Variable section
53 | extern u8 rfBSL_button_confirmation;
54 |
55 | #endif /*RFBSL_H_ */
56 |
--------------------------------------------------------------------------------
/CCS/driver/adc12.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef ADC12_H_
37 | #define ADC12_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 | extern u16 adc12_single_conversion(u16 ref, u16 sht, u16 channel);
45 |
46 | // *************************************************************************************************
47 | // Defines section
48 |
49 | // *************************************************************************************************
50 | // Global Variable section
51 | extern u16 adc12_result;
52 | extern u8 adc12_data_ready;
53 |
54 | // *************************************************************************************************
55 | // Extern section
56 |
57 | #endif /*ADC12_H_ */
58 |
--------------------------------------------------------------------------------
/CCS/logic/date.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef DATE_H_
37 | #define DATE_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 | extern void reset_date(void);
45 | extern void add_day(void);
46 | extern void mx_date(u8 line);
47 | extern void sx_date(u8 line);
48 | extern void display_date(u8 line, u8 update);
49 |
50 | // *************************************************************************************************
51 | // Defines section
52 |
53 | // *************************************************************************************************
54 | // Global Variable section
55 | struct date
56 | {
57 | u8 display; // Toggles view between DISPLAY_DEFAULT_VIEW = DD.MM and
58 | // DISPLAY_ALTERNATIVE_VIEW = YYYY
59 | u8 day;
60 | u8 month;
61 | u16 year;
62 | };
63 | extern struct date sDate;
64 |
65 | // *************************************************************************************************
66 | // Extern section
67 |
68 | #endif /*DATE_H_ */
69 |
--------------------------------------------------------------------------------
/CCS/.settings/org.eclipse.cdt.managedbuilder.core.prefs:
--------------------------------------------------------------------------------
1 | #Thu Oct 21 17:01:30 CEST 2010
2 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1112165763/internalBuilder/enabled=false
3 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1112165763/internalBuilder/ignoreErr=true
4 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1257141332/internalBuilder/enabled=false
5 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1257141332/internalBuilder/ignoreErr=true
6 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1482413833/internalBuilder/enabled=false
7 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1482413833/internalBuilder/ignoreErr=true
8 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1720680788/internalBuilder/enabled=false
9 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1720680788/internalBuilder/ignoreErr=true
10 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1834157678/internalBuilder/enabled=false
11 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.1834157678/internalBuilder/ignoreErr=true
12 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.2047404142/internalBuilder/enabled=false
13 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.2047404142/internalBuilder/ignoreErr=true
14 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.2101481428/internalBuilder/enabled=false
15 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.2101481428/internalBuilder/ignoreErr=true
16 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.518486332/internalBuilder/enabled=false
17 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.518486332/internalBuilder/ignoreErr=true
18 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.572603594/internalBuilder/enabled=false
19 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.572603594/internalBuilder/ignoreErr=true
20 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.577917970/internalBuilder/enabled=false
21 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.577917970/internalBuilder/ignoreErr=true
22 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.767845949/internalBuilder/enabled=false
23 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.767845949/internalBuilder/ignoreErr=true
24 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.82500526/internalBuilder/enabled=false
25 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.82500526/internalBuilder/ignoreErr=true
26 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.855263628/internalBuilder/enabled=false
27 | com.ti.ccstudio.buildDefinitions.MSP430.Debug.855263628/internalBuilder/ignoreErr=true
28 | eclipse.preferences.version=1
29 | environment/project=\r\n\r\n
30 | environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1257141332=\r\n\r\n
31 | environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1834157678=\r\n\r\n
32 | environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.2047404142=\r\n\r\n
33 | environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.2101481428=\r\n\r\n
34 | environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.518486332=\r\n\r\n
35 | environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.82500526=\r\n\r\n
36 |
--------------------------------------------------------------------------------
/CCS/logic/user.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef USER_H_
37 | #define USER_H_
38 |
39 | // *************************************************************************************************
40 | // Defines section
41 | #define SETVALUE_ROLLOVER_VALUE BIT0
42 | #define SETVALUE_DISPLAY_VALUE BIT1
43 | #define SETVALUE_DISPLAY_ARROWS BIT2
44 | #define SETVALUE_DISPLAY_SELECTION BIT3
45 | #define SETVALUE_FAST_MODE BIT4
46 | #define SETVALUE_NEXT_VALUE BIT5
47 |
48 | // *************************************************************************************************
49 | // Prototypes section
50 | extern u8 *select_view_style(u8 line, u8 * view1, u8 * view2);
51 |
52 | extern void (*fptr_setValue_display_function1)(u8 segments, u32 value, u8 digits, u8 blanks);
53 | extern void set_value(s32 * value, u8 digits, u8 blanks, s32 limitLow, s32 limitHigh, u16 mode,
54 | u8 segments,
55 | void (*fptr_setValue_display_function1)(u8 segments, u32 value, u8 digits,
56 | u8 blanks));
57 | extern void dummy(u8 line);
58 |
59 | #endif /*USER_H_ */
60 |
--------------------------------------------------------------------------------
/CCS/driver/timer.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef TIMER_H_
37 | #define TIMER_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 | extern void Timer0_Init(void);
45 | extern void Timer0_Start(void);
46 | extern void Timer0_Stop(void);
47 | extern void Timer0_A3_Start(u16 ticks);
48 | extern void Timer0_A3_Stop(void);
49 | extern void Timer0_A4_Delay(u16 ticks);
50 |
51 | extern void (*fptr_Timer0_A3_function)(void);
52 |
53 | // *************************************************************************************************
54 | // Defines section
55 | struct timer
56 | {
57 | // Timer0_A3 periodic delay
58 | u16 timer0_A3_ticks;
59 | };
60 | extern struct timer sTimer;
61 |
62 | // Trigger reset when all buttons are pressed
63 | #define BUTTON_RESET_SEC (3u)
64 |
65 | // *************************************************************************************************
66 | // Global Variable section
67 |
68 | // *************************************************************************************************
69 | // Extern section
70 |
71 | #endif /*TIMER_H_ */
72 |
--------------------------------------------------------------------------------
/CCS/logic/alarm.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | // *************************************************************************************************
37 | // Include section
38 |
39 | // *************************************************************************************************
40 | // Prototypes section
41 |
42 | // internal functions
43 | extern void reset_alarm(void);
44 | extern void check_alarm(void);
45 | extern void stop_alarm(void);
46 |
47 | // menu functions
48 | extern void sx_alarm(u8 line);
49 | extern void mx_alarm(u8 line);
50 | extern void display_alarm(u8 line, u8 update);
51 |
52 | // *************************************************************************************************
53 | // Defines section
54 |
55 | // Alarm states
56 | #define ALARM_DISABLED (0u)
57 | #define ALARM_ENABLED (1u)
58 | #define ALARM_ON (2u)
59 |
60 | // Keep alarm for 10 on-off cycles
61 | #define ALARM_ON_DURATION (10u)
62 |
63 | // *************************************************************************************************
64 | // Global Variable section
65 | struct alarm
66 | {
67 | u8 state; // ALARM_DISABLED, ALARM_ENABLED, ALARM_ON
68 | u8 duration; // Alarm duration
69 | u8 hour; // Alarm hour
70 | u8 minute; // Alarm minute
71 | };
72 | extern struct alarm sAlarm;
73 |
74 | // *************************************************************************************************
75 | // Extern section
76 |
--------------------------------------------------------------------------------
/CCS/logic/clock.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef CLOCK_H_
37 | #define CLOCK_H_
38 |
39 | // *************************************************************************************************
40 | // Defines section
41 |
42 | // Definitions for time format
43 | #define TIMEFORMAT_24H (0u)
44 | #define TIMEFORMAT_12H (1u)
45 |
46 | // *************************************************************************************************
47 | // Prototypes section
48 | extern void reset_clock(void);
49 | extern void sx_time(u8 line);
50 | extern void mx_time(u8 line);
51 | extern void clock_tick(void);
52 | extern void display_selection_Timeformat1(u8 segments, u32 index, u8 digits, u8 blanks);
53 | extern void display_time(u8 line, u8 update);
54 |
55 | // English units support
56 | extern void calc_24H_to_12H(u8 * hours, u8 * timeAM);
57 | extern u8 convert_hour_to_12H_format(u8 hour);
58 | extern u8 is_hour_am(u8 hour);
59 |
60 | // *************************************************************************************************
61 | // Global Variable section
62 | struct time
63 | {
64 | u32 system_time; // Global system time. Used to calculate last activity
65 | u32 last_activity; // Inactivity detection (exits set_value() function)
66 | u8 drawFlag; // Flag to minimize display updates
67 | u8 line1ViewStyle; // Viewing style
68 | u8 hour; // Time data
69 | u8 minute; // Time data
70 | u8 second; // Time data
71 | };
72 | extern struct time sTime;
73 |
74 | #endif /*CLOCK_H_ */
75 |
--------------------------------------------------------------------------------
/CCS/logic/battery.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef BATTERY_H_
37 | #define BATTERY_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 |
45 | // Internal functions
46 | extern void reset_batt_measurement(void);
47 | extern void battery_measurement(void);
48 |
49 | // Menu functions
50 | extern void display_battery_V(u8 line, u8 update);
51 |
52 | // *************************************************************************************************
53 | // Defines section
54 |
55 | // Battery high voltage threshold
56 | #define BATTERY_HIGH_THRESHOLD (360u)
57 |
58 | // Battery end of life voltage threshold -> disable radio, show "lobatt" message
59 | #define BATTERY_LOW_THRESHOLD (240u)
60 |
61 | // Show "lobatt" message every n seconds
62 | #define BATTERY_LOW_MESSAGE_CYCLE (15u)
63 |
64 | // *************************************************************************************************
65 | // Global Variable section
66 | struct batt
67 | {
68 | menu_t state; // MENU_ITEM_NOT_VISIBLE, MENU_ITEM_VISIBLE
69 | u8 lobatt_display; // Counter for alternating "lobatt" display
70 | u16 voltage; // Battery voltage
71 | s16 offset; // Battery voltage offset
72 | };
73 | extern struct batt sBatt;
74 |
75 | // *************************************************************************************************
76 | // Extern section
77 |
78 | #endif /*BATTERY_H_ */
79 |
--------------------------------------------------------------------------------
/CCS/logic/acceleration.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef ACCELERATION_H_
37 | #define ACCELERATION_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 |
45 | // *************************************************************************************************
46 | // Defines section
47 | #define DISPLAY_ACCEL_X (0u)
48 | #define DISPLAY_ACCEL_Y (1u)
49 | #define DISPLAY_ACCEL_Z (2u)
50 |
51 | #define ACCEL_MODE_OFF (0u)
52 | #define ACCEL_MODE_ON (1u)
53 |
54 | // Stop acceleration measurement after 60 minutes to save battery
55 | #define ACCEL_MEASUREMENT_TIMEOUT (60 * 60u)
56 |
57 | // *************************************************************************************************
58 | // Global Variable section
59 | struct accel
60 | {
61 | u8 mode; // ACC_MODE_OFF, ACC_MODE_ON
62 | u8 xyz[3]; // Sensor raw data
63 | u16 data; // Acceleration data in 10 * mgrav
64 | u8 view_style; // Display X/Y/Z values
65 | u16 timeout; // Timeout
66 | };
67 | extern struct accel sAccel;
68 |
69 | // *************************************************************************************************
70 | // Extern section
71 | extern void reset_acceleration(void);
72 | extern void sx_acceleration(u8 line);
73 | extern void display_acceleration(u8 line, u8 update);
74 | extern u8 is_acceleration_measurement(void);
75 | extern void do_acceleration_measurement(void);
76 |
77 | #endif /*ACCELERATION_H_ */
78 |
--------------------------------------------------------------------------------
/CCS/logic/altitude.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef ALTITUDE_H_
37 | #define ALTITUDE_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 | extern void reset_altitude_measurement(void);
45 | extern u8 is_altitude_measurement(void);
46 | extern void start_altitude_measurement(void);
47 | extern void stop_altitude_measurement(void);
48 | extern void do_altitude_measurement(u8 filter);
49 |
50 | // menu functions
51 | extern void sx_altitude(u8 line);
52 | extern void mx_altitude(u8 line);
53 | extern void display_altitude(u8 line, u8 update);
54 |
55 | // *************************************************************************************************
56 | // Defines section
57 | #define ALTITUDE_MEASUREMENT_TIMEOUT (60 * 60u) // Stop altitude measurement after 60 minutes to
58 | // save battery
59 |
60 | // *************************************************************************************************
61 | // Global Variable section
62 | struct alt
63 | {
64 | menu_t state; // MENU_ITEM_NOT_VISIBLE, MENU_ITEM_VISIBLE
65 | u32 pressure; // Pressure (Pa)
66 | u16 temperature; // Temperature (K)
67 | s16 altitude; // Altitude (m)
68 | s16 altitude_offset; // Altitude offset stored during calibration
69 | u16 timeout; // Timeout
70 | };
71 | extern struct alt sAlt;
72 |
73 | // *************************************************************************************************
74 | // Extern section
75 |
76 | #endif /*ALTITUDE_H_ */
77 |
--------------------------------------------------------------------------------
/CCS/driver/buzzer.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef BUZZER_H_
37 | #define BUZZER_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 | extern void reset_buzzer(void);
45 | extern void start_buzzer(u8 cycles, u16 on_time, u16 off_time);
46 | extern void stop_buzzer(void);
47 | extern void toggle_buzzer(void);
48 | extern u8 is_buzzer(void);
49 | extern void countdown_buzzer(void);
50 |
51 | // *************************************************************************************************
52 | // Defines section
53 |
54 | // Buzzer states
55 | #define BUZZER_OFF (0u)
56 | #define BUZZER_ON_OUTPUT_DISABLED (1u)
57 | #define BUZZER_ON_OUTPUT_ENABLED (2u)
58 |
59 | // Buzzer output signal frequency = 32,768kHz/(BUZZER_TIMER_STEPS+1)/2 = 2.7kHz
60 | #define BUZZER_TIMER_STEPS (5u)
61 |
62 | // Buzzer on time
63 | #define BUZZER_ON_TICKS (CONV_MS_TO_TICKS(20))
64 |
65 | // Buzzer off time
66 | #define BUZZER_OFF_TICKS (CONV_MS_TO_TICKS(200))
67 |
68 | // *************************************************************************************************
69 | // Global Variable section
70 | struct buzzer
71 | {
72 | // Keep output for "time" seconds
73 | u8 time;
74 |
75 | // On/off duty
76 | u16 on_time;
77 | u16 off_time;
78 |
79 | // Current buzzer output state
80 | u8 state;
81 | };
82 | extern struct buzzer sBuzzer;
83 |
84 | // *************************************************************************************************
85 | // Extern section
86 |
87 | #endif /*BUZZER_H_ */
88 |
--------------------------------------------------------------------------------
/CCS/logic/stopwatch.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef STOPWATCH_H_
37 | #define STOPWATCH_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 | #include
42 |
43 | // *************************************************************************************************
44 | // Prototypes section
45 | extern void start_stopwatch(void);
46 | extern void stop_stopwatch(void);
47 | extern void reset_stopwatch(void);
48 | extern u8 is_stopwatch(void);
49 | extern void stopwatch_tick(void);
50 | extern void update_stopwatch_timer(void);
51 | extern void mx_stopwatch(u8 line);
52 | extern void sx_stopwatch(u8 line);
53 | extern void display_stopwatch(u8 line, u8 update);
54 |
55 | // *************************************************************************************************
56 | // Defines section
57 | #define STOPWATCH_1HZ_TICK (32768 / 1)
58 | #define STOPWATCH_100HZ_TICK (32768 / 100)
59 | #define STOPWATCH_STOP (0u)
60 | #define STOPWATCH_RUN (1u)
61 | #define STOPWATCH_HIDE (2u)
62 |
63 | // *************************************************************************************************
64 | // Global Variable section
65 | struct stopwatch
66 | {
67 | u8 state;
68 | u8 drawFlag;
69 | u8 swtIs1Hz;
70 | u8 swtIs10Hz;
71 |
72 | u8 time[8]; // time[0] hour H
73 | // time[1] hour L
74 | // time[2] minute H
75 | // time[3] minute L
76 | // time[4] second H
77 | // time[5] second L
78 | // time[6] 1/10 sec
79 | // time[7] 1/100 sec
80 |
81 | // Display style
82 | u8 viewStyle;
83 | };
84 | extern struct stopwatch sStopwatch;
85 |
86 | // *************************************************************************************************
87 | // Extern section
88 |
89 | #endif /*STOPWATCH_H_ */
90 |
--------------------------------------------------------------------------------
/CCS/driver/pmm.c:
--------------------------------------------------------------------------------
1 | //****************************************************************************//
2 | // Function Library for setting the PMM
3 | //
4 | // This file is used in conjunction with PMM.c to set the core
5 | // voltage level of a device. To set a core voltage level, call
6 | // SetVCore(level). See RF project(s) for example usage.
7 | //
8 | // Original programm Stefan Schauer
9 | // Rev 1.1: changed VCoreUp to fit with recommended flow (09/04/2008)
10 | //
11 | //****************************************************************************//
12 | #include "cc430x613x.h"
13 | #include "pmm.h"
14 |
15 | //****************************************************************************//
16 | // Set VCore level
17 | // SetVCore level is called from the user API
18 | //****************************************************************************//
19 | void SetVCore(unsigned char level) // Note: change level by one
20 | // step only
21 | {
22 | unsigned char actLevel;
23 |
24 | do
25 | {
26 | actLevel = PMMCTL0_L & PMMCOREV_3;
27 | if (actLevel < level)
28 | SetVCoreUp(++actLevel); // Set VCore (step by step)
29 | if (actLevel > level)
30 | SetVCoreDown(--actLevel); // Set VCore (step by step)
31 | }
32 | while (actLevel != level);
33 | }
34 |
35 | //****************************************************************************//
36 | // Set VCore up
37 | //****************************************************************************//
38 | void SetVCoreUp(unsigned char level) // Note: change level by one
39 | // step only
40 | {
41 | // Open PMM module registers for write access
42 | PMMCTL0_H = 0xA5;
43 |
44 | // Set SVS/M high side to new level
45 | SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level;
46 |
47 | SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level; // Set SVM new Level
48 | while ((PMMIFG & SVSMLDLYIFG) == 0) ; // Wait till SVM is settled
49 | // (Delay)
50 | PMMCTL0_L = PMMCOREV0 * level; // Set VCore to x
51 | PMMIFG &= ~(SVMLVLRIFG + SVMLIFG); // Clear already set flags
52 | if ((PMMIFG & SVMLIFG))
53 | while ((PMMIFG & SVMLVLRIFG) == 0) ; // Wait till level is reached
54 |
55 | SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level; // Set SVS/M Low side to new
56 | // level
57 | PMMCTL0_H = 0x00; // Lock PMM module registers
58 | // for write access
59 | }
60 |
61 | //****************************************************************************//
62 | // Set VCore down
63 | //****************************************************************************//
64 | void SetVCoreDown(unsigned char level)
65 | {
66 | PMMCTL0_H = 0xA5; // Open PMM module registers
67 | // for write access
68 | SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level; // Set SVS/M Low side to new
69 | // level
70 | while ((PMMIFG & SVSMLDLYIFG) == 0) ; // Wait till SVM is settled
71 | // (Delay)
72 | PMMCTL0_L = (level * PMMCOREV0); // Set VCore to 1.85 V for Max
73 | // Speed.
74 | PMMCTL0_H = 0x00; // Lock PMM module registers
75 | // for write access
76 | }
77 |
78 | //****************************************************************************//
79 |
--------------------------------------------------------------------------------
/CCS/logic/menu.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef MENU_H_
37 | #define MENU_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 |
45 | // *************************************************************************************************
46 | // Defines section
47 |
48 | struct menu
49 | {
50 | // Pointer to direct function (start, stop etc)
51 | void (*sx_function)(u8 line);
52 | // Pointer to sub menu function (change settings, reset counter etc)
53 | void (*mx_function)(u8 line);
54 | // Pointer to display function
55 | void (*display_function)(u8 line, u8 mode);
56 | // Display update trigger
57 | u8 (*display_update)(void);
58 | // Pointer to next menu item
59 | const struct menu *next;
60 | };
61 |
62 | // *************************************************************************************************
63 | // Global Variable section
64 |
65 | // *************************************************************************************************
66 | // Extern section
67 |
68 | // Line1 navigation
69 | extern const struct menu menu_L1_Time;
70 | extern const struct menu menu_L1_Alarm;
71 | //extern const struct menu menu_L1_Altitude;
72 | //extern const struct menu menu_L1_Temperature;
73 | //extern const struct menu menu_L1_Altitude;
74 | //extern const struct menu menu_L1_Heartrate;
75 | //extern const struct menu menu_L1_Speed;
76 | //extern const struct menu menu_L1_Acceleration;
77 | // ChronIC
78 | extern const struct menu menu_L1_Doorbell;
79 |
80 | #ifdef ISM_LF // 433 MHz
81 | extern const struct menu menu_L1_Ruku;
82 | #endif
83 |
84 | // Line2 navigation
85 | extern const struct menu menu_L2_Date;
86 | extern const struct menu menu_L2_Stopwatch;
87 | extern const struct menu menu_L2_Battery;
88 | //extern const struct menu menu_L2_Rf;
89 | //extern const struct menu menu_L2_Ppt;
90 | extern const struct menu menu_L2_Sync;
91 | //extern const struct menu menu_L2_CalDist;
92 | extern const struct menu menu_L2_RFBSL;
93 |
94 | // Pointers to current menu item
95 | extern const struct menu *ptrMenu_L1;
96 | extern const struct menu *ptrMenu_L2;
97 |
98 | #endif /*MENU_H_ */
99 |
--------------------------------------------------------------------------------
/CCS/logic/rfsimpliciti.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef RFSIMPLICITI_H_
37 | #define RFSIMPLICITI_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 | extern void reset_rf(void);
45 | //extern void sx_rf(u8 line);
46 | //extern void sx_ppt(u8 line);
47 | extern void sx_sync(u8 line);
48 | //extern void display_rf(u8 line, u8 update);
49 | //extern void display_ppt(u8 line, u8 update);
50 | extern void display_sync(u8 line, u8 update);
51 | extern void send_smpl_data(u16 data);
52 | extern u8 is_rf(void);
53 |
54 | // *************************************************************************************************
55 | // Defines section
56 |
57 | // SimpliciTI connection states
58 | typedef enum
59 | {
60 | SIMPLICITI_OFF = 0, // Not connected
61 | SIMPLICITI_ACCELERATION, // Transmitting acceleration data and button events
62 | SIMPLICITI_BUTTONS, // Transmitting button events
63 | SIMPLICITI_SYNC // Syncing
64 | } simpliciti_mode_t;
65 |
66 | // Stop SimpliciTI transmission after 60 minutes to save power
67 | #define SIMPLICITI_TIMEOUT (60 * 60u)
68 |
69 | // Button flags for SimpliciTI data
70 | #define SIMPLICITI_BUTTON_STAR (0x10)
71 | #define SIMPLICITI_BUTTON_NUM (0x20)
72 | #define SIMPLICITI_BUTTON_UP (0x30)
73 |
74 | // SimpliciTI mode flag
75 | #define SIMPLICITI_MOUSE_EVENTS (0x01)
76 | #define SIMPLICITI_KEY_EVENTS (0x02)
77 |
78 | // *************************************************************************************************
79 | // Global Variable section
80 | struct RFsmpl
81 | {
82 | // SIMPLICITI_OFF, SIMPLICITI_ACCELERATION, SIMPLICITI_BUTTONS
83 | simpliciti_mode_t mode;
84 |
85 | // Timeout until SimpliciTI transmission is automatically stopped
86 | u16 timeout;
87 |
88 | // Variable to display
89 | u8 display_sync_done;
90 | };
91 | extern struct RFsmpl sRFsmpl;
92 |
93 | extern unsigned char simpliciti_flag;
94 |
95 | // *************************************************************************************************
96 | // Extern section
97 |
98 | #endif /*RFSIMPLICITI_H_ */
99 |
--------------------------------------------------------------------------------
/CCS/driver/vti_ps.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef VTI_PS_H_
37 | #define VTI_PS_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 | extern void ps_init(void);
45 | extern void ps_start(void);
46 | extern void ps_stop(void);
47 | extern u32 ps_get_pa(void);
48 | extern u16 ps_get_temp(void);
49 | extern void init_pressure_table(void);
50 | extern void update_pressure_table(s16 href, u32 p_meas, u16 t_meas);
51 | extern s16 conv_pa_to_meter(u32 p_meas, u16 t_meas);
52 |
53 | // *************************************************************************************************
54 | // Defines section
55 |
56 | // Port and pin resource for TWI interface to pressure sensor
57 | // SCL=PJ.3, SDA=PJ.2, DRDY=P2.6
58 | #define PS_TWI_IN (PJIN)
59 | #define PS_TWI_OUT (PJOUT)
60 | #define PS_TWI_DIR (PJDIR)
61 | #define PS_TWI_REN (PJREN)
62 | #define PS_SCL_PIN (BIT3)
63 | #define PS_SDA_PIN (BIT2)
64 |
65 | // Port, pin and interrupt resource for interrupt from acceleration sensor, DRDY=P2.6
66 | #define PS_INT_IN (P2IN)
67 | #define PS_INT_OUT (P2OUT)
68 | #define PS_INT_DIR (P2DIR)
69 | #define PS_INT_IE (P2IE)
70 | #define PS_INT_IES (P2IES)
71 | #define PS_INT_IFG (P2IFG)
72 | #define PS_INT_PIN (BIT6)
73 |
74 | // TWI defines
75 | #define PS_TWI_WRITE (0u)
76 | #define PS_TWI_READ (1u)
77 |
78 | #define PS_TWI_SEND_START (0u)
79 | #define PS_TWI_SEND_RESTART (1u)
80 | #define PS_TWI_SEND_STOP (2u)
81 | #define PS_TWI_CHECK_ACK (3u)
82 |
83 | #define PS_TWI_8BIT_ACCESS (0u)
84 | #define PS_TWI_16BIT_ACCESS (1u)
85 |
86 | #define PS_TWI_SCL_HI { PS_TWI_OUT |= PS_SCL_PIN; }
87 | #define PS_TWI_SCL_LO { PS_TWI_OUT &= ~PS_SCL_PIN; }
88 | #define PS_TWI_SDA_HI { PS_TWI_OUT |= PS_SDA_PIN; }
89 | #define PS_TWI_SDA_LO { PS_TWI_OUT &= ~PS_SDA_PIN; }
90 | #define PS_TWI_SDA_IN { PS_TWI_OUT |= PS_SDA_PIN; PS_TWI_DIR &= ~PS_SDA_PIN; }
91 | #define PS_TWI_SDA_OUT { PS_TWI_DIR |= PS_SDA_PIN; }
92 |
93 | // *************************************************************************************************
94 | // Global Variable section
95 |
96 | // *************************************************************************************************
97 | // Extern section
98 |
99 | #endif /*VTI_PS_H_ */
100 |
--------------------------------------------------------------------------------
/CCS/driver/vti_as.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef VTI_AS_H_
37 | #define VTI_AS_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // *************************************************************************************************
43 | // Prototypes section
44 | extern void as_init(void);
45 | extern void as_start(void);
46 | extern void as_stop(void);
47 | extern u8 as_read_register(u8 bAddress);
48 | extern u8 as_write_register(u8 bAddress, u8 bData);
49 | extern void as_get_data(u8 * data);
50 |
51 | // *************************************************************************************************
52 | // Defines section
53 |
54 | // Disconnect power supply for acceleration sensor when not used
55 | #define AS_DISCONNECT
56 |
57 | // Port and pin resource for SPI interface to acceleration sensor
58 | // SDO=MOSI=P1.6, SDI=MISO=P1.5, SCK=P1.7
59 | #define AS_SPI_IN (P1IN)
60 | #define AS_SPI_OUT (P1OUT)
61 | #define AS_SPI_DIR (P1DIR)
62 | #define AS_SPI_SEL (P1SEL)
63 | #define AS_SPI_REN (P1REN)
64 | #define AS_SDO_PIN (BIT6)
65 | #define AS_SDI_PIN (BIT5)
66 | #define AS_SCK_PIN (BIT7)
67 |
68 | // CSN=PJ.1
69 | #define AS_CSN_OUT (PJOUT)
70 | #define AS_CSN_DIR (PJDIR)
71 | #define AS_CSN_PIN (BIT1)
72 |
73 | #define AS_TX_BUFFER (UCA0TXBUF)
74 | #define AS_RX_BUFFER (UCA0RXBUF)
75 | #define AS_TX_IFG (UCTXIFG)
76 | #define AS_RX_IFG (UCRXIFG)
77 | #define AS_IRQ_REG (UCA0IFG)
78 | #define AS_SPI_CTL0 (UCA0CTL0)
79 | #define AS_SPI_CTL1 (UCA0CTL1)
80 | #define AS_SPI_BR0 (UCA0BR0)
81 | #define AS_SPI_BR1 (UCA0BR1)
82 |
83 | // Port and pin resource for power-up of acceleration sensor, VDD=PJ.0
84 | #define AS_PWR_OUT (PJOUT)
85 | #define AS_PWR_DIR (PJDIR)
86 | #define AS_PWR_PIN (BIT0)
87 |
88 | // Port, pin and interrupt resource for interrupt from acceleration sensor, CMA_INT=P2.5
89 | #define AS_INT_IN (P2IN)
90 | #define AS_INT_OUT (P2OUT)
91 | #define AS_INT_DIR (P2DIR)
92 | #define AS_INT_IE (P2IE)
93 | #define AS_INT_IES (P2IES)
94 | #define AS_INT_IFG (P2IFG)
95 | #define AS_INT_PIN (BIT5)
96 |
97 | // SPI timeout to detect sensor failure
98 | #define SPI_TIMEOUT (1000u)
99 |
100 | // *************************************************************************************************
101 | // Global Variable section
102 |
103 | // *************************************************************************************************
104 | // Extern section
105 |
106 | #endif /*VTI_AS_H_ */
107 |
--------------------------------------------------------------------------------
/CCS/logic/rfbsl.c:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 | // Wireless Update functions.
36 | // *************************************************************************************************
37 |
38 |
39 | // *************************************************************************************************
40 | // Include section
41 |
42 | // system
43 | #include "project.h"
44 |
45 | // driver
46 | #include "display.h"
47 | #include "ports.h"
48 |
49 | // logic
50 | #include "rfbsl.h"
51 | //#include "bluerobin.h"
52 | #include "rfsimpliciti.h"
53 |
54 | // *************************************************************************************************
55 | // Global Variable section
56 | u8 rfBSL_button_confirmation;
57 |
58 | // *************************************************************************************************
59 | // @fn sx_rfbsl
60 | // @brief This functions starts the RFBSL
61 | // @param line LINE1, LINE2
62 | // @return none
63 | // *************************************************************************************************
64 | void sx_rfbsl(u8 line)
65 | {
66 | // Exit if battery voltage is too low for radio operation
67 | if (sys.flag.low_battery)
68 | return;
69 |
70 | // // Exit if BlueRobin stack is active
71 | // if (is_bluerobin())
72 | // return;
73 |
74 | // Exit if SimpliciTI stack is active
75 | if (is_rf())
76 | return;
77 |
78 | rfBSL_button_confirmation++;
79 |
80 | if (rfBSL_button_confirmation == 2)
81 | {
82 | // Before entering RFBSL clear the LINE1 Symbols
83 | display_symbol(LCD_SYMB_AM, SEG_OFF);
84 |
85 | clear_line(LINE1);
86 |
87 | // Write RAM to indicate we will be downloading the RAM Updater first
88 | display_chars(LCD_SEG_L2_5_0, (u8 *) " RFBSL", SEG_ON);
89 | display_chars(LCD_SEG_L1_3_0, (u8 *) " RAM", SEG_ON);
90 |
91 | // Call RFBSL
92 | CALL_RFSBL();
93 | }
94 | }
95 |
96 | // *************************************************************************************************
97 | // @fn display_rfbsl
98 | // @brief RFBSL display routine.
99 | // @param u8 line LINE2
100 | // u8 update DISPLAY_LINE_UPDATE_FULL
101 | // @return none
102 | // *************************************************************************************************
103 | void display_rfbsl(u8 line, u8 update)
104 | {
105 | if (update == DISPLAY_LINE_UPDATE_FULL)
106 | {
107 | if (rfBSL_button_confirmation == 0)
108 | {
109 | display_chars(LCD_SEG_L2_5_0, (u8 *) " RFBSL", SEG_ON);
110 | }
111 | else if (rfBSL_button_confirmation < 2)
112 | {
113 | // Request one more button press to confirm rfBSL call
114 | display_chars(LCD_SEG_L2_5_0, (u8 *) " CONF", SEG_ON);
115 | }
116 | }
117 | }
118 |
119 |
--------------------------------------------------------------------------------
/CCS/logic/bluerobin.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef BLUEROBIN_H_
37 | #define BLUEROBIN_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 | #include
42 |
43 | // *************************************************************************************************
44 | // Prototypes section
45 | extern void reset_bluerobin(void);
46 | extern void mx_bluerobin(u8 line);
47 | extern void sx_bluerobin(u8 line);
48 | extern void mx_caldist(u8 line);
49 | extern void display_heartrate(u8 line, u8 update);
50 | extern void display_speed(u8 line, u8 update);
51 | extern void sx_caldist(u8 line);
52 | extern void mx_caldist(u8 line);
53 | extern void display_caldist(u8 line, u8 update);
54 | extern u8 is_bluerobin(void);
55 | extern u8 is_bluerobin_searching(void);
56 | extern void get_bluerobin_data(void);
57 | extern void stop_bluerobin(void);
58 |
59 | // *************************************************************************************************
60 | // Defines section
61 |
62 | // BlueRobin connection states
63 | typedef enum
64 | {
65 | BLUEROBIN_OFF = 0, // Not connected
66 | BLUEROBIN_SEARCHING, // Searching for transmitter
67 | BLUEROBIN_CONNECTED, // Connected
68 | BLUEROBIN_ERROR // Error occurred while trying to connect or while connected
69 | } BlueRobin_state_t;
70 |
71 | // BlueRobin data update states
72 | typedef enum
73 | {
74 | BLUEROBIN_NO_UPDATE = 0, // No new data available
75 | BLUEROBIN_NEW_DATA // New data arrived
76 | } BlueRobin_update_t;
77 |
78 | #define USER_SEX_MALE 0
79 | #define USER_SEX_FEMALE 1
80 | #define USER_WEIGHT_MIN_KG 30
81 | #define USER_WEIGHT_MAX_KG 150
82 | #define USER_WEIGHT_MIN_LB 70
83 | #define USER_WEIGHT_MAX_LB 400
84 |
85 | // *************************************************************************************************
86 | // Global Variable section
87 | struct bluerobin
88 | {
89 | BlueRobin_state_t state; // BLUEROBIN_OFF, BLUEROBIN_SEARCHING, BLUEROBIN_CONNECTED,
90 | // BLUEROBIN_ERROR
91 | BlueRobin_update_t update; // BLUEROBIN_NO_UPDATE, BLUEROBIN_NEW_DATA
92 | u32 cs_id; // Chest strap ID
93 | u8 user_sex; // User settings
94 | u16 user_weight;
95 | u8 heartrate; // Heart rate (1 bpm)
96 | u32 calories; // Calories (1 kCal) - calculated from heart rate, user weight and
97 | // user sex
98 | u8 speed; // Speed (0.1 km/h) - demo version range is 0.0 to 25.5km/h
99 | u32 distance; // Distance (1 m)
100 | u8 caldist_view; // 0=display calories, 1=display distance
101 | };
102 | extern struct bluerobin sBlueRobin;
103 |
104 | // *************************************************************************************************
105 | // Extern section
106 |
107 | #endif /*BLUEROBIN_H_ */
108 |
--------------------------------------------------------------------------------
/python/chronic.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python
2 |
3 | # chronic.py - talk to TI chronos ez430 dev kit via RF access point
4 | #
5 | # Adam Laurie
6 | # http://www.aperturelabs.com
7 | #
8 | # This code is copyright (c) Aperture Labs Ltd., 2012, All rights reserved.
9 | #
10 |
11 | import serial
12 | import time
13 |
14 | CHRONOS_COMMAND= {
15 | 'START':'\x07',
16 | 'STOP':'\x09',
17 | 'SYNC_START':'\x30', # this is disabled in AP firmware!
18 | 'SYNC_SEND':'\x31',
19 | 'SYNC_BUFFER_STATUS':'\x32',
20 | }
21 |
22 | CHRONOS_SYNC_AP_COMMAND= {
23 | # standard commands
24 | 'NOP':'\x01',
25 | 'GET_STATUS':'\x02',
26 | 'SET_TIME':'\x03',
27 | 'GET_MEM_MODE1':'\x04',
28 | 'GET_MEM_MODE2':'\x05',
29 | 'ERASE_MEM':'\x06',
30 | 'EXIT':'\x07',
31 | # chronic extras
32 | 'SET_UP':'\x08',
33 | 'SET_DOWN':'\x09',
34 | 'SET_FREQ':'\x0a',
35 | 'SET_MANCHESTER':'\x0b',
36 | 'SET_DATA_RATE':'\x0c',
37 | 'SET_REPEAT':'\x0d',
38 | 'SET_DELAY':'\x0e',
39 | 'SET_MODULATION':'\x0f',
40 | 'SET_SEQ':'\x10'
41 | }
42 |
43 | BUTTON_DOWN= '\x01'
44 | BUTTON_UP= '\x02'
45 | BUTTON_CHUNK_SIZE= 15
46 |
47 | # radio moulation
48 | MOD_2_FSK= (0x00 << 4)
49 | MOD_2_GFSK= (0x01 << 4)
50 | MOD_OOK= (0x03 << 4)
51 | MOD_MSK= (0x07 << 4)
52 |
53 | MOD_FORMAT= {
54 | 'FSK':MOD_2_FSK,
55 | 'GFSK':MOD_2_GFSK,
56 | 'OOK':MOD_OOK,
57 | 'MSK':MOD_MSK,
58 | }
59 |
60 | HW_NO_ERROR= 0x06
61 |
62 | class chronos:
63 | def __init__(self, dev, baud):
64 | self.dev= dev
65 | self.baud= baud
66 | self.start()
67 | # wait for access point to wake up
68 | time.sleep(1)
69 | def start(self):
70 | self.conn = serial.Serial(self.dev, self.baud, timeout = 1)
71 | ret, dummy= self.write('START', '')
72 | return ret
73 | def stop(self):
74 | ret, dummy= self.write('STOP', '')
75 | self.conn.close()
76 | return ret
77 | def exit(self):
78 | ret, dummy= self.sendsync('EXIT', '')
79 | return ret
80 | def write(self, command, payload):
81 | msg= '\xff' + CHRONOS_COMMAND[command]
82 | msg += chr(len(msg) + len(payload) + 1)
83 | msg += payload
84 | #print 'sending', msg.encode('hex')
85 | self.conn.flushInput()
86 | self.conn.flushOutput()
87 | self.conn.write(msg)
88 | time.sleep(1)
89 | ret= self.conn.read(len(msg))
90 | #print 'reply', ret.encode('hex')
91 | if ret[1] == chr(HW_NO_ERROR):
92 | return True, ret
93 | else:
94 | return False, ret
95 | def sendsync(self, command, payload):
96 | payload= CHRONOS_SYNC_AP_COMMAND[command] + payload
97 | return self.write('SYNC_SEND', payload)
98 | def setsequences(self, button, sequences):
99 | if button == 'UP':
100 | button= 0
101 | else:
102 | button= 1
103 | ret, dummy= self.sendsync('SET_SEQ', chr(button)+chr(sequences))
104 | return ret
105 | def settime(self, hour, minute, second, year_h, year_l, month, day):
106 | ret, dummy= self.sendsync('SET_TIME', chr(hour)+chr(minute)+chr(second)+chr(year_h)+chr(year_l)+chr(month)+chr(day)+'\x00'*3)
107 | return ret
108 | def sendbutton(self, button, fullpayload):
109 | if button == 'UP':
110 | command= 'SET_UP'
111 | elif button == 'DOWN':
112 | command= 'SET_DOWN'
113 | sequence= 0
114 | for payload in fullpayload:
115 | # we can only send 15 bytes at a time
116 | tosend= len(payload)
117 | if tosend > 63:
118 | return False
119 | chunk= 0
120 | while(tosend):
121 | if tosend > BUTTON_CHUNK_SIZE:
122 | size= BUTTON_CHUNK_SIZE
123 | else:
124 | size= tosend
125 | ret, dummy= self.sendsync(command, chr(sequence) + chr(chunk) + chr(size) + payload[chunk * BUTTON_CHUNK_SIZE:chunk * BUTTON_CHUNK_SIZE + size])
126 | if not ret:
127 | return ret
128 | tosend -= size
129 | chunk += 1
130 | sequence += 1
131 | # now tell watch how many sequences to use
132 | sequences= 0
133 | for payload in fullpayload:
134 | if len(payload):
135 | sequences += 1
136 | ret= self.setsequences(button, sequences)
137 | return ret
138 | def getstatus(self, chunk):
139 | return self.sendsync('GET_STATUS',chunk)
140 | def setdelay(self, delay):
141 | ret, dummy= self.sendsync('SET_DELAY', chr(delay))
142 | return ret
143 | def setfreq(self, freq):
144 | mhz= 26
145 | freqmult = (0x10000 / 1000000.0) / mhz
146 | num = int(freq * freqmult)
147 | freq0= num & 0xff
148 | payload= chr(freq0)
149 | freq1= (num >> 8) & 0xff
150 | payload += chr(freq1)
151 | freq2= (num >> 16) & 0xff
152 | payload += chr(freq2)
153 | ret, dummy= self.sendsync('SET_FREQ', payload)
154 | #print '- FREQ2: %02x FREQ1: %02x FREQ0: %02x -' % (freq2, freq1, freq0),
155 | return ret
156 | def setmanchester(self, manchester):
157 | if manchester == 'ON':
158 | manchester= '\x01'
159 | elif manchester == 'OFF':
160 | manchester= '\x00'
161 | else:
162 | return False
163 | ret, dummy= self.sendsync('SET_MANCHESTER', manchester)
164 | return ret
165 | def setmodulation(self, modulation):
166 | mod= chr(MOD_FORMAT[modulation])
167 | ret, dummy= self.sendsync('SET_MODULATION', mod)
168 | return ret
169 | def setrepeat(self, repeat):
170 | ret, dummy= self.sendsync('SET_REPEAT', chr(repeat))
171 | return ret
172 | def setdatarate(self, drate):
173 | mhz= 26
174 | drate_e = None
175 | drate_m = None
176 | for e in range(16):
177 | m = int((drate * pow(2,28) / (pow(2,e)* (mhz*1000000.0))-256) + .5) # rounded evenly
178 | if m < 256:
179 | drate_e = e
180 | drate_m = m
181 | break
182 | if drate_e is None:
183 | return False, None
184 | drate = 1000000.0 * mhz * (256+drate_m) * pow(2,drate_e) / pow(2,28)
185 | ret, dummy= self.sendsync('SET_DATA_RATE', chr(drate_e) + chr(drate_m))
186 | #print '- DRATE_E: %02x DRATE_M: %02x -' % (drate_e, drate_m),
187 | return ret, drate
188 | def debounce(self):
189 | i=self.deb
190 | while i:
191 | self.read()
192 | i-=1
193 |
--------------------------------------------------------------------------------
/CCS/include/project.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef PROJECT_H_
37 | #define PROJECT_H_
38 |
39 | // *************************************************************************************************
40 | // Include section
41 | #include
42 | #include
43 |
44 | // *************************************************************************************************
45 | // Defines section
46 |
47 | // Comment this to not use the LCD charge pump
48 | //#define USE_LCD_CHARGE_PUMP
49 |
50 | // Comment this define to build the application without watchdog support
51 | #define USE_WATCHDOG
52 |
53 | // Use/not use filter when measuring physical values
54 | #define FILTER_OFF (0u)
55 | #define FILTER_ON (1u)
56 |
57 | // *************************************************************************************************
58 | // Macro section
59 |
60 | // Conversion from usec to ACLK timer ticks
61 | #define CONV_US_TO_TICKS(usec) (((usec) * 32768) / 1000000)
62 |
63 | // Conversion from msec to ACLK timer ticks
64 | #define CONV_MS_TO_TICKS(msec) (((msec) * 32768) / 1000)
65 |
66 | // *************************************************************************************************
67 | // Typedef section
68 |
69 | typedef enum
70 | {
71 | MENU_ITEM_NOT_VISIBLE = 0, // Menu item is not visible
72 | MENU_ITEM_VISIBLE // Menu item is visible
73 | } menu_t;
74 |
75 | // Set of system flags
76 | typedef union
77 | {
78 | struct
79 | {
80 | u16 idle_timeout : 1; // Timeout after inactivity
81 | u16 idle_timeout_enabled : 1; // When in set mode, timeout after a given period
82 | u16 lock_buttons : 1; // Lock buttons
83 | u16 mask_buzzer : 1; // Do not output buzz for next button event
84 | u16 up_down_repeat_enabled : 1; // While in set_value(), create virtual UP/DOWN button
85 | // events
86 | u16 low_battery : 1; // 1 = Battery is low
87 | u16 use_metric_units : 1; // 1 = Use metric units, 0 = use English units
88 | u16 delay_over : 1; // 1 = Timer delay over
89 | } flag;
90 | u16 all_flags; // Shortcut to all display flags (for reset)
91 | } s_system_flags;
92 | extern volatile s_system_flags sys;
93 |
94 | // Set of request flags
95 | typedef union
96 | {
97 | struct
98 | {
99 | u16 temperature_measurement : 1; // 1 = Measure temperature
100 | u16 voltage_measurement : 1; // 1 = Measure voltage
101 | u16 altitude_measurement : 1; // 1 = Measure air pressure
102 | u16 acceleration_measurement : 1; // 1 = Measure acceleration
103 | u16 buzzer : 1; // 1 = Output buzzer
104 | } flag;
105 | u16 all_flags; // Shortcut to all display flags (for reset)
106 | } s_request_flags;
107 | extern volatile s_request_flags request;
108 |
109 | // Set of message flags
110 | typedef union
111 | {
112 | struct
113 | {
114 | u16 prepare : 1; // 1 = Wait for clock tick, then set
115 | // display.flag.show_message flag
116 | u16 show : 1; // 1 = Display message now
117 | u16 erase : 1; // 1 = Erase message
118 | u16 type_locked : 1; // 1 = Show "buttons are locked" in Line2
119 | u16 type_unlocked : 1; // 1 = Show "buttons are unlocked" in Line2
120 | u16 type_lobatt : 1; // 1 = Show "lobatt" text in Line2
121 | u16 type_alarm_on : 1; // 1 = Show " on" text in Line1
122 | u16 type_alarm_off : 1; // 1 = Show " off" text in Line1
123 | } flag;
124 | u16 all_flags; // Shortcut to all message flags (for reset)
125 | } s_message_flags;
126 | extern volatile s_message_flags message;
127 |
128 | // *************************************************************************************************
129 | // Global Variable section
130 |
131 | #endif /*PROJECT_H_ */
132 |
--------------------------------------------------------------------------------
/CCS/driver/ports.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 |
36 | #ifndef PORTS_H_
37 | #define PORTS_H_
38 |
39 | // *************************************************************************************************
40 | // Defines section
41 |
42 | // Port, pins and interrupt resources for buttons
43 | #define BUTTONS_IN (P2IN)
44 | #define BUTTONS_OUT (P2OUT)
45 | #define BUTTONS_DIR (P2DIR)
46 | #define BUTTONS_REN (P2REN)
47 | #define BUTTONS_IE (P2IE)
48 | #define BUTTONS_IES (P2IES)
49 | #define BUTTONS_IFG (P2IFG)
50 | #define BUTTONS_IRQ_VECT2 (PORT2_VECTOR)
51 |
52 | // Button ports
53 | #define BUTTON_STAR_PIN (BIT2)
54 | #define BUTTON_NUM_PIN (BIT1)
55 | #define BUTTON_UP_PIN (BIT4)
56 | #define BUTTON_DOWN_PIN (BIT0)
57 | #define BUTTON_BACKLIGHT_PIN (BIT3)
58 | #define ALL_BUTTONS (BUTTON_STAR_PIN + BUTTON_NUM_PIN + BUTTON_UP_PIN + \
59 | BUTTON_DOWN_PIN + BUTTON_BACKLIGHT_PIN)
60 |
61 | // Macros for button press detection
62 | #define BUTTON_STAR_IS_PRESSED ((BUTTONS_IN & BUTTON_STAR_PIN) == BUTTON_STAR_PIN)
63 | #define BUTTON_NUM_IS_PRESSED ((BUTTONS_IN & BUTTON_NUM_PIN) == BUTTON_NUM_PIN)
64 | #define BUTTON_UP_IS_PRESSED ((BUTTONS_IN & BUTTON_UP_PIN) == BUTTON_UP_PIN)
65 | #define BUTTON_DOWN_IS_PRESSED ((BUTTONS_IN & BUTTON_DOWN_PIN) == BUTTON_DOWN_PIN)
66 | #define BUTTON_BACKLIGHT_IS_PRESSED ((BUTTONS_IN & BUTTON_BACKLIGHT_PIN) == \
67 | BUTTON_BACKLIGHT_PIN)
68 | #define NO_BUTTON_IS_PRESSED ((BUTTONS_IN & ALL_BUTTONS) == 0)
69 |
70 | // Macros for button release detection
71 | #define BUTTON_STAR_IS_RELEASED ((BUTTONS_IN & BUTTON_STAR_PIN) == 0)
72 | #define BUTTON_NUM_IS_RELEASED ((BUTTONS_IN & BUTTON_NUM_PIN) == 0)
73 | #define BUTTON_UP_IS_RELEASED (BUTTONS_IN & BUTTON_UP_PIN) == 0)
74 | #define BUTTON_DOWN_IS_RELEASED ((BUTTONS_IN & BUTTON_DOWN_PIN) == 0)
75 | #define BUTTON_BACKLIGHT_IS_RELEASED ((BUTTONS_IN & BUTTON_BACKLIGHT_PIN) == 0)
76 |
77 | // Button debounce time (msec)
78 | #define BUTTONS_DEBOUNCE_TIME_IN (5u)
79 | #define BUTTONS_DEBOUNCE_TIME_OUT (250u)
80 | #define BUTTONS_DEBOUNCE_TIME_LEFT (50u)
81 |
82 | // Detect if STAR / NUM button is held low continuously
83 | #define LEFT_BUTTON_LONG_TIME (2u)
84 |
85 | // Backlight time (sec)
86 | #define BACKLIGHT_TIME_ON (3u)
87 |
88 | // Leave set_value() function after some seconds of user inactivity
89 | #define INACTIVITY_TIME (30u)
90 |
91 | // Set of button flags
92 | typedef union
93 | {
94 | struct
95 | {
96 | // Manual button events
97 | u16 star : 1; // Short STAR button press
98 | u16 num : 1; // Short NUM button press
99 | u16 up : 1; // Short UP button press
100 | u16 down : 1; // Short DOWN button press
101 | u16 backlight : 1; // Short BACKLIGHT button press
102 | u16 star_long : 1; // Long STAR button press
103 | u16 num_long : 1; // Long NUM button press
104 | u16 star_not_long : 1; // Between short and long STAR button press
105 | u16 num_not_long : 1; // Between short and long NUM button press
106 | } flag;
107 | u16 all_flags; // Shortcut to all display flags (for reset)
108 | } s_button_flags;
109 | extern volatile s_button_flags button;
110 |
111 | struct struct_button
112 | {
113 | u8 star_timeout; // this variable is incremented each second if STAR button is still
114 | // pressed
115 | u8 num_timeout; // this variable is incremented each second if NUM button is still
116 | // pressed
117 | u8 backlight_timeout; // controls the timeout for the backlight
118 | u8 backlight_status; // 1 case backlight is on
119 | s16 repeats;
120 | };
121 | extern volatile struct struct_button sButton;
122 |
123 | // *************************************************************************************************
124 | // Extern section
125 | extern void button_repeat_on(u16 msec);
126 | extern void button_repeat_off(void);
127 | extern void button_repeat_function(void);
128 | extern void init_buttons(void);
129 |
130 | #endif /*PORTS_H_ */
131 |
--------------------------------------------------------------------------------
/CCS/simpliciti/Components/mrfi/smartrf/CC430/smartrf_CC430.h:
--------------------------------------------------------------------------------
1 | /***************************************************************
2 | * SmartRF Studio(tm) Export
3 | *
4 | * Radio register settings specifed with C-code
5 | * compatible #define statements.
6 | *
7 | ***************************************************************/
8 |
9 | #ifndef SMARTRF_CC430_H
10 | #define SMARTRF_CC430_H
11 |
12 | // [BM] Modified radio settings for 433MHz, 868MHz, 915MHz
13 |
14 | // ISM_LF configuration
15 | //
16 | // Chipcon
17 | // Product = CC1101
18 | // Chip version = A (VERSION = 0x04)
19 | // Crystal accuracy = 10 ppm
20 | // X-tal frequency = 26 MHz
21 | // RF output power = 0 dBm
22 | // RX filterbandwidth = 232.142857 kHz
23 | // Deviation = 32 kHz
24 | // Datarate = 76.766968 kBaud
25 | // Modulation = (1) GFSK
26 | // Manchester enable = (0) Manchester disabled
27 | // RF Frequency = 433.92 MHz
28 | // Channel spacing = 199.951172 kHz
29 | // Channel number = 0
30 | // Optimization = -
31 | // Sync mode = (3) 30/32 sync word bits detected
32 | // Format of RX/TX data = (0) Normal mode, use FIFOs for RX and TX
33 | // CRC operation = (1) CRC calculation in TX and CRC check in RX enabled
34 | // Forward Error Correction = (0) FEC disabled
35 | // Length configuration = (1) Variable length packets, packet length configured by the first
36 | // received byte after sync word.
37 | // Packetlength = 255
38 | // Preamble count = (2) 4 bytes
39 | // Append status = 1
40 | // Address check = (0) No address check
41 | // FIFO autoflush = 0
42 | // Device address = 0
43 | // GDO0 signal selection = ( 6) Asserts when sync word has been sent / received, and de-asserts at
44 | // the end of the packet
45 | // GDO2 signal selection = (41) CHIP_RDY
46 |
47 | // ISM_EU configuration
48 | //
49 | // Chipcon
50 | // Product = CC1101
51 | // Chip version = A (VERSION = 0x04)
52 | // Crystal accuracy = 10 ppm
53 | // X-tal frequency = 26 MHz
54 | // RF output power = 0 dBm
55 | // RX filterbandwidth = 232.142857 kHz
56 | // Deviation = 32 kHz
57 | // Datarate = 76.766968 kBaud
58 | // Modulation = (1) GFSK
59 | // Manchester enable = (0) Manchester disabled
60 | // RF Frequency = 869.524963 MHz
61 | // Channel spacing = 199.951172 kHz
62 | // Channel number = 0
63 | // Optimization = -
64 | // Sync mode = (3) 30/32 sync word bits detected
65 | // Format of RX/TX data = (0) Normal mode, use FIFOs for RX and TX
66 | // CRC operation = (1) CRC calculation in TX and CRC check in RX enabled
67 | // Forward Error Correction = (0) FEC disabled
68 | // Length configuration = (1) Variable length packets, packet length configured by the first
69 | // received byte after sync word.
70 | // Packetlength = 255
71 | // Preamble count = (2) 4 bytes
72 | // Append status = 1
73 | // Address check = (0) No address check
74 | // FIFO autoflush = 0
75 | // Device address = 0
76 | // GDO0 signal selection = ( 6) Asserts when sync word has been sent / received, and de-asserts at
77 | // the end of the packet
78 | // GDO2 signal selection = (41) CHIP_RDY
79 |
80 | // ISM_US configuration
81 | //
82 | // Chipcon
83 | // Product = CC1101
84 | // Chip version = A (VERSION = 0x04)
85 | // Crystal accuracy = 10 ppm
86 | // X-tal frequency = 26 MHz
87 | // RF output power = 0 dBm
88 | // RX filterbandwidth = 232.142857 kHz
89 | // Deviation = 32 kHz
90 | // Datarate = 76.766968 kBaud
91 | // Modulation = (1) GFSK
92 | // Manchester enable = (0) Manchester disabled
93 | // RF Frequency = 905.998993 MHz
94 | // Channel spacing = 199.951172 kHz
95 | // Channel number = 0
96 | // Optimization = -
97 | // Sync mode = (3) 30/32 sync word bits detected
98 | // Format of RX/TX data = (0) Normal mode, use FIFOs for RX and TX
99 | // CRC operation = (1) CRC calculation in TX and CRC check in RX enabled
100 | // Forward Error Correction = (0) FEC disabled
101 | // Length configuration = (1) Variable length packets, packet length configured by the first
102 | // received byte after sync word.
103 | // Packetlength = 255
104 | // Preamble count = (2) 4 bytes
105 | // Append status = 1
106 | // Address check = (0) No address check
107 | // FIFO autoflush = 0
108 | // Device address = 0
109 | // GDO0 signal selection = ( 6) Asserts when sync word has been sent / received, and de-asserts at
110 | // the end of the packet
111 | // GDO2 signal selection = (41) CHIP_RDY
112 |
113 | #define SMARTRF_RADIO_CC430
114 |
115 | #define SMARTRF_SETTING_FSCTRL1 0x08
116 | #define SMARTRF_SETTING_FSCTRL0 0x00
117 | #ifdef ISM_EU
118 | // 869.525MHz
119 | # define SMARTRF_SETTING_FREQ2 0x21
120 | # define SMARTRF_SETTING_FREQ1 0x71
121 | # define SMARTRF_SETTING_FREQ0 0x7A
122 | #else
123 | # ifdef ISM_US
124 | // 902MHz (CHANNR=20->906MHz)
125 | # define SMARTRF_SETTING_FREQ2 0x22
126 | # define SMARTRF_SETTING_FREQ1 0xB1
127 | # define SMARTRF_SETTING_FREQ0 0x3B
128 | # else
129 | # ifdef ISM_LF
130 | // 433.92MHz
131 | # define SMARTRF_SETTING_FREQ2 0x10
132 | # define SMARTRF_SETTING_FREQ1 0xB0
133 | # define SMARTRF_SETTING_FREQ0 0x71
134 | # else
135 | # error "Wrong ISM band specified (valid are ISM_LF, ISM_EU and ISM_US)"
136 | # endif // ISM_LF
137 | # endif // ISM_US
138 | #endif // ISM_EU
139 | #define SMARTRF_SETTING_MDMCFG4 0x7B
140 | #define SMARTRF_SETTING_MDMCFG3 0x83
141 | #define SMARTRF_SETTING_MDMCFG2 0x13
142 | #define SMARTRF_SETTING_MDMCFG1 0x22
143 | #define SMARTRF_SETTING_MDMCFG0 0xF8
144 | #define SMARTRF_SETTING_CHANNR 0x00
145 | #define SMARTRF_SETTING_DEVIATN 0x42
146 | #define SMARTRF_SETTING_FREND1 0xB6
147 | #define SMARTRF_SETTING_FREND0 0x10
148 | #define SMARTRF_SETTING_MCSM0 0x18
149 | #define SMARTRF_SETTING_FOCCFG 0x1D
150 | #define SMARTRF_SETTING_BSCFG 0x1C
151 | #define SMARTRF_SETTING_AGCCTRL2 0xC7
152 | #define SMARTRF_SETTING_AGCCTRL1 0x00
153 | #define SMARTRF_SETTING_AGCCTRL0 0xB2
154 | #define SMARTRF_SETTING_FSCAL3 0xEA
155 | #define SMARTRF_SETTING_FSCAL2 0x2A
156 | #define SMARTRF_SETTING_FSCAL1 0x00
157 | #define SMARTRF_SETTING_FSCAL0 0x1F
158 | #define SMARTRF_SETTING_FSTEST 0x59
159 | #define SMARTRF_SETTING_TEST2 0x81
160 | #define SMARTRF_SETTING_TEST1 0x35
161 | #define SMARTRF_SETTING_TEST0 0x09
162 | #define SMARTRF_SETTING_FIFOTHR 0x47
163 | #define SMARTRF_SETTING_IOCFG2 0x29
164 | #define SMARTRF_SETTING_IOCFG0D 0x06
165 | #define SMARTRF_SETTING_PKTCTRL1 0x04
166 | #define SMARTRF_SETTING_PKTCTRL0 0x05
167 | #define SMARTRF_SETTING_ADDR 0x00
168 | #define SMARTRF_SETTING_PKTLEN 0xFF
169 |
170 | #endif // SMARTRF_CC430_H
171 |
--------------------------------------------------------------------------------
/CCS/bluerobin/BlueRobin_RX_API.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright 2009 BM innovations GmbH (www.bm-innovations.com), all rights reserved.
4 | //
5 | // This trial version of the "BlueRobin(TM) receiver library for the Texas Instruments
6 | // CC430 SoC" may be used for non-profit non-commercial purposes only. If you want to use
7 | // BlueRobin(TM) in a commercial project, please contact the copyright holder for a
8 | // separate license agreement.
9 | //
10 | // By using this trial version of the "BlueRobin(TM) receiver library for the Texas Instruments
11 | // CC430 SoC", you implicitly agree that you will not modify, adapt, disassemble, decompile,
12 | // reverse engineer, translate or otherwise attempt to discover the source code of the
13 | // "BlueRobin(TM) receiver library for the Texas Instruments CC430 SoC".
14 | //
15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
16 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | //
19 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | //
26 | // *************************************************************************************************
27 | //
28 | // Public header for eZ430-Chronos specific BlueRobin(TM) receiver library.
29 | //
30 | // The following BlueRobin(TM) profiles are supported by this build
31 | // - heart rate (HR) transmitter
32 | //
33 | // The following number of channels is supported: 1
34 | //
35 | // *************************************************************************************************
36 | //
37 | // BlueRobin(TM) packet size
38 | // -------------------------
39 | //
40 | // * average packet rate 1 packet/875 msec = ~1.14 packets/second
41 | // * payload per packet 5 bytes
42 | //
43 | // BlueRobin(TM) frequency overview
44 | // (Please note: Settings apply for the transmitter side, i.e. the USB dongle)
45 | // ----------------------------------------------------------------------
46 | //
47 | // Bluerobin_RX_433MHz.lib (433MHz ISM band)
48 | //
49 | // * frequency 433.30 MHz - 434.00 MHz
50 | // * deviation 95 kHz
51 | // * channels 3
52 | // * data rate 250 kBaud
53 | //
54 | // Bluerobin_RX_868MHz.lib (868MHz ISM band)
55 | //
56 | // * frequency 868.25 MHz - 868.95 MHz
57 | // * deviation 95 kHz
58 | // * channels 3
59 | // * data rate 250 kBaud
60 | //
61 | //
62 | // Bluerobin_RX_915MHz.lib (915MHz ISM band)
63 | //
64 | // * frequency 914.35 MHz - 917.75 MHz
65 | // * deviation 95 kHz
66 | // * channels 34
67 | // * data rate 250 kBaud
68 | //
69 | // *************************************************************************************************
70 |
71 | #ifndef BRRX_API_H_
72 | #define BRRX_API_H_
73 |
74 | // *************************************************************************************************
75 | // Include section
76 |
77 | // *************************************************************************************************
78 | // Defines section
79 |
80 | // List of all possible channel states
81 | typedef enum
82 | {
83 | TX_OFF = 0, // Powerdown mode
84 | TX_ACTIVE, // Active mode
85 | TX_SEARCH // Search mode
86 | } brtx_state_t;
87 |
88 | // Transmitter to channel assignment
89 | #define HR_CHANNEL (0)
90 |
91 | // *************************************************************************************************
92 | // API section
93 |
94 | // ----------------------------------------------------------
95 | // Functions for initializing and controlling the library
96 |
97 | // Initialize several global variables.
98 | void BRRX_Init_v(void);
99 |
100 | // Set delay after which a channel will be switched off if no new data can be received.
101 | // Param1: Powerdown delay in packet intervals (875 ms)
102 | void BRRX_SetPowerdownDelay_v(u8 Delay_u8);
103 |
104 | // Set timeout when searching for a transmitter
105 | // Param1: Search timeout in seconds
106 | void BRRX_SetSearchTimeout_v(u8 Timeout_u8);
107 |
108 | // Set reduction of valid signal level in learn mode.
109 | // Param1: Reduction of signal level
110 | void BRRX_SetSignalLevelReduction_v(u8 Reduction_u8);
111 |
112 | // Set ID for a channel. To search for an unknown transmitter the ID has to be set to 0.
113 | // Can be only executed on channels currently in powerdown mode.
114 | // Param1: Channel index
115 | // Param2: New ID
116 | void BRRX_SetID_v(u8 Index_u8, u32 ID_u32);
117 |
118 | // Get current ID of channel.
119 | // Return: Current ID of channel
120 | // Param1: Channel index
121 | u32 BRRX_GetID_u32(u8 Index_u8);
122 |
123 | // Start reception on one or all channels.
124 | // Param1: Channel index (use 0xFF to start all channels)
125 | void BRRX_Start_v(u8 Index_u8);
126 |
127 | // Stop reception on one or all channels.
128 | // Param1: Channel index (0xFF for all channels)
129 | void BRRX_Stop_v(u8 Index_u8);
130 |
131 | // Get current state of a channel
132 | // Param1: Channel index
133 | brtx_state_t BRRX_GetState_t(u8 Index_u8);
134 |
135 | // ----------------------------------------------------------
136 | // eZ430-Chronos specific functions
137 |
138 | // Get current heart rate.
139 | // Return: Heart rate in bpm
140 | u8 BRRX_GetHeartRate_u8(void);
141 |
142 | // Get current distance.
143 | // Return: Distance in 10m steps.
144 | u16 BRRX_GetDistance_u16(void);
145 |
146 | // Get current speed.
147 | // Return: Speed in 0.1km/h steps. Trial version is limited to 25.5km/h.
148 | u8 BRRX_GetSpeed_u8(void);
149 |
150 | // ----------------------------------------------------------
151 | // Radio-related functions
152 |
153 | // RX packet end service function
154 | // Must be called by CC1101_VECTOR ISR
155 | void BlueRobin_RadioISR_v(void);
156 |
157 | #endif /*BRRX_API_H_ */
158 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ChronIC - Chronos Integrated Commander
2 | ======================================
3 |
4 | A wearable Sub-GHz RF hacking tool.
5 |
6 | Latest version:
7 |
8 | https://github.com/AdamLaurie/ChronIC
9 |
10 | Based on the EZ430 Chronos project from Texas Instruments:
11 |
12 | http://processors.wiki.ti.com/index.php/EZ430-Chronos
13 |
14 | This tool allows transmission of arbitrary RF data from the wristwatch
15 | component of the Chronos dev kit:
16 |
17 | http://www.ti.com/tool/ez430-chronos&DCMP=Chronos&HQS=Other+OT+chronos
18 |
19 | A worked example of hacking my doorbell can be found here:
20 |
21 | http://adamsblog.rfidiot.org/2013/03/you-can-ring-my-bell-adventures-in-sub.html
22 |
23 | INSTALLATION
24 | ============
25 |
26 | Firmware
27 | ========
28 |
29 | The code is designed to compile with the free size-restricted version
30 | of CCStudio from TI:
31 |
32 | http://www.ti.com/tool/ccstudio
33 |
34 | To achieve this, much of the original functionality is commented out, but
35 | if you have access to the unrestricted compiler it should be easy enough
36 | to re-enable.
37 |
38 | It's also possible to bypass this restriction altogether, as it's enforced by
39 | the IDE not the compiler/linker, so when the size limit is reached all you
40 | need to do is drop to a shell and run make manually, e.g.
41 |
42 | 'cd CCS/868MHz\ -\ Unrestricted\ CCS\ Platinum && make clean ChronIC_868MHz.out'
43 |
44 | I do my main development under Linux but it's also tested and working under
45 | Windows.
46 |
47 | Checkout latest code from github:
48 |
49 | git clone git://github.com/AdamLaurie/ChronIC.git
50 |
51 | Start CCStudio and import the project from the CCS sub-folder of the repo:
52 |
53 | File/Import.../Existing CCS Eclipse Projects
54 |
55 | Build:
56 |
57 | Project/Build Project
58 |
59 | Note that if you don't want to go to the trouble of building from source, I've
60 | included the current 433 and 868 compiled versions in the '433MHz - Unrestricted CCS Platinum'
61 | and '868MHz - Unrestricted CCS Platinum' directories.
62 |
63 | Install via RF Bootloader with Chronos Control Center:
64 |
65 | Windows: http://www.ti.com/lit/zip/slac341
66 |
67 | Linux: http://www.ti.com/lit/zip/slac388
68 |
69 | Python CLI
70 | ==========
71 |
72 | Change directory to the 'python' folder in the git repo.
73 |
74 | sudo python ./setup.py install
75 |
76 | Create a file in /etc/udev/rules.d called 20-chronos.rules with the following
77 | line in it:
78 |
79 | SUBSYSTEMS=="usb" ATTRS{idVendor}=="0451" ATTRS{idProduct}=="16a6" MODE:="0666" SYMLINK+="CHRONOS"
80 |
81 | NOTE: The idVendor & idProduct will need to be replaced by your own device's IDs... can be found by ...
82 | typing "lsusb" into a terminal after inserting your usb access point - the two are seperated by a colon.
83 |
84 |
85 | Reload the udev rules:
86 |
87 | sudo udevadm control --reload-rules
88 |
89 | This will automatically create the device /dev/CHRONOS when you plug in the
90 | Chronos USB dongle, and make it non-root accessible. This is the default
91 | device chronic-cli.py will try to open, but something else can be specified
92 | on the command line if you prefer not to play with udev.
93 |
94 | USE
95 | ===
96 |
97 | In normal use the watch has two main 'menus': one for the top row, and one
98 | for the bottom. Pressing the * button cycles through the top row menus and
99 | pressing # cycles the bottom row. When a particular menu item is shown,
100 | pressing the UP or DOWN buttons activates its function. In ChronIC, this
101 | is normally 'selecting' that menu item, but when the normal 'time/date'
102 | items are shown, pressing UP or DOWN will always transmit the data associated
103 | with each button. Selecting a menu item will display an 'R' symbol against that
104 | item when cycling through, showing that it is currently active.
105 |
106 | To associate specific data with a button, you can either transmit the data
107 | to the watch using SYNC mode (selected on the lower menu) and the python
108 | helper app 'chronic-cli.py', or you can choose a pre-programmed data set
109 | which includes correct timing, frequency, modulation etc. from the upper
110 | menu. An example called 'BELL' will select the appropriate data and
111 | transmission settings to ring my doorbell, should you happen to be in my
112 | neighbourhood. :)
113 |
114 | SETTINGS
115 | ========
116 |
117 | The following parameters can be set with the python cli:
118 |
119 | BAUD RF Modem baudrate in Hz.
120 |
121 | BYRON Configure for Byron doorbell emulation (433).
122 |
123 | DELAY <1-255> Milliseconds delay between each REPEAT.
124 |
125 | DOWN DATA to be sent by DOWN button. Three sequences of up to 63
126 | bytes each.
127 |
128 | FREQ Frequency e.g. 433920000.
129 |
130 | FRIEDLAND Configure for Friedland doorbell emulation (868).
131 |
132 | MAN Manchester Encoding ON or OFF.
133 |
134 | MOD Modulation:
135 |
136 | FSK - Frequency Shift Keying
137 | GFSK - Gaussian Frequency Shift Keying
138 | OOK - On-Off Keying (in Amplitude Shift Keying mode)
139 | MSK - Multiple Frequency Shift Keying
140 |
141 | PORT The serial port your Chronos USB dongle lives on (default /dev/CHRONOS).
142 | This should be set as the first command if the default does not exist.
143 |
144 | PULSE RF Modem baudrate expressed as pulsewidth (e.g. a pulsewidth
145 | of 0.000320 seconds is 3124.23 Hz). In ASK/OOK mode, the
146 | baudrate is generally the pulsewidth of the shortest pulse
147 | found in the original signal.
148 |
149 | REPEAT <1-255> Number of times to send DATA SEQUENCES when button pressed.
150 |
151 | RUKU Configure for Ruku garage door opener emulation (433).
152 |
153 | SERIAL USB dongle comms baudrate (default 115200).
154 |
155 | TIME Set TIME/DATE to match PC.
156 |
157 | UP DATA to be sent by UP button. Three sequences of up to 63
158 | bytes each.
159 |
160 | EXIT Exit SYNC mode on watch.
161 |
162 | Examples:
163 |
164 | Send a fairly well known signal:
165 |
166 | chronic-cli.py FREQ 433920000 MAN OFF MOD OOK PULSE .008 DELAY 255 REPEAT 5 UP aaaa0000aaaa0000aaaa0000aaaaaaaaaaaa0000aaaaaaaaaaaa0000aaaaaaaaaaaa0000aaaa0000aaaa0000aaaa0000 '' '' EXIT
167 |
168 | Manually configure to ring my doorbell:
169 |
170 | chronic-cli.py FREQ 433920000 MAN OFF MOD OOK PULSE .000320 DELAY 0 REPEAT 60 UP 2C92496DB2000000 '' '' DOWN 2C92496DB2000000 '' '' EXIT
171 |
172 | The helper app also includes a couple of examples showing how easy it is to hardwire specific configurations. These
173 | are 'BYRON' and 'RUKU', which are my doorbell and a simple garage door opener respectively.
174 |
175 | Enjoy!
176 | Adam
177 |
178 |
--------------------------------------------------------------------------------
/CCS/driver/adc12.c:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 | // ADC12 functions.
36 | // *************************************************************************************************
37 |
38 | // *************************************************************************************************
39 | // Include section
40 |
41 | // system
42 | #include
43 |
44 | // driver
45 | #include "adc12.h"
46 | #include "timer.h"
47 |
48 | // *************************************************************************************************
49 | // Prototypes section
50 |
51 | // *************************************************************************************************
52 | // Defines section
53 |
54 | // *************************************************************************************************
55 | // Global Variable section
56 | u16 adc12_result;
57 | u8 adc12_data_ready;
58 |
59 | // *************************************************************************************************
60 | // Extern section
61 |
62 | // *************************************************************************************************
63 | // @fn adc12_single_conversion
64 | // @brief Init ADC12. Do single conversion. Turn off ADC12.
65 | // @param u16 ref Select reference
66 | // u16 sht Sample-and-hold time
67 | // u16 channel Channel of the conversion
68 | // @return u16 adc12_result Return ADC result
69 | // *************************************************************************************************
70 | u16 adc12_single_conversion(u16 ref, u16 sht, u16 channel)
71 | {
72 | // Initialize the shared reference module
73 | REFCTL0 |= REFMSTR + ref + REFON; // Enable internal reference (1.5V or 2.5V)
74 |
75 | // Initialize ADC12_A
76 | ADC12CTL0 = sht + ADC12ON; // Set sample time
77 | ADC12CTL1 = ADC12SHP; // Enable sample timer
78 | ADC12MCTL0 = ADC12SREF_1 + channel; // ADC input channel
79 | ADC12IE = 0x001; // ADC_IFG upon conv result-ADCMEMO
80 |
81 | // Wait 2 ticks (66us) to allow internal reference to settle
82 | Timer0_A4_Delay(2);
83 |
84 | // Start ADC12
85 | ADC12CTL0 |= ADC12ENC;
86 |
87 | // Clear data ready flag
88 | adc12_data_ready = 0;
89 |
90 | // Sampling and conversion start
91 | ADC12CTL0 |= ADC12SC;
92 |
93 | // Delay to get next ADC value
94 | Timer0_A4_Delay(5);
95 | while (!adc12_data_ready) ;
96 |
97 | // Shut down ADC12
98 | ADC12CTL0 &= ~(ADC12ENC | ADC12SC | sht);
99 | ADC12CTL0 &= ~ADC12ON;
100 |
101 | // Shut down reference voltage
102 | REFCTL0 &= ~(REFMSTR + ref + REFON);
103 |
104 | ADC12IE = 0;
105 |
106 | // Return ADC result
107 | return (adc12_result);
108 | }
109 |
110 | // *************************************************************************************************
111 | // @fn ADC12ISR
112 | // @brief Store ADC12 conversion result. Set flag to indicate data ready.
113 | // @param none
114 | // @return none
115 | // *************************************************************************************************
116 | #pragma vector=ADC12_VECTOR
117 | __interrupt void ADC12ISR(void)
118 | {
119 | switch (__even_in_range(ADC12IV, 34))
120 | {
121 | case 0:
122 | break; // Vector 0: No interrupt
123 | case 2:
124 | break; // Vector 2: ADC overflow
125 | case 4:
126 | break; // Vector 4: ADC timing overflow
127 | case 6: // Vector 6: ADC12IFG0
128 | adc12_result = ADC12MEM0; // Move results, IFG is cleared
129 | adc12_data_ready = 1;
130 | _BIC_SR_IRQ(LPM3_bits); // Exit active CPU
131 | break;
132 | case 8:
133 | break; // Vector 8: ADC12IFG1
134 | case 10:
135 | break; // Vector 10: ADC12IFG2
136 | case 12:
137 | break; // Vector 12: ADC12IFG3
138 | case 14:
139 | break; // Vector 14: ADC12IFG4
140 | case 16:
141 | break; // Vector 16: ADC12IFG5
142 | case 18:
143 | break; // Vector 18: ADC12IFG6
144 | case 20:
145 | break; // Vector 20: ADC12IFG7
146 | case 22:
147 | break; // Vector 22: ADC12IFG8
148 | case 24:
149 | break; // Vector 24: ADC12IFG9
150 | case 26:
151 | break; // Vector 26: ADC12IFG10
152 | case 28:
153 | break; // Vector 28: ADC12IFG11
154 | case 30:
155 | break; // Vector 30: ADC12IFG12
156 | case 32:
157 | break; // Vector 32: ADC12IFG13
158 | case 34:
159 | break; // Vector 34: ADC12IFG14
160 | default:
161 | break;
162 | }
163 | }
164 |
165 |
--------------------------------------------------------------------------------
/CCS/driver/radio.c:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 | // Radio core access functions. Taken from TI reference code for CC430.
36 | // *************************************************************************************************
37 |
38 | // system
39 | #include "project.h"
40 |
41 | // driver
42 | #include "rf1a.h"
43 | #include "timer.h"
44 |
45 | // logic
46 | #include "rfsimpliciti.h"
47 | //#include "bluerobin.h"
48 |
49 | // *************************************************************************************************
50 | // Extern section
51 |
52 | // SimpliciTI CC430 radio ISR - located in SimpliciTi library
53 | extern void MRFI_RadioIsr(void);
54 |
55 | // BlueRobin CC430 radio ISR - located in BlueRobin library
56 | //extern void BlueRobin_RadioISR_v(void);
57 |
58 | // *************************************************************************************************
59 | // @fn radio_reset
60 | // @brief Reset radio core.
61 | // @param none
62 | // @return none
63 | // *************************************************************************************************
64 | void radio_reset(void)
65 | {
66 | volatile u16 i;
67 | u8 x;
68 |
69 | // Reset radio core
70 | Strobe(RF_SRES);
71 | // Wait before checking IDLE
72 | for (i = 0; i < 100; i++) ;
73 | do
74 | {
75 | x = Strobe(RF_SIDLE);
76 | }
77 | while ((x & 0x70) != 0x00);
78 |
79 | // Clear radio error register
80 | RF1AIFERR = 0;
81 | }
82 |
83 | // *************************************************************************************************
84 | // @fn radio_powerdown
85 | // @brief Put radio to SLEEP mode.
86 | // @param none
87 | // @return none
88 | // *************************************************************************************************
89 | void radio_powerdown(void)
90 | {
91 | // Chip bug: Radio does not come out of this SLEEP when put to sleep
92 | // using the SPWD cmd. However, it does wakes up if SXOFF was used to
93 | // put it to sleep.
94 |
95 | // Powerdown radio
96 | Strobe(RF_SIDLE);
97 | Strobe(RF_SPWD);
98 | }
99 |
100 | // *************************************************************************************************
101 | // @fn radio_sxoff
102 | // @brief Put radio to SLEEP mode (XTAL off only).
103 | // @param none
104 | // @return none
105 | // *************************************************************************************************
106 | void radio_sxoff(void)
107 | {
108 | // Chip bug: Radio does not come out of this SLEEP when put to sleep
109 | // using the SPWD cmd. However, it does wakes up if SXOFF was used to
110 | // put it to sleep.
111 |
112 | // Powerdown radio
113 | Strobe(RF_SIDLE);
114 | Strobe(RF_SXOFF);
115 | }
116 |
117 | // *************************************************************************************************
118 | // @fn open_radio
119 | // @brief Prepare radio for RF communication.
120 | // @param none
121 | // @return none
122 | // *************************************************************************************************
123 | void open_radio(void)
124 | {
125 | // Reset radio core
126 | radio_reset();
127 |
128 | // Enable radio IRQ
129 | RF1AIFG &= ~BIT4; // Clear a pending interrupt
130 | RF1AIE |= BIT4; // Enable the interrupt
131 | }
132 |
133 | // *************************************************************************************************
134 | // @fn close_radio
135 | // @brief Shutdown radio for RF communication.
136 | // @param none
137 | // @return none
138 | // *************************************************************************************************
139 | void close_radio(void)
140 | {
141 | // Disable radio IRQ
142 | RF1AIFG = 0;
143 | RF1AIE = 0;
144 |
145 | // Reset radio core
146 | radio_reset();
147 |
148 | // Put radio to sleep
149 | radio_powerdown();
150 | }
151 |
152 | // *************************************************************************************************
153 | // @fn GDOx_ISR
154 | // @brief GDO0/2 ISR to detect received packet.
155 | // In BlueRobin mode: capture packet end time and decode received
156 | // packet
157 | // In SimpliciTI mode: go to SimpliciTI handler
158 | // @param none
159 | // @return none
160 | // *************************************************************************************************
161 | #pragma vector=CC1101_VECTOR
162 | __interrupt void radio_ISR(void)
163 | {
164 | u8 rf1aivec = RF1AIV;
165 |
166 | // Forward to SimpliciTI interrupt service routine
167 | if (is_rf())
168 | {
169 | MRFI_RadioIsr();
170 | }
171 | else // BlueRobin packet end interrupt service routine
172 | {
173 | if (rf1aivec == RF1AIV_RFIFG9)
174 | {
175 | // if ((sBlueRobin.state == BLUEROBIN_SEARCHING) ||
176 | // (sBlueRobin.state == BLUEROBIN_CONNECTED))
177 | // {
178 | // BlueRobin_RadioISR_v();
179 | // }
180 | }
181 | else if (rf1aivec == RF1AIV_NONE) // RF1A interface interrupt (error etc.)
182 | {
183 | asm (" nop"); // break here
184 | }
185 | }
186 | }
187 |
188 |
--------------------------------------------------------------------------------
/CCS/logic/battery.c:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 | // Battery voltage measurement functions.
36 | // *************************************************************************************************
37 |
38 | // *************************************************************************************************
39 | // Include section
40 |
41 | // system
42 | #include "project.h"
43 |
44 | // driver
45 | #include "display.h"
46 | #include "ports.h"
47 | #include "adc12.h"
48 |
49 | // logic
50 | #include "menu.h"
51 | #include "battery.h"
52 |
53 | // *************************************************************************************************
54 | // Prototypes section
55 | void reset_batt_measurement(void);
56 | void battery_measurement(void);
57 |
58 | // *************************************************************************************************
59 | // Defines section
60 |
61 | // *************************************************************************************************
62 | // Global Variable section
63 | struct batt sBatt;
64 |
65 | // *************************************************************************************************
66 | // Extern section
67 | extern void (*fptr_lcd_function_line2)(u8 line, u8 update);
68 |
69 | // *************************************************************************************************
70 | // @fn reset_temp_measurement
71 | // @brief Reset temperature measurement module.
72 | // @param none
73 | // @return none
74 | // *************************************************************************************************
75 | void reset_batt_measurement(void)
76 | {
77 | // Set flag to off
78 | sBatt.state = MENU_ITEM_NOT_VISIBLE;
79 |
80 | // Reset lobatt display counter
81 | sBatt.lobatt_display = BATTERY_LOW_MESSAGE_CYCLE;
82 |
83 | // Start with battery voltage of 3.00V
84 | sBatt.voltage = 300;
85 | }
86 |
87 | // *************************************************************************************************
88 | // @fn battery_measurement
89 | // @brief Init ADC12. Do single conversion of AVCC voltage. Turn off ADC12.
90 | // @param none
91 | // @return none
92 | // *************************************************************************************************
93 | void battery_measurement(void)
94 | {
95 | u16 voltage;
96 |
97 | // Convert external battery voltage (ADC12INCH_11=AVCC-AVSS/2)
98 | voltage = adc12_single_conversion(REFVSEL_1, ADC12SHT0_10, ADC12INCH_11);
99 |
100 | // Convert ADC value to "x.xx V"
101 | // Ideally we have A11=0->AVCC=0V ... A11=4095(2^12-1)->AVCC=4V
102 | // --> (A11/4095)*4V=AVCC --> AVCC=(A11*4)/4095
103 | voltage = (voltage * 2 * 2) / 41;
104 |
105 | // Correct measured voltage with calibration value
106 | voltage += sBatt.offset;
107 |
108 | // Discard values that are clearly outside the measurement range
109 | if (voltage > BATTERY_HIGH_THRESHOLD)
110 | {
111 | voltage = sBatt.voltage;
112 | }
113 |
114 | // Filter battery voltage
115 | sBatt.voltage = ((voltage * 2) + (sBatt.voltage * 8)) / 10;
116 |
117 | // If battery voltage falls below low battery threshold, set system flag and modify LINE2
118 | // display function pointer
119 | if (sBatt.voltage < BATTERY_LOW_THRESHOLD)
120 | {
121 | sys.flag.low_battery = 1;
122 |
123 | // Set sticky battery icon
124 | display_symbol(LCD_SYMB_BATTERY, SEG_ON);
125 | }
126 | else
127 | {
128 | sys.flag.low_battery = 0;
129 |
130 | // Clear sticky battery icon
131 | display_symbol(LCD_SYMB_BATTERY, SEG_OFF);
132 | }
133 | // Update LINE2
134 | display.flag.line2_full_update = 1;
135 |
136 | // Indicate to display function that new value is available
137 | display.flag.update_battery_voltage = 1;
138 | }
139 |
140 | // *************************************************************************************************
141 | // @fn display_battery_V
142 | // @brief Display routine for battery voltage.
143 | // @param u8 line LINE2
144 | // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_CLEAR
145 | // @return none
146 | // *************************************************************************************************
147 | void display_battery_V(u8 line, u8 update)
148 | {
149 | u8 *str;
150 |
151 | // Redraw line
152 | if (update == DISPLAY_LINE_UPDATE_FULL)
153 | {
154 | // Set battery and V icon
155 | display_symbol(LCD_SYMB_BATTERY, SEG_ON);
156 |
157 | // Menu item is visible
158 | sBatt.state = MENU_ITEM_VISIBLE;
159 |
160 | // Display result in xx.x format
161 | str = int_to_array(sBatt.voltage, 3, 0);
162 |
163 | display_chars(LCD_SEG_L2_2_0, str, SEG_ON);
164 | display_symbol(LCD_SEG_L2_DP, SEG_ON);
165 | }
166 | else if (update == DISPLAY_LINE_UPDATE_PARTIAL)
167 | {
168 | // Display result in xx.x format
169 | str = int_to_array(sBatt.voltage, 3, 0);
170 |
171 | display_chars(LCD_SEG_L2_2_0, str, SEG_ON);
172 |
173 | display.flag.update_battery_voltage = 0;
174 | }
175 | else if (update == DISPLAY_LINE_CLEAR)
176 | {
177 | // Menu item is not visible
178 | sBatt.state = MENU_ITEM_NOT_VISIBLE;
179 |
180 | // Clear function-specific symbols
181 | display_symbol(LCD_SYMB_BATTERY, SEG_OFF);
182 | }
183 | }
184 |
185 |
--------------------------------------------------------------------------------
/CCS/simpliciti/simpliciti.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 | //
36 | // SimpliciTI packet size (TX only mode)
37 | // -------------------------------------
38 | //
39 | // * packet rate (100/3) packets/second = 33.3 packets/second
40 | // * packet length 28 bytes
41 | // * packet structure 4 bytes preamble
42 | // 4 bytes sync
43 | // 1 bytes length
44 | // 1 bytes address
45 | // 16 bytes data
46 | // 12 byte network data
47 | // 4 byte user data
48 | // 2 bytes crc
49 | //
50 | // SimpliciTI frequency overview
51 | // -----------------------------
52 | //
53 | // CC430_End_Device_433MHz.lib (433MHz ISM band)
54 | //
55 | // * base frequency 433.92 MHz
56 | // * deviation 32 kHz
57 | // * channel spacing 25 kHz
58 | // * used channel number 0 (frequency agility/hopping disabled)
59 | // * data rate 76.8 kBaud
60 | // * output power 1.4 dBm
61 | // * duty 9,6% (TX only mode, 32 packets / second)
62 | //
63 | // CC430_End_Device_868MHz.lib (868MHz ISM band)
64 | //
65 | // * base frequency 869.525 MHz
66 | // * deviation 32 kHz
67 | // * channel spacing 25 kHz
68 | // * used channel number 0 (frequency agility/hopping disabled)
69 | // * data rate 76.8 kBaud
70 | // * output power 1.1 dBm
71 | // * duty 9,6% (TX only mode, 32 packets / second)
72 | //
73 | // CC430_End_Device_915MHz.lib (915MHz ISM band)
74 | //
75 | // * base frequency 902.000 MHz
76 | // * deviation 32 kHz
77 | // * channel spacing 200 kHz
78 | // * used channel number 20 (frequency agility/hopping disabled)
79 | // * data rate 76.8 kBaud
80 | // * output power 1.3 dBm
81 | // * duty 9.6% (TX only mode, 32 packets / second)
82 | //
83 | // *************************************************************************************************
84 |
85 | // ---------------------------------------------------------------
86 | // Generic defines and variables
87 |
88 | // Entry point into SimpliciTI library
89 | extern unsigned char simpliciti_link(void);
90 |
91 | // 4 byte device address overrides device address set during compile time
92 | extern unsigned char simpliciti_ed_address[4];
93 |
94 | // Maximum data length
95 | #define SIMPLICITI_MAX_PAYLOAD_LENGTH (32u)
96 |
97 | // Data to send / receive
98 | extern unsigned char simpliciti_data[SIMPLICITI_MAX_PAYLOAD_LENGTH];
99 |
100 | // Flag contains status information and triggers to send data or to exit SimpliciTI library
101 | // Control is done from outside SimpliciTI library
102 | extern unsigned char simpliciti_flag;
103 | #define SIMPLICITI_STATUS_LINKING (BIT0)
104 | #define SIMPLICITI_STATUS_LINKED (BIT1)
105 | #define SIMPLICITI_STATUS_ERROR (BIT2)
106 | #define SIMPLICITI_TRIGGER_SEND_DATA (BIT3)
107 | #define SIMPLICITI_TRIGGER_RECEIVED_DATA (BIT4)
108 | #define SIMPLICITI_TRIGGER_STOP (BIT5)
109 |
110 | // Radio frequency offset read from calibration memory
111 | // Compensates crystal deviation from 26MHz nominal value
112 | extern unsigned char rf_frequoffset;
113 |
114 | // Macros
115 | #define getFlag(val, flag) ((val & flag) == flag)
116 | #define setFlag(val, flag) (val |= flag)
117 | #define clearFlag(val, flag) (val &= (~flag))
118 | #define toggleFlag(val, flag) (val ^= flag)
119 |
120 |
121 | // ---------------------------------------------------------------
122 | // SimpliciTI RX only
123 |
124 | // Entry point into SimpliciTI library
125 | extern void simpliciti_main_tx_only(void);
126 |
127 | // Callback function to read data from acceleration sensor or buttons and trigger sending
128 | extern void simpliciti_get_ed_data_callback(void);
129 |
130 |
131 | // ---------------------------------------------------------------
132 | // SimpliciTI Sync
133 |
134 | // Sync data length
135 | #define BM_SYNC_DATA_LENGTH (19u)
136 |
137 | // Device data (0)TYPE (1) - (18) DATA
138 | #define SYNC_ED_TYPE_R2R (1u)
139 | #define SYNC_ED_TYPE_MEMORY (2u)
140 | #define SYNC_ED_TYPE_STATUS (3u)
141 |
142 | // Host data (0)CMD (1) - (18) DATA
143 | #define SYNC_AP_CMD_NOP (1u)
144 | #define SYNC_AP_CMD_GET_STATUS (2u)
145 | #define SYNC_AP_CMD_SET_WATCH (3u)
146 | #define SYNC_AP_CMD_GET_MEMORY_BLOCKS_MODE_1 (4u)
147 | #define SYNC_AP_CMD_GET_MEMORY_BLOCKS_MODE_2 (5u)
148 | #define SYNC_AP_CMD_ERASE_MEMORY (6u)
149 | #define SYNC_AP_CMD_EXIT (7u)
150 | // ChronIC additions
151 | #define SYNC_ALAB_SET_UP (8u)
152 | #define SYNC_ALAB_SET_DOWN (9u)
153 | #define SYNC_ALAB_SET_FREQ (10u)
154 | #define SYNC_ALAB_SET_MANCHESTER (11u)
155 | #define SYNC_ALAB_SET_DATA_RATE (12u)
156 | #define SYNC_ALAB_SET_REPEAT (13u)
157 | #define SYNC_ALAB_SET_DELAY (14u)
158 | #define SYNC_ALAB_SET_MODULATION (15u)
159 | #define SYNC_ALAB_SET_SEQ (16u)
160 | #define SEQ_UP 0
161 | #define SEQ_DOWN 1
162 |
163 | // Entry point into SimpliciTI library
164 | extern void simpliciti_main_sync(void);
165 |
166 | // Callback function to decode access point command
167 | extern void simpliciti_sync_decode_ap_cmd_callback(void);
168 |
169 | // Callback function to read data from application and trigger sending
170 | extern void simpliciti_sync_get_data_callback(unsigned int index);
171 |
172 | // Send reply packets (>0), 0=no need to reply
173 | extern unsigned char simpliciti_reply_count;
174 |
175 |
--------------------------------------------------------------------------------
/CCS/driver/buzzer.c:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
4 | //
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above copyright
14 | // notice, this list of conditions and the following disclaimer in the
15 | // documentation and/or other materials provided with the
16 | // distribution.
17 | //
18 | // Neither the name of Texas Instruments Incorporated nor the names of
19 | // its contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // *************************************************************************************************
35 | // Buzzer functions.
36 | // *************************************************************************************************
37 |
38 | // *************************************************************************************************
39 | // Include section
40 |
41 | // system
42 | #include "project.h"
43 |
44 | // driver
45 | #include "buzzer.h"
46 | #include "timer.h"
47 | #include "display.h"
48 |
49 | // logic
50 | #include "alarm.h"
51 |
52 | // *************************************************************************************************
53 | // Prototypes section
54 | void toggle_buzzer(void);
55 | void countdown_buzzer(void);
56 |
57 | // *************************************************************************************************
58 | // Defines section
59 |
60 | // *************************************************************************************************
61 | // Global Variable section
62 | struct buzzer sBuzzer;
63 |
64 | // *************************************************************************************************
65 | // Extern section
66 | //extern u16 timer0_A3_ticks_g;
67 |
68 | // *************************************************************************************************
69 | // @fn reset_buzzer
70 | // @brief Init buzzer variables
71 | // @param none
72 | // @return none
73 | // *************************************************************************************************
74 | void reset_buzzer(void)
75 | {
76 | sBuzzer.time = 0;
77 | sBuzzer.state = BUZZER_OFF;
78 | }
79 |
80 | // *************************************************************************************************
81 | // @fn start_buzzer
82 | // @brief Start buzzer output for a number of cylces
83 | // @param u8 cycles Keep buzzer output for number of cycles
84 | // u16 on_time Output buzzer for "on_time" ACLK ticks
85 | // u16 off_time Do not output buzzer for "off_time" ACLK ticks
86 | // @return none
87 | // *************************************************************************************************
88 | void start_buzzer(u8 cycles, u16 on_time, u16 off_time)
89 | {
90 | // Store new buzzer duration while buzzer is off
91 | if (sBuzzer.time == 0)
92 | {
93 | sBuzzer.time = cycles;
94 | sBuzzer.on_time = on_time;
95 | sBuzzer.off_time = off_time;
96 |
97 | // Need to init every time, because SimpliciTI claims same timer
98 | // Reset TA1R, set up mode, TA1 runs from 32768Hz ACLK
99 | TA1CTL = TACLR | MC_1 | TASSEL__ACLK;
100 |
101 | // Set PWM frequency
102 | TA1CCR0 = BUZZER_TIMER_STEPS;
103 |
104 | // Enable IRQ, set output mode "toggle"
105 | TA1CCTL0 = OUTMOD_4;
106 |
107 | // Allow buzzer PWM output on P2.7
108 | P2SEL |= BIT7;
109 |
110 | // Activate Timer0_A3 periodic interrupts
111 | fptr_Timer0_A3_function = toggle_buzzer;
112 | Timer0_A3_Start(sBuzzer.on_time);
113 |
114 | // Preload timer advance variable
115 | sTimer.timer0_A3_ticks = sBuzzer.off_time;
116 |
117 | // Start with buzzer output on
118 | sBuzzer.state = BUZZER_ON_OUTPUT_ENABLED;
119 | }
120 | }
121 |
122 | // *************************************************************************************************
123 | // @fn toggle_buzzer
124 | // @brief Keeps track of buzzer on/off duty cycle
125 | // @param none
126 | // @return none
127 | // *************************************************************************************************
128 | void toggle_buzzer(void)
129 | {
130 | // Turn off buzzer
131 | if (sBuzzer.state == BUZZER_ON_OUTPUT_ENABLED)
132 | {
133 | // Stop PWM timer
134 | TA1CTL &= ~(BIT4 | BIT5);
135 |
136 | // Reset and disable buzzer PWM output
137 | P2OUT &= ~BIT7;
138 | P2SEL &= ~BIT7;
139 |
140 | // Update buzzer state
141 | sBuzzer.state = BUZZER_ON_OUTPUT_DISABLED;
142 |
143 | // Reload Timer0_A4 IRQ to restart output
144 | sTimer.timer0_A3_ticks = sBuzzer.on_time;
145 | }
146 | else // Turn on buzzer
147 | {
148 | // Decrement buzzer total cycles
149 | countdown_buzzer();
150 |
151 | // Reload Timer0_A4 to stop output if sBuzzer.time > 0
152 | if (sBuzzer.state != BUZZER_OFF)
153 | {
154 | // Reset timer TA1
155 | TA1R = 0;
156 | TA1CTL |= MC_1;
157 |
158 | // Enable buzzer PWM output
159 | P2SEL |= BIT7;
160 |
161 | // Update buzzer state
162 | sBuzzer.state = BUZZER_ON_OUTPUT_ENABLED;
163 |
164 | // Reload Timer0_A4 IRQ to turn off output
165 | sTimer.timer0_A3_ticks = sBuzzer.off_time;
166 | }
167 | }
168 | }
169 |
170 | // *************************************************************************************************
171 | // @fn stop_buzzer
172 | // @brief Stop buzzer output
173 | // @param none
174 | // @return none
175 | // *************************************************************************************************
176 | void stop_buzzer(void)
177 | {
178 | // Stop PWM timer
179 | TA1CTL &= ~(BIT4 | BIT5);
180 |
181 | // Disable buzzer PWM output
182 | P2OUT &= ~BIT7;
183 | P2SEL &= ~BIT7;
184 |
185 | // Clear PWM timer interrupt
186 | TA1CCTL0 &= ~CCIE;
187 |
188 | // Disable periodic start/stop interrupts
189 | Timer0_A3_Stop();
190 |
191 | // Clear variables
192 | reset_buzzer();
193 | }
194 |
195 | // *************************************************************************************************
196 | // @fn is_buzzer
197 | // @brief Check if buzzer is operating
198 | // @param none
199 | // @return u8 1 = Buzzer is operating, 0 = Buzzer is off
200 | // *************************************************************************************************
201 | u8 is_buzzer(void)
202 | {
203 | return (sBuzzer.state != BUZZER_OFF);
204 | }
205 |
206 | // *************************************************************************************************
207 | // @fn countdown_buzzer
208 | // @brief Decrement active buzzer time. Turn off buzzer if cycle end reached.
209 | // @param none
210 | // @return none
211 | // *************************************************************************************************
212 | void countdown_buzzer(void)
213 | {
214 | // Stop buzzer when reaching 0 cycles
215 | if (--sBuzzer.time == 0)
216 | {
217 | stop_buzzer();
218 | }
219 | }
220 |
221 |
--------------------------------------------------------------------------------
/python/chronic-cli.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python
2 |
3 | # chronic-cli.py - ChronIC command utility
4 | #
5 | # Adam Laurie
6 | # http://www.aperturelabs.com
7 | #
8 | # This code is copyright (c) Aperture Labs Ltd., 2013, All rights reserved.
9 | #
10 |
11 | import sys
12 | import serial
13 | import time
14 | import chronic
15 |
16 | if len(sys.argv) < 2:
17 | print
18 | print 'Usage: %s [ARG(s)] ... [ [ARG(s)] ... ]' % sys.argv[0]
19 | print
20 | print ' Commands:'
21 | print
22 | print ' BAUD Set RF modem baudrate'
23 | print ' BYRON Configure for Byron doorbell emulation (433)'
24 | print ' DELAY <0-255> Delay in MS between each DATA transmission'
25 | print ' DOWN Set DATA for DOWN button - 3 * 63 bytes'
26 | print ' EXIT Force sync mode EXIT on Chronos'
27 | print ' FREQ Set Frequency (e.g. 433920000)'
28 | print ' FRIEDLAND Configure for Friedland doorbell emulation (868)'
29 | print " MAN <'ON'|'OFF'> Set Manchester Encoding"
30 | print ' MOD Modulation:'
31 | print ' FSK - Frequency Shift Keying'
32 | print ' GFSK - Gaussian Frequency Shift Keying'
33 | print ' OOK - On-Off Keying (in ASK mode)'
34 | print ' MSK - Multiple Frequency Shift Keying'
35 | print ' REPEAT <0-255> Number of times to repeat DATA when button pressed'
36 | print ' RUKU Configure for Ruku garage door emulation (433)'
37 | print ' SERIAL Set access point comms baudrate (default 115200)'
38 | print ' PULSE Set pulsewidth (baud rate = 1.0/pulsewidth)'
39 | print ' TIME Synchronise time/date'
40 | print ' UP Set DATA for UP button - 3 * 63 bytes'
41 | print
42 | print ' Commands will be executed sequentially and must be combined as appropriate.'
43 | print ' It is recommended to finish with an EXIT to help conserve battery.'
44 | print
45 | exit(True)
46 |
47 | Port= "/dev/CHRONOS"
48 | SerialBaud= 115200
49 | try:
50 | ap= chronic.chronos(Port, SerialBaud)
51 | except:
52 | print
53 | print '*** warning! default Access Point not found (%s)!' % Port
54 |
55 | current= 1
56 | while current < len(sys.argv):
57 | command= sys.argv[current].upper()
58 | if command == 'BYRON':
59 | print
60 | print ' Setting up for Byron Doorbell'
61 | print
62 | print ' Setting Frequency: 433920000'
63 | ap.setfreq(433920000)
64 | print ' Setting Manchester Encoding: OFF'
65 | ap.setmanchester('OFF')
66 | print ' Setting Delay: 0'
67 | ap.setdelay(0)
68 | print ' Setting Repeat: 60'
69 | ap.setrepeat(60)
70 | print ' Setting PulseWidth: 0.000320',
71 | ret, rate= ap.setdatarate(1.0/0.000320)
72 | print '(%f Baud)' % rate
73 | print ' Setting UP button: 2C92496DB2000000'
74 | payload= ['2C92496DB2000000'.decode('hex'),'','']
75 | ap.sendbutton('UP', payload)
76 | print ' Setting DOWN button: 2C92496DB2000000'
77 | ap.sendbutton('DOWN', payload)
78 | current += 1
79 | continue
80 | if command == 'DELAY':
81 | current += 1
82 | delay= int(sys.argv[current])
83 | print
84 | print ' Setting delay:', delay,
85 | sys.stdout.flush()
86 | ret= ap.setdelay(delay)
87 | if ret:
88 | print '(OK)'
89 | else:
90 | print 'Failed!'
91 | break
92 | current += 1
93 | continue
94 | if command == 'DOWN' or command == 'UP':
95 | print
96 | payload= []
97 | for x in range(3):
98 | current += 1
99 | payload.append(sys.argv[current].decode('hex'))
100 | print ' Setting %s Button:' % command,
101 | sys.stdout.flush()
102 | if ap.sendbutton(command, payload):
103 | print '(OK)'
104 | else:
105 | print 'Failed!'
106 | break
107 | current += 1
108 | continue
109 | if command == 'EXIT':
110 | print
111 | print ' Sending EXIT command'
112 | ap.exit()
113 | print
114 | current += 1
115 | continue
116 | if command == 'FREQ':
117 | current += 1
118 | freq= int(sys.argv[current])
119 | print
120 | print ' Setting Frequency:', freq,
121 | sys.stdout.flush()
122 | if ap.setfreq(freq):
123 | print '(OK)'
124 | else:
125 | print 'Failed!'
126 | break
127 | current += 1
128 | continue
129 | if command == 'FRIEDLAND':
130 | print
131 | print ' Setting up for Friedland Doorbell'
132 | print
133 | print ' Setting Frequency: 868350000'
134 | ap.setfreq(868350000)
135 | print ' Setting Manchester Encoding: OFF'
136 | ap.setmanchester('OFF')
137 | print ' Setting Delay: 0'
138 | ap.setdelay(0)
139 | print ' Setting Repeat: 40'
140 | ap.setrepeat(40)
141 | print ' Setting PulseWidth: 0.000146',
142 | ret, rate= ap.setdatarate(1.0/0.000146)
143 | print '(%f Baud)' % rate
144 | print ' Setting UP button: E36934D24926DA49A4924D2492492492492498'
145 | payload= ['E36934D24926DA49A4924D2492492492492498'.decode('hex'),'','']
146 | ap.sendbutton('UP', payload)
147 | print ' Setting DOWN button: E36934D24926DA49A4924D2492492492492498'
148 | ap.sendbutton('DOWN', payload)
149 | current += 1
150 | continue
151 | if command == 'MAN':
152 | current += 1
153 | manchester= sys.argv[current].upper()
154 | print
155 | print ' Setting Manchester Encoding:', manchester,
156 | sys.stdout.flush()
157 | if ap.setmanchester(manchester):
158 | print '(OK)'
159 | else:
160 | print 'Failed!'
161 | break
162 | current += 1
163 | continue
164 | if command == 'MOD':
165 | current += 1
166 | modulation= sys.argv[current].upper()
167 | print
168 | print ' Setting modulation:', modulation,
169 | sys.stdout.flush()
170 | if ap.setmodulation(modulation):
171 | print '(OK)'
172 | else:
173 | print 'Failed!'
174 | break
175 | current += 1
176 | continue
177 | if command == 'PORT':
178 | current += 1
179 | Port= sys.argv[current]
180 | try:
181 | ap.close()
182 | except:
183 | pass
184 | print
185 | print ' Setting Port to %s:' % Port
186 | ap= chronic.chronos(Port, SerialBaud)
187 | print
188 | current += 1
189 | continue
190 | if command == 'PULSE':
191 | current += 1
192 | pulsewidth= float(sys.argv[current])
193 | print
194 | print ' Setting pulsewidth:', pulsewidth,
195 | sys.stdout.flush()
196 | ret, rate= ap.setdatarate(1.0/pulsewidth)
197 | if ret:
198 | print '(%f Baud)' % rate,
199 | sys.stdout.flush()
200 | else:
201 | print 'Failed!'
202 | break
203 | print '(OK)'
204 | current += 1
205 | continue
206 | if command == 'REPEAT':
207 | current += 1
208 | repeat= int(sys.argv[current])
209 | print
210 | print ' Setting repeat:', repeat,
211 | sys.stdout.flush()
212 | ret= ap.setrepeat(repeat)
213 | if ret:
214 | print '(OK)'
215 | else:
216 | print 'Failed!'
217 | break
218 | current += 1
219 | continue
220 | if command == 'RUKU':
221 | print
222 | print ' Setting up for RUKU'
223 | print
224 | print ' Setting Frequency: 393080000'
225 | ap.setfreq(393080000)
226 | print ' Setting Manchester Encoding: OFF'
227 | ap.setmanchester('OFF')
228 | print ' Setting Delay: 0'
229 | ap.setdelay(0)
230 | print ' Setting Repeat: 6'
231 | ap.setrepeat(6)
232 | print ' Setting PulseWidth: 0.000100',
233 | ret, rate= ap.setdatarate(1.0/0.000100)
234 | print '(%f Baud)' % rate
235 | print ' Setting UP button: 924B2DB6C80000'
236 | payload= ['924B2DB6C8'.decode('hex')]*3
237 | ap.sendbutton('UP', payload)
238 | print ' Setting DOWN button: 924B2D96C80000'
239 | payload= ['924B2D96C8'.decode('hex')]
240 | ap.sendbutton('DOWN', payload)
241 | current += 1
242 | continue
243 | if command == 'SERIAL':
244 | current += 1
245 | SerialBaud= int(sys.argv[current])
246 | ap.close()
247 | print
248 | print ' Setting Baud rate to %d:' % SerialBaud
249 | ap= chronic.chronos(Port, SerialBaud)
250 | print
251 | current += 1
252 | continue
253 | if command == 'TIME':
254 | print
255 | hour= int(time.localtime().tm_hour)
256 | minute= int(time.localtime().tm_min)
257 | second= int(time.localtime().tm_sec)
258 | year= int(time.localtime().tm_year)
259 | month= int(time.localtime().tm_mon)
260 | day= int(time.localtime().tm_mday)
261 | print ' Setting Time & Date to: %d-%02d-%02d %02d:%02d:%02d' % (year, month, day, hour, minute, second),
262 | sys.stdout.flush()
263 | hour += 0x80
264 | year_h= (year & 0xff00) >> 8
265 | year_l= year & 0xff
266 | if ap.settime(hour, minute, second, year_h, year_l, month, day):
267 | print '(OK)'
268 | else:
269 | print 'Failed!'
270 | break
271 | print
272 | current += 1
273 | continue
274 | print 'Unrecognised command:', sys.argv[current]
275 | exit(True)
276 | print
277 | ap.stop()
278 | exit(False)
279 |
--------------------------------------------------------------------------------
/CCS/driver/rf1a.c:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Actual revision: $Revision: $
4 | // Revision label: $Name: $
5 | // Revision state: $State: $
6 | //
7 | // *************************************************************************************************
8 | // Radio core access functions. Taken from TI reference code for CC430.
9 | // *************************************************************************************************
10 |
11 | // *************************************************************************************************
12 | // Include section
13 |
14 | // system
15 | #include
16 |
17 | // driver
18 | #include "rf1a.h"
19 |
20 | // *************************************************************************************************
21 | // Global section
22 |
23 | // *************************************************************************************************
24 | // Define section
25 | #define st(x) do { x } while (__LINE__ == -1)
26 | #define ENTER_CRITICAL_SECTION(x) st(x = __get_interrupt_state(); __disable_interrupt(); )
27 | #define EXIT_CRITICAL_SECTION(x) __set_interrupt_state(x)
28 |
29 | // *************************************************************************************************
30 | // @fn Strobe
31 | // @brief Send command to radio.
32 | // @param unsigned char strobe Command to radio
33 | // @return statusByte Radio core status
34 | // *************************************************************************************************
35 | unsigned char Strobe(unsigned char strobe)
36 | {
37 | u8 statusByte = 0;
38 | u16 int_state, gdo_state;
39 |
40 | // Check for valid strobe command
41 | if ((strobe == 0xBD) || ((strobe > RF_SRES) && (strobe < RF_SNOP)))
42 | {
43 | ENTER_CRITICAL_SECTION(int_state);
44 |
45 | // Clear the Status read flag
46 | RF1AIFCTL1 &= ~(RFSTATIFG);
47 |
48 | // Wait for radio to be ready for next instruction
49 | while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
50 |
51 | // Write the strobe instruction
52 | if ((strobe > RF_SRES) && (strobe < RF_SNOP))
53 | {
54 |
55 | gdo_state = ReadSingleReg(IOCFG2); // buffer IOCFG2 state
56 | WriteSingleReg(IOCFG2, 0x29); // c-ready to GDO2
57 |
58 | RF1AINSTRB = strobe;
59 | if ((RF1AIN & 0x04) == 0x04) // chip at sleep mode
60 | {
61 | if ((strobe == RF_SXOFF) || (strobe == RF_SPWD) || (strobe == RF_SWOR))
62 | {
63 | }
64 | else
65 | {
66 | while ((RF1AIN & 0x04) == 0x04) ; // c-ready ?
67 | __delay_cycles(9800); // Delay for ~810usec at 12MHz CPU clock
68 | }
69 | }
70 | WriteSingleReg(IOCFG2, gdo_state); // restore IOCFG2 setting
71 | }
72 | else // chip active mode
73 | {
74 | RF1AINSTRB = strobe;
75 | }
76 | statusByte = RF1ASTATB;
77 | while (!(RF1AIFCTL1 & RFSTATIFG)) ;
78 | EXIT_CRITICAL_SECTION(int_state);
79 | }
80 | return statusByte;
81 | }
82 |
83 | // *************************************************************************************************
84 | // @fn ResetRadioCore
85 | // @brief Software reset radio core.
86 | // @param none
87 | // @return none
88 | // *************************************************************************************************
89 | void ResetRadioCore(void)
90 | {
91 | Strobe(RF_SRES); // Reset the Radio Core
92 | Strobe(RF_SNOP); // Reset Radio Pointer
93 | }
94 |
95 | // *************************************************************************************************
96 | // @fn ReadSingleReg
97 | // @brief Read byte from register.
98 | // @param none
99 | // @return none
100 | // *************************************************************************************************
101 | unsigned char ReadSingleReg(unsigned char addr)
102 | {
103 | unsigned char x;
104 | u16 int_state;
105 |
106 | ENTER_CRITICAL_SECTION(int_state);
107 |
108 | RF1AINSTR1B = (addr | RF_REGRD);
109 | x = RF1ADOUT1B;
110 |
111 | EXIT_CRITICAL_SECTION(int_state);
112 |
113 | return x;
114 | }
115 |
116 | // *************************************************************************************************
117 | // @fn WriteSingleReg
118 | // @brief Write byte to register.
119 | // @param none
120 | // @return none
121 | // *************************************************************************************************
122 | void WriteSingleReg(unsigned char addr, unsigned char value)
123 | {
124 | volatile unsigned int i;
125 | u16 int_state;
126 |
127 | ENTER_CRITICAL_SECTION(int_state);
128 |
129 | while (!(RF1AIFCTL1 & RFINSTRIFG)) ; // Wait for the Radio to be ready for the next
130 | // instruction
131 |
132 | RF1AINSTRW = ((addr | RF_REGWR) << 8) + value; // Send address + Instruction
133 | while (!(RFDINIFG & RF1AIFCTL1)) ;
134 |
135 | i = RF1ADOUTB; // Reset RFDOUTIFG flag which contains status
136 | // byte
137 |
138 | EXIT_CRITICAL_SECTION(int_state);
139 | }
140 |
141 | // *************************************************************************************************
142 | // @fn ReadBurstReg
143 | // @brief Read sequence of bytes from register.
144 | // @param none
145 | // @return none
146 | // *************************************************************************************************
147 | void ReadBurstReg(unsigned char addr, unsigned char *buffer, unsigned char count)
148 | {
149 | unsigned int i;
150 | u16 int_state;
151 |
152 | ENTER_CRITICAL_SECTION(int_state);
153 |
154 | while (!(RF1AIFCTL1 & RFINSTRIFG)) ; // Wait for the Radio to be ready for next instruction
155 | RF1AINSTR1B = (addr | RF_REGRD); // Send address + Instruction
156 |
157 | for (i = 0; i < (count - 1); i++)
158 | {
159 | while (!(RFDOUTIFG & RF1AIFCTL1)) ; // Wait for the Radio Core to update the RF1ADOUTB reg
160 | buffer[i] = RF1ADOUT1B; // Read DOUT from Radio Core + clears RFDOUTIFG
161 | // Also initiates auo-read for next DOUT byte
162 | }
163 | buffer[count - 1] = RF1ADOUT0B; // Store the last DOUT from Radio Core
164 |
165 | EXIT_CRITICAL_SECTION(int_state);
166 | }
167 |
168 | // *************************************************************************************************
169 | // @fn WriteBurstReg
170 | // @brief Write sequence of bytes to register.
171 | // @param none
172 | // @return none
173 | // *************************************************************************************************
174 | void WriteBurstReg(unsigned char addr, unsigned char *buffer, unsigned char count)
175 | {
176 | // Write Burst works wordwise not bytewise - bug known already
177 | unsigned char i;
178 | u16 int_state;
179 |
180 | ENTER_CRITICAL_SECTION(int_state);
181 |
182 | while (!(RF1AIFCTL1 & RFINSTRIFG)) ; // Wait for the Radio to be ready for next
183 | // instruction
184 | RF1AINSTRW = ((addr | RF_REGWR) << 8) + buffer[0]; // Send address + Instruction
185 |
186 | for (i = 1; i < count; i++)
187 | {
188 | RF1ADINB = buffer[i]; // Send data
189 | while (!(RFDINIFG & RF1AIFCTL1)) ; // Wait for TX to finish
190 | }
191 | i = RF1ADOUTB; // Reset RFDOUTIFG flag which contains status
192 | // byte
193 |
194 | EXIT_CRITICAL_SECTION(int_state);
195 | }
196 |
197 | // *************************************************************************************************
198 | // @fn WritePATable
199 | // @brief Write data to power table
200 | // @param unsigned char value Value to write
201 | // @return none
202 | // *************************************************************************************************
203 | void WritePATable(unsigned char value)
204 | {
205 | unsigned char readbackPATableValue = 0;
206 | u16 int_state;
207 |
208 | ENTER_CRITICAL_SECTION(int_state);
209 |
210 | while (readbackPATableValue != value)
211 | {
212 | while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
213 | RF1AINSTRW = 0x7E00 + value; // PA Table write (burst)
214 |
215 | while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
216 | RF1AINSTRB = RF_SNOP; // reset pointer
217 |
218 | while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
219 | RF1AINSTRB = 0xFE; // PA Table read (burst)
220 |
221 | while (!(RF1AIFCTL1 & RFDINIFG)) ;
222 | RF1ADINB = 0x00; //dummy write
223 |
224 | while (!(RF1AIFCTL1 & RFDOUTIFG)) ;
225 | readbackPATableValue = RF1ADOUT0B;
226 |
227 | while (!(RF1AIFCTL1 & RFINSTRIFG)) ;
228 | RF1AINSTRB = RF_SNOP;
229 | }
230 |
231 | EXIT_CRITICAL_SECTION(int_state);
232 | }
233 |
234 |
--------------------------------------------------------------------------------
/CCS/logic/chronic.h:
--------------------------------------------------------------------------------
1 | // *************************************************************************************************
2 | //
3 | // Copyright (C) 2013 Aperture Labs Ltd. - http://aperturelabs.com/
4 | //
5 | // Author: Adam Laurie
6 | //
7 | //
8 | // Redistribution and use in source and binary forms, with or without
9 | // modification, are permitted provided that the following conditions
10 | // are met:
11 | //
12 | // Redistributions of source code must retain the above copyright
13 | // notice, this list of conditions and the following disclaimer.
14 | //
15 | // Redistributions in binary form must reproduce the above copyright
16 | // notice, this list of conditions and the following disclaimer in the
17 | // documentation and/or other materials provided with the
18 | // distribution.
19 | //
20 | // Neither the name of Aperture Labs Ltd. nor the names of
21 | // its contributors may be used to endorse or promote products derived
22 | // from this software without specific prior written permission.
23 | //
24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 | //
36 | // *************************************************************************************************
37 | //
38 | //
39 | // rf1a extension portions copied from:
40 | // *************************************************************************************************
41 | // cSLight
42 | // Extension to drive the Conrad "Funk-Lichtschalter-mit-Sender"
43 | // http://www.conrad.at/ce/de/product/620587/Funk-Lichtschalter-mit-Sender
44 | // (c) Christian M. Schmid
45 | // 1.1.2011
46 |
47 |
48 | // system
49 | #include "bm.h"
50 |
51 | #define BUTTON_DATA_SIZE 64
52 | #define BUTTON_SEQUENCES 3
53 |
54 | // simpliciti has a maximum user payload of 20 bytes so we need to chunk it
55 | #define BUTTON_CHUNK_SIZE 15
56 |
57 | #define EMULATION_MODE_NONE (0u)
58 | #define EMULATION_MODE_DOORBELL (1u)
59 | #define EMULATION_MODE_RUKU (2u)
60 |
61 | // radio parameters
62 |
63 | typedef struct {
64 | BYTE iocfg2; // GDO2 Output Configuration
65 | BYTE iocfg1; // GDO1 Output Configuration
66 | BYTE iocfg0; // GDO0 Output Configuration
67 | BYTE fifothr; // RX FIFO and TX FIFO Thresholds
68 | BYTE sync1; // Sync Word, High Byte
69 | BYTE sync0; // Sync Word, Low Byte
70 | BYTE pktlen; // Packet Length
71 | BYTE pktctrl1; // Packet Automation Control
72 | BYTE pktctrl0; // Packet Automation Control
73 | BYTE addr; // Device Address
74 | BYTE channr; // Channel Number
75 | BYTE fsctrl1; // Frequency Synthesizer Control
76 | BYTE fsctrl0; // Frequency Synthesizer Control
77 | BYTE freq2; // Frequency Control Word, High Byte
78 | BYTE freq1; // Frequency Control Word, Middle Byte
79 | BYTE freq0; // Frequency Control Word, Low Byte
80 | BYTE mdmcfg4; // Modem Configuration
81 | BYTE mdmcfg3; // Modem Configuration
82 | BYTE mdmcfg2; // Modem Configuration
83 | BYTE mdmcfg1; // Modem Configuration
84 | BYTE mdmcfg0; // Modem Configuration
85 | BYTE deviatn; // Modem Deviation Setting
86 | BYTE mcsm2; // Main Radio Control State Machine Configuration
87 | BYTE mcsm1; // Main Radio Control State Machine Configuration
88 | BYTE mcsm0; // Main Radio Control State Machine Configuration
89 | BYTE foccfg; // Frequency Offset Compensation Configuration
90 | BYTE bscfg; // Bit Synchronization Configuration
91 | BYTE agcctrl2; // AGC Control
92 | BYTE agcctrl1; // AGC Control
93 | BYTE agcctrl0; // AGC Control
94 | BYTE worevt1; // High Byte Event0 Timeout
95 | BYTE worevt0; // Low Byte Event0 Timeout
96 | BYTE worctrl; // Wake On Radio Control
97 | BYTE frend1; // Front End RX Configuration
98 | BYTE frend0; // Front End TX Configuration
99 | BYTE fscal3; // Frequency Synthesizer Calibration
100 | BYTE fscal2; // Frequency Synthesizer Calibration
101 | BYTE fscal1; // Frequency Synthesizer Calibration
102 | BYTE fscal0; // Frequency Synthesizer Calibration
103 | BYTE fstest; // Frequency Synthesizer Calibration Control
104 | BYTE ptest; // Production Test
105 | BYTE agctest; // AGC Test
106 | BYTE test2; // Various Test Settings
107 | BYTE test1; // Various Test Settings
108 | BYTE test0; // Various Test Settings
109 | BYTE partnum; // Chip ID
110 | BYTE version; // Chip ID
111 | BYTE freqest; // Frequency Offset Estimate From Demodulator
112 | BYTE lqi; // Demodulator Estimate for Link Quality
113 | BYTE rssi; // Received Signal Strength Indication
114 | BYTE marcstate; // Main Radio Control State Machine State
115 | BYTE wortime1; // High Byte of WOR Time
116 | BYTE wortime0; // Low Byte of WOR Time
117 | BYTE pktstatus; // Current GDOx Status and Packet Status
118 | BYTE vco_vc_dac; // Current Setting from PLL Calibration Module
119 | BYTE txbytes; // Underflow and Number of Bytes
120 | BYTE rxbytes; // Overflow and Number of Bytes
121 | BYTE rf1aifctl0; // Radio interface control register 0
122 | BYTE rf1aifctl1; // Radio interface control register 1
123 | BYTE rf1aifctl2; // Reserved
124 | BYTE rf1aiferr; // Radio interface error flag register
125 | BYTE rf1aiferrv; // Radio interface error vector word register
126 | BYTE rf1aifiv; // Radio interface interrupt vector word register
127 | BYTE rf1ainstrw; // Radio instruction word register
128 | BYTE rf1ainstr1w; // Radio instruction word register with 1-byte auto-read (low-byte ignored)
129 | BYTE rf1ainstr2w; // Radio instruction word register with 2-byte auto-read (low-byte ignored)
130 | BYTE rf1adinw; // Radio word data in register
131 | BYTE rf1astat0w; // Radio status word register without auto-read
132 | BYTE rf1astat1w; // Radio status word register with 1-byte auto-read
133 | BYTE rf1astat2w; // Radio status word register with 2-byte auto-read
134 | BYTE rf1adout0w; // Radio core word data out register without auto-read
135 | BYTE rf1adout1w; // Radio core word data out register with 1-byte auto-read
136 | BYTE rf1adout2w; // Radio core word data out register with 2-byte auto-read
137 | BYTE rf1ain; // Radio core signal input register
138 | BYTE rf1aifg; // Radio core interrupt flag register
139 | BYTE rf1aies; // Radio core interrupt edge select register
140 | BYTE rf1aie; // Radio core interrupt enable register
141 | BYTE rf1aiv; // Radio core interrupt vector word register
142 | BYTE rf1arxfifo; // Direct receive FIFO access register
143 | BYTE rf1atxfifo; // Direct transmit FIFO access register
144 | } RADIO_REGS;
145 |
146 | // Define section
147 | #define st(x) do { x } while (__LINE__ == -1)
148 | #define ENTER_CRITICAL_SECTION(x) st( x = __get_interrupt_state(); __disable_interrupt(); )
149 | #define EXIT_CRITICAL_SECTION(x) __set_interrupt_state(x)
150 |
151 | #define FIFO_CAPACITY 64L
152 |
153 | // radio modulation
154 | #define MASK_MOD_FORMAT (BIT6 | BIT5 | BIT4)
155 | #define MOD_2_FSK (0x00 << 4)
156 | #define MOD_2_GFSK (0x01 << 4)
157 | #define MOD_OOK (0x03 << 4)
158 | #define MOD_MSK (0x07 << 4)
159 | // radio sync mode
160 | #define MASK_SYNC_MODE (BIT1 | BIT0)
161 | #define SYNC_MODE_NONE 0x00
162 | // manchester mode
163 | #define MASK_MANCHESTER BIT3
164 | // packet control
165 | #define MASK_LENGTH_CONFIG (BIT1 | BIT0)
166 | #define LENGTH_FIXED 0x00
167 | #define LENGTH_VARIABLE 0x01
168 | #define LENGTH_INFINITE 0x02
169 | // radio states
170 | #define MASK_MARCSTATE (BIT4 | BIT3 | BIT2 | BIT1 | BIT0)
171 | #define MARCSTATE_IDLE 0x01
172 | #define MARCSTATE_TX 0x13
173 | #define MARCSTATE_TX_END 0x14
174 | // FIFO
175 | #define MASK_TXBYTES (BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)
176 |
177 | // prototypes
178 | void do_tx(unsigned char *data, unsigned char packet_length, unsigned long total_length);
179 | void chronic_tx(unsigned char button_data[BUTTON_SEQUENCES][BUTTON_DATA_SIZE],unsigned char sequences);
180 | void chronic_tx_up(u8 line);
181 | void chronic_tx_down(u8 line);
182 | void chronic_config_rf(void);
183 | void WriteBurstPATable(unsigned char *buffer, unsigned char count);
184 | void WriteRfSettings(RADIO_REGS *pRfSettings);
185 |
186 | void config_doorbell(u8 line);
187 | void display_doorbell(u8 line, u8 update);
188 | // frequency specific
189 | #ifdef ISM_LF // 433MHz
190 | void config_ruku(u8 line);
191 | void display_ruku(u8 line, u8 update);
192 | // end ISM_LF 433MHz
193 | #endif
194 |
195 |
--------------------------------------------------------------------------------